author | Nathan Froyd <froydnj@mozilla.com> |
Wed, 20 Jan 2016 16:56:04 -0500 | |
changeset 285343 | 824e64d7a817197e244b8d6ec064c8562f6327ef |
parent 285342 | b1b50935ab45f360774e75a4d814b2f9bf02d916 |
child 285344 | 584e6e436e27ad8e1be258845d821c1c2cda2198 |
push id | 72330 |
push user | nfroyd@mozilla.com |
push date | Wed, 24 Feb 2016 16:33:57 +0000 |
treeherder | mozilla-inbound@824e64d7a817 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mcmanus |
bugs | 1247393 |
milestone | 47.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/netwerk/ipc/ChannelEventQueue.h +++ b/netwerk/ipc/ChannelEventQueue.h @@ -3,18 +3,19 @@ */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_net_ChannelEventQueue_h #define mozilla_net_ChannelEventQueue_h -#include <nsTArray.h> -#include <nsAutoPtr.h> +#include "nsTArray.h" +#include "nsAutoPtr.h" +#include "mozilla/UniquePtr.h" class nsISupports; class nsIEventTarget; namespace mozilla { namespace net { class ChannelEvent @@ -46,17 +47,17 @@ class ChannelEventQueue final // Checks to determine if an IPDL-generated channel event can be processed // immediately, or needs to be queued using Enqueue(). inline bool ShouldEnqueue(); // Puts IPDL-generated channel event into queue, to be run later // automatically when EndForcedQueueing and/or Resume is called. inline void Enqueue(ChannelEvent* callback); - inline nsresult PrependEvents(nsTArray<nsAutoPtr<ChannelEvent> >& aEvents); + inline nsresult PrependEvents(nsTArray<UniquePtr<ChannelEvent>>& aEvents); // After StartForcedQueueing is called, ShouldEnqueue() will return true and // no events will be run/flushed until EndForcedQueueing is called. // - Note: queueing may still be required after EndForcedQueueing() (if the // queue is suspended, etc): always call ShouldEnqueue() to determine // whether queueing is needed. inline void StartForcedQueueing(); inline void EndForcedQueueing(); @@ -77,17 +78,17 @@ class ChannelEventQueue final ~ChannelEventQueue() { } inline void MaybeFlushQueue(); void FlushQueue(); inline void CompleteResume(); - nsTArray<nsAutoPtr<ChannelEvent> > mEventQueue; + nsTArray<UniquePtr<ChannelEvent>> mEventQueue; uint32_t mSuspendCount; bool mSuspended; bool mForced; bool mFlushing; // Keep ptr to avoid refcount cycle: only grab ref during flushing. nsISupports *mOwner; @@ -124,24 +125,26 @@ ChannelEventQueue::StartForcedQueueing() inline void ChannelEventQueue::EndForcedQueueing() { mForced = false; MaybeFlushQueue(); } inline nsresult -ChannelEventQueue::PrependEvents(nsTArray<nsAutoPtr<ChannelEvent> >& aEvents) +ChannelEventQueue::PrependEvents(nsTArray<UniquePtr<ChannelEvent>>& aEvents) { - if (!mEventQueue.InsertElementsAt(0, aEvents.Length())) { + UniquePtr<ChannelEvent>* newEvents = + mEventQueue.InsertElementsAt(0, aEvents.Length()); + if (!newEvents) { return NS_ERROR_OUT_OF_MEMORY; } for (uint32_t i = 0; i < aEvents.Length(); i++) { - mEventQueue.ReplaceElementAt(i, aEvents[i].forget()); + newEvents[i] = Move(aEvents[i]); } return NS_OK; } inline void ChannelEventQueue::Suspend() { mSuspended = true;
--- a/netwerk/protocol/ftp/FTPChannelChild.cpp +++ b/netwerk/protocol/ftp/FTPChannelChild.cpp @@ -445,17 +445,17 @@ FTPChannelChild::DoOnDataAvailable(const return; } if (mCanceled) return; if (mUnknownDecoderInvolved) { mUnknownDecoderEventQ.AppendElement( - new MaybeDivertOnDataFTPEvent(this, data, offset, count)); + MakeUnique<MaybeDivertOnDataFTPEvent>(this, data, offset, count)); } // NOTE: the OnDataAvailable contract requires the client to read all the data // in the inputstream. This code relies on that ('data' will go away after // this function). Apparently the previous, non-e10s behavior was to actually // support only reading part of the data, allowing later calls to read the // rest. nsCOMPtr<nsIInputStream> stringStream; @@ -552,17 +552,17 @@ FTPChannelChild::DoOnStopRequest(const n return; } if (!mCanceled) mStatus = aChannelStatus; if (mUnknownDecoderInvolved) { mUnknownDecoderEventQ.AppendElement( - new MaybeDivertOnStopFTPEvent(this, aChannelStatus)); + MakeUnique<MaybeDivertOnStopFTPEvent>(this, aChannelStatus)); } { // Ensure that all queued ipdl events are dispatched before // we initiate protocol deletion below. mIsPending = false; AutoEventEnqueuer ensureSerialDispatch(mEventQ); (void)mListener->OnStopRequest(this, mListenerContext, aChannelStatus); mListener = nullptr;
--- a/netwerk/protocol/ftp/FTPChannelChild.h +++ b/netwerk/protocol/ftp/FTPChannelChild.h @@ -3,16 +3,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_net_FTPChannelChild_h #define mozilla_net_FTPChannelChild_h +#include "mozilla/UniquePtr.h" #include "mozilla/net/PFTPChannelChild.h" #include "mozilla/net/ChannelEventQueue.h" #include "nsBaseChannel.h" #include "nsIFTPChannel.h" #include "nsIUploadChannel.h" #include "nsIProxiedChannel.h" #include "nsIResumableChannel.h" #include "nsIChildChannel.h" @@ -121,17 +122,17 @@ private: nsCOMPtr<nsIInputStream> mUploadStream; bool mIPCOpen; RefPtr<ChannelEventQueue> mEventQ; // If nsUnknownDecoder is involved we queue onDataAvailable (and possibly // OnStopRequest) so that we can divert them if needed when the listener's // OnStartRequest is finally called - nsTArray<nsAutoPtr<ChannelEvent>> mUnknownDecoderEventQ; + nsTArray<UniquePtr<ChannelEvent>> mUnknownDecoderEventQ; bool mUnknownDecoderInvolved; bool mCanceled; uint32_t mSuspendCount; bool mIsPending; PRTime mLastModifiedTime; uint64_t mStartPos;
--- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -693,17 +693,17 @@ HttpChannelChild::OnTransportAndData(con if (mCanceled) return; if (mUnknownDecoderInvolved) { LOG(("UnknownDecoder is involved queue OnDataAvailable call. [this=%p]", this)); mUnknownDecoderEventQ.AppendElement( - new MaybeDivertOnDataHttpEvent(this, data, offset, count)); + MakeUnique<MaybeDivertOnDataHttpEvent>(this, data, offset, count)); } // Hold queue lock throughout all three calls, else we might process a later // necko msg in between them. AutoEventEnqueuer ensureSerialDispatch(mEventQ); DoOnStatus(this, transportStatus); DoOnProgress(this, progress, progressMax); @@ -880,17 +880,17 @@ HttpChannelChild::OnStopRequest(const ns SendDivertOnStopRequest(channelStatus); return; } if (mUnknownDecoderInvolved) { LOG(("UnknownDecoder is involved queue OnStopRequest call. [this=%p]", this)); mUnknownDecoderEventQ.AppendElement( - new MaybeDivertOnStopHttpEvent(this, channelStatus)); + MakeUnique<MaybeDivertOnStopHttpEvent>(this, channelStatus)); } nsCOMPtr<nsICompressConvStats> conv = do_QueryInterface(mCompressListener); if (conv) { conv->GetDecodedDataLength(&mDecodedBodySize); } mTransactionTimings.domainLookupStart = timing.domainLookupStart;
--- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -3,16 +3,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_net_HttpChannelChild_h #define mozilla_net_HttpChannelChild_h +#include "mozilla/UniquePtr.h" #include "mozilla/net/HttpBaseChannel.h" #include "mozilla/net/PHttpChannelChild.h" #include "mozilla/net/ChannelEventQueue.h" #include "nsIStreamListener.h" #include "nsILoadGroup.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" @@ -199,17 +200,17 @@ private: bool mIPCOpen; bool mKeptAlive; // IPC kept open, but only for security info RefPtr<ChannelEventQueue> mEventQ; // If nsUnknownDecoder is involved OnStartRequest call will be delayed and // this queue keeps OnDataAvailable data until OnStartRequest is finally // called. - nsTArray<nsAutoPtr<ChannelEvent>> mUnknownDecoderEventQ; + nsTArray<UniquePtr<ChannelEvent>> mUnknownDecoderEventQ; bool mUnknownDecoderInvolved; // Once set, OnData and possibly OnStop will be diverted to the parent. bool mDivertingToParent; // Once set, no OnStart/OnData/OnStop callbacks should be received from the // parent channel, nor dequeued from the ChannelEventQueue. bool mFlushedForDiversion; // Set if SendSuspend is called. Determines if SendResume is needed when