mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1240547 - Part 3: Reorder HttpChannelChild member variables. r=valentin
--HG-- extra : rebase_source : f1c33e1b77f9ce0fd70838ed27331c8490163774
This commit is contained in:
parent
a388fe4b0c
commit
4fa3e432dd
@ -160,21 +160,23 @@ InterceptStreamListener::Cleanup()
|
||||
HttpChannelChild::HttpChannelChild()
|
||||
: HttpAsyncAborter<HttpChannelChild>(this)
|
||||
, NeckoTargetHolder(nullptr)
|
||||
, mCacheKey(0)
|
||||
, mBgChildMutex("HttpChannelChild::BgChildMutex")
|
||||
, mEventTargetMutex("HttpChannelChild::EventTargetMutex")
|
||||
, mSynthesizedStreamLength(0)
|
||||
, mIsFromCache(false)
|
||||
, mCacheEntryAvailable(false)
|
||||
, mCacheEntryId(0)
|
||||
, mAltDataCacheEntryAvailable(false)
|
||||
, mCacheKey(0)
|
||||
, mCacheFetchCount(0)
|
||||
, mCacheExpirationTime(nsICacheEntry::NO_EXPIRATION_TIME)
|
||||
, mSendResumeAt(false)
|
||||
, mDeletingChannelSent(false)
|
||||
, mIPCOpen(false)
|
||||
, mKeptAlive(false)
|
||||
, mUnknownDecoderInvolved(false)
|
||||
, mDivertingToParent(false)
|
||||
, mFlushedForDiversion(false)
|
||||
, mIsFromCache(false)
|
||||
, mCacheEntryAvailable(false)
|
||||
, mAltDataCacheEntryAvailable(false)
|
||||
, mSendResumeAt(false)
|
||||
, mKeptAlive(false)
|
||||
, mSuspendSent(false)
|
||||
, mSynthesizedResponse(false)
|
||||
, mShouldInterceptSubsequentRedirect(false)
|
||||
@ -183,8 +185,6 @@ HttpChannelChild::HttpChannelChild()
|
||||
, mPostRedirectChannelShouldUpgrade(false)
|
||||
, mShouldParentIntercept(false)
|
||||
, mSuspendParentAfterSynthesizeResponse(false)
|
||||
, mBgChildMutex("HttpChannelChild::BgChildMutex")
|
||||
, mEventTargetMutex("HttpChannelChild::EventTargetMutex")
|
||||
{
|
||||
LOG(("Creating HttpChannelChild @%p\n", this));
|
||||
|
||||
|
@ -194,19 +194,6 @@ protected:
|
||||
virtual mozilla::ipc::IPCResult RecvLogBlockedCORSRequest(const nsString& aMessage, const nsCString& aCategory) override;
|
||||
NS_IMETHOD LogBlockedCORSRequest(const nsAString & aMessage, const nsACString& aCategory) override;
|
||||
|
||||
private:
|
||||
// this section is for main-thread-only object
|
||||
// all the references need to be proxy released on main thread.
|
||||
uint32_t mCacheKey;
|
||||
nsCOMPtr<nsIChildChannel> mRedirectChannelChild;
|
||||
RefPtr<InterceptStreamListener> mInterceptListener;
|
||||
// Needed to call AsyncOpen in FinishInterceptedRedirect
|
||||
nsCOMPtr<nsIStreamListener> mInterceptedRedirectListener;
|
||||
nsCOMPtr<nsISupports> mInterceptedRedirectContext;
|
||||
|
||||
// Proxy release all members above on main thread.
|
||||
void ReleaseMainThreadOnlyReferences();
|
||||
|
||||
private:
|
||||
|
||||
class OverrideRunnable : public Runnable {
|
||||
@ -299,40 +286,75 @@ private:
|
||||
void
|
||||
MaybeCallSynthesizedCallback();
|
||||
|
||||
private:
|
||||
// this section is for main-thread-only object
|
||||
// all the references need to be proxy released on main thread.
|
||||
nsCOMPtr<nsIChildChannel> mRedirectChannelChild;
|
||||
RefPtr<InterceptStreamListener> mInterceptListener;
|
||||
// Needed to call AsyncOpen in FinishInterceptedRedirect
|
||||
nsCOMPtr<nsIStreamListener> mInterceptedRedirectListener;
|
||||
nsCOMPtr<nsISupports> mInterceptedRedirectContext;
|
||||
|
||||
// Proxy release all members above on main thread.
|
||||
void ReleaseMainThreadOnlyReferences();
|
||||
|
||||
private:
|
||||
nsCString mCachedCharset;
|
||||
nsCString mProtocolVersion;
|
||||
|
||||
RequestHeaderTuples mClientSetRequestHeaders;
|
||||
RefPtr<nsInputStreamPump> mSynthesizedResponsePump;
|
||||
nsCOMPtr<nsIInputStream> mSynthesizedInput;
|
||||
nsCOMPtr<nsIInterceptedBodyCallback> mSynthesizedCallback;
|
||||
int64_t mSynthesizedStreamLength;
|
||||
|
||||
bool mIsFromCache;
|
||||
bool mCacheEntryAvailable;
|
||||
uint64_t mCacheEntryId;
|
||||
bool mAltDataCacheEntryAvailable;
|
||||
int32_t mCacheFetchCount;
|
||||
uint32_t mCacheExpirationTime;
|
||||
nsCString mCachedCharset;
|
||||
|
||||
nsCOMPtr<nsICacheInfoChannel> mSynthesizedCacheInfo;
|
||||
|
||||
nsCString mProtocolVersion;
|
||||
|
||||
TimeStamp mLastStatusReported;
|
||||
|
||||
// If ResumeAt is called before AsyncOpen, we need to send extra data upstream
|
||||
bool mSendResumeAt;
|
||||
|
||||
// To ensure only one SendDeletingChannel is triggered.
|
||||
Atomic<bool> mDeletingChannelSent;
|
||||
|
||||
Atomic<bool> mIPCOpen;
|
||||
bool mKeptAlive; // IPC kept open, but only for security info
|
||||
RefPtr<ChannelEventQueue> mEventQ;
|
||||
|
||||
// Used to ensure atomicity of mBgChild and mBgInitFailCallback
|
||||
Mutex mBgChildMutex;
|
||||
|
||||
// Associated HTTP background channel
|
||||
RefPtr<HttpBackgroundChannelChild> mBgChild;
|
||||
|
||||
// Error handling procedure if failed to establish PBackground IPC
|
||||
nsCOMPtr<nsIRunnable> mBgInitFailCallback;
|
||||
|
||||
// Remove the association with background channel after OnStopRequest
|
||||
// or AsyncAbort.
|
||||
void CleanupBackgroundChannel();
|
||||
|
||||
// Needed to call CleanupRedirectingChannel in FinishInterceptedRedirect
|
||||
RefPtr<HttpChannelChild> mInterceptingChannel;
|
||||
// Used to call OverrideWithSynthesizedResponse in FinishInterceptedRedirect
|
||||
RefPtr<OverrideRunnable> mOverrideRunnable;
|
||||
|
||||
// Target thread for delivering ODA.
|
||||
nsCOMPtr<nsIEventTarget> mODATarget;
|
||||
// Used to ensure atomicity of mNeckoTarget / mODATarget;
|
||||
Mutex mEventTargetMutex;
|
||||
|
||||
// If nsUnknownDecoder is involved OnStartRequest call will be delayed and
|
||||
// this queue keeps OnDataAvailable data until OnStartRequest is finally
|
||||
// called.
|
||||
nsTArray<UniquePtr<ChannelEvent>> mUnknownDecoderEventQ;
|
||||
|
||||
TimeStamp mLastStatusReported;
|
||||
|
||||
int64_t mSynthesizedStreamLength;
|
||||
uint64_t mCacheEntryId;
|
||||
|
||||
// The result of RetargetDeliveryTo for this channel.
|
||||
// |notRequested| represents OMT is not requested by the channel owner.
|
||||
LABELS_HTTP_CHILD_OMT_STATS mOMTResult = LABELS_HTTP_CHILD_OMT_STATS::notRequested;
|
||||
|
||||
uint32_t mCacheKey;
|
||||
int32_t mCacheFetchCount;
|
||||
uint32_t mCacheExpirationTime;
|
||||
|
||||
// To ensure only one SendDeletingChannel is triggered.
|
||||
Atomic<bool> mDeletingChannelSent;
|
||||
|
||||
Atomic<bool> mIPCOpen;
|
||||
|
||||
Atomic<bool, ReleaseAcquire> mUnknownDecoderInvolved;
|
||||
|
||||
// Once set, OnData and possibly OnStop will be diverted to the parent.
|
||||
@ -340,6 +362,16 @@ private:
|
||||
// Once set, no OnStart/OnData/OnStop callbacks should be received from the
|
||||
// parent channel, nor dequeued from the ChannelEventQueue.
|
||||
Atomic<bool, ReleaseAcquire> mFlushedForDiversion;
|
||||
|
||||
bool mIsFromCache;
|
||||
bool mCacheEntryAvailable;
|
||||
bool mAltDataCacheEntryAvailable;
|
||||
|
||||
// If ResumeAt is called before AsyncOpen, we need to send extra data upstream
|
||||
bool mSendResumeAt;
|
||||
|
||||
bool mKeptAlive; // IPC kept open, but only for security info
|
||||
|
||||
// Set if SendSuspend is called. Determines if SendResume is needed when
|
||||
// diverting callbacks to parent.
|
||||
bool mSuspendSent;
|
||||
@ -371,29 +403,6 @@ private:
|
||||
// is synthesized.
|
||||
bool mSuspendParentAfterSynthesizeResponse;
|
||||
|
||||
// Used to ensure atomicity of mBgChild and mBgInitFailCallback
|
||||
Mutex mBgChildMutex;
|
||||
|
||||
// Associated HTTP background channel
|
||||
RefPtr<HttpBackgroundChannelChild> mBgChild;
|
||||
|
||||
// Error handling procedure if failed to establish PBackground IPC
|
||||
nsCOMPtr<nsIRunnable> mBgInitFailCallback;
|
||||
|
||||
// Remove the association with background channel after OnStopRequest
|
||||
// or AsyncAbort.
|
||||
void CleanupBackgroundChannel();
|
||||
|
||||
// Needed to call CleanupRedirectingChannel in FinishInterceptedRedirect
|
||||
RefPtr<HttpChannelChild> mInterceptingChannel;
|
||||
// Used to call OverrideWithSynthesizedResponse in FinishInterceptedRedirect
|
||||
RefPtr<OverrideRunnable> mOverrideRunnable;
|
||||
|
||||
// Target thread for delivering ODA.
|
||||
nsCOMPtr<nsIEventTarget> mODATarget;
|
||||
// Used to ensure atomicity of mNeckoTarget / mODATarget;
|
||||
Mutex mEventTargetMutex;
|
||||
|
||||
void FinishInterceptedRedirect();
|
||||
void CleanupRedirectingChannel(nsresult rv);
|
||||
|
||||
@ -466,10 +475,6 @@ private:
|
||||
// Collect telemetry for the successful rate of OMT.
|
||||
void CollectOMTTelemetry();
|
||||
|
||||
// The result of RetargetDeliveryTo for this channel.
|
||||
// |notRequested| represents OMT is not requested by the channel owner.
|
||||
LABELS_HTTP_CHILD_OMT_STATS mOMTResult = LABELS_HTTP_CHILD_OMT_STATS::notRequested;
|
||||
|
||||
friend class AssociateApplicationCacheEvent;
|
||||
friend class StartRequestEvent;
|
||||
friend class StopRequestEvent;
|
||||
|
Loading…
Reference in New Issue
Block a user