forked from mirrors/gecko-dev
Bug 1240547 - Part 5: Reorder HttpBaseChannel member variables. r=valentin
--HG-- extra : rebase_source : af73138c747517bb82658a4a1e9f3cf357db2f91
This commit is contained in:
parent
34bd603e7b
commit
c8e70cc096
2 changed files with 114 additions and 118 deletions
|
|
@ -156,14 +156,25 @@ private:
|
||||||
NS_IMPL_ISUPPORTS(AddHeadersToChannelVisitor, nsIHttpHeaderVisitor)
|
NS_IMPL_ISUPPORTS(AddHeadersToChannelVisitor, nsIHttpHeaderVisitor)
|
||||||
|
|
||||||
HttpBaseChannel::HttpBaseChannel()
|
HttpBaseChannel::HttpBaseChannel()
|
||||||
: mCanceled(false)
|
: mReportCollector(new ConsoleReportCollector())
|
||||||
|
, mHttpHandler(gHttpHandler)
|
||||||
|
, mChannelCreationTime(0)
|
||||||
, mStartPos(UINT64_MAX)
|
, mStartPos(UINT64_MAX)
|
||||||
|
, mTransferSize(0)
|
||||||
|
, mDecodedBodySize(0)
|
||||||
|
, mEncodedBodySize(0)
|
||||||
|
, mRequestContextID(0)
|
||||||
|
, mContentWindowId(0)
|
||||||
|
, mTopLevelOuterContentWindowId(0)
|
||||||
|
, mAltDataLength(0)
|
||||||
|
, mChannelId(0)
|
||||||
|
, mReqContentLength(0U)
|
||||||
, mStatus(NS_OK)
|
, mStatus(NS_OK)
|
||||||
|
, mCanceled(false)
|
||||||
|
, mIsTrackingResource(false)
|
||||||
, mLoadFlags(LOAD_NORMAL)
|
, mLoadFlags(LOAD_NORMAL)
|
||||||
, mCaps(0)
|
, mCaps(0)
|
||||||
, mClassOfService(0)
|
, mClassOfService(0)
|
||||||
, mPriority(PRIORITY_NORMAL)
|
|
||||||
, mRedirectionLimit(gHttpHandler->RedirectionLimit())
|
|
||||||
, mUpgradeToSecure(false)
|
, mUpgradeToSecure(false)
|
||||||
, mApplyConversion(true)
|
, mApplyConversion(true)
|
||||||
, mIsPending(false)
|
, mIsPending(false)
|
||||||
|
|
@ -192,40 +203,29 @@ HttpBaseChannel::HttpBaseChannel()
|
||||||
, mAllowStaleCacheContent(false)
|
, mAllowStaleCacheContent(false)
|
||||||
, mAddedAsNonTailRequest(false)
|
, mAddedAsNonTailRequest(false)
|
||||||
, mAsyncOpenWaitingForStreamLength(false)
|
, mAsyncOpenWaitingForStreamLength(false)
|
||||||
|
, mUpgradableToSecure(true)
|
||||||
, mTlsFlags(0)
|
, mTlsFlags(0)
|
||||||
, mSuspendCount(0)
|
, mSuspendCount(0)
|
||||||
, mInitialRwin(0)
|
, mInitialRwin(0)
|
||||||
, mProxyResolveFlags(0)
|
, mProxyResolveFlags(0)
|
||||||
, mContentDispositionHint(UINT32_MAX)
|
, mContentDispositionHint(UINT32_MAX)
|
||||||
, mHttpHandler(gHttpHandler)
|
|
||||||
, mReferrerPolicy(NS_GetDefaultReferrerPolicy())
|
, mReferrerPolicy(NS_GetDefaultReferrerPolicy())
|
||||||
|
, mCorsMode(nsIHttpChannelInternal::CORS_MODE_NO_CORS)
|
||||||
|
, mRedirectMode(nsIHttpChannelInternal::REDIRECT_MODE_FOLLOW)
|
||||||
|
, mLastRedirectFlags(0)
|
||||||
|
, mPriority(PRIORITY_NORMAL)
|
||||||
|
, mRedirectionLimit(gHttpHandler->RedirectionLimit())
|
||||||
, mRedirectCount(0)
|
, mRedirectCount(0)
|
||||||
, mInternalRedirectCount(0)
|
, mInternalRedirectCount(0)
|
||||||
, mChannelCreationTime(0)
|
|
||||||
, mAsyncOpenTimeOverriden(false)
|
, mAsyncOpenTimeOverriden(false)
|
||||||
, mForcePending(false)
|
, mForcePending(false)
|
||||||
, mCorsIncludeCredentials(false)
|
, mCorsIncludeCredentials(false)
|
||||||
, mCorsMode(nsIHttpChannelInternal::CORS_MODE_NO_CORS)
|
|
||||||
, mRedirectMode(nsIHttpChannelInternal::REDIRECT_MODE_FOLLOW)
|
|
||||||
, mOnStartRequestCalled(false)
|
, mOnStartRequestCalled(false)
|
||||||
, mOnStopRequestCalled(false)
|
, mOnStopRequestCalled(false)
|
||||||
, mUpgradableToSecure(true)
|
|
||||||
, mAfterOnStartRequestBegun(false)
|
, mAfterOnStartRequestBegun(false)
|
||||||
, mTransferSize(0)
|
|
||||||
, mDecodedBodySize(0)
|
|
||||||
, mEncodedBodySize(0)
|
|
||||||
, mRequestContextID(0)
|
|
||||||
, mContentWindowId(0)
|
|
||||||
, mTopLevelOuterContentWindowId(0)
|
|
||||||
, mRequireCORSPreflight(false)
|
, mRequireCORSPreflight(false)
|
||||||
, mReportCollector(new ConsoleReportCollector())
|
|
||||||
, mAltDataLength(0)
|
|
||||||
, mAltDataForChild(false)
|
, mAltDataForChild(false)
|
||||||
, mForceMainDocumentChannel(false)
|
, mForceMainDocumentChannel(false)
|
||||||
, mIsTrackingResource(false)
|
|
||||||
, mChannelId(0)
|
|
||||||
, mLastRedirectFlags(0)
|
|
||||||
, mReqContentLength(0U)
|
|
||||||
, mPendingInputStreamLengthOperation(false)
|
, mPendingInputStreamLengthOperation(false)
|
||||||
{
|
{
|
||||||
this->mSelfAddr.inet = {};
|
this->mSelfAddr.inet = {};
|
||||||
|
|
|
||||||
|
|
@ -536,11 +536,28 @@ private:
|
||||||
MaybeResumeAsyncOpen();
|
MaybeResumeAsyncOpen();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Use Release-Acquire ordering to ensure the OMT ODA is ignored while channel
|
nsCString mSpec; // ASCII encoded URL spec
|
||||||
// is canceled on main thread.
|
nsCString mContentTypeHint;
|
||||||
Atomic<bool, ReleaseAcquire> mCanceled;
|
nsCString mContentCharsetHint;
|
||||||
|
nsCString mUserSetCookieHeader;
|
||||||
|
// HTTP Upgrade Data
|
||||||
|
nsCString mUpgradeProtocol;
|
||||||
|
// Resumable channel specific data
|
||||||
|
nsCString mEntityID;
|
||||||
|
// The initiator type (for this resource) - how was the resource referenced in
|
||||||
|
// the HTML file.
|
||||||
|
nsString mInitiatorType;
|
||||||
|
// Holds the name of the preferred alt-data type.
|
||||||
|
nsCString mPreferredCachedAltDataType;
|
||||||
|
// Holds the name of the alternative data type the channel returned.
|
||||||
|
nsCString mAvailableCachedAltDataType;
|
||||||
|
nsString mIntegrityMetadata;
|
||||||
|
|
||||||
|
// Classified channel's matched information
|
||||||
|
nsCString mMatchedList;
|
||||||
|
nsCString mMatchedProvider;
|
||||||
|
nsCString mMatchedFullHash;
|
||||||
|
|
||||||
nsTArray<Pair<nsString, nsString>> mSecurityConsoleMessages;
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> mOwner;
|
nsCOMPtr<nsISupports> mOwner;
|
||||||
|
|
||||||
|
|
@ -554,29 +571,65 @@ protected:
|
||||||
RefPtr<nsHttpConnectionInfo> mConnectionInfo;
|
RefPtr<nsHttpConnectionInfo> mConnectionInfo;
|
||||||
nsCOMPtr<nsIProxyInfo> mProxyInfo;
|
nsCOMPtr<nsIProxyInfo> mProxyInfo;
|
||||||
nsCOMPtr<nsISupports> mSecurityInfo;
|
nsCOMPtr<nsISupports> mSecurityInfo;
|
||||||
|
nsCOMPtr<nsIHttpUpgradeListener> mUpgradeProtocolCallback;
|
||||||
|
nsAutoPtr<nsString> mContentDispositionFilename;
|
||||||
|
nsCOMPtr<nsIConsoleReportCollector> mReportCollector;
|
||||||
|
|
||||||
nsCString mSpec; // ASCII encoded URL spec
|
RefPtr<nsHttpHandler> mHttpHandler; // keep gHttpHandler alive
|
||||||
nsCString mContentTypeHint;
|
nsAutoPtr<nsTArray<nsCString> > mRedirectedCachekeys;
|
||||||
nsCString mContentCharsetHint;
|
nsCOMPtr<nsIRequestContext> mRequestContext;
|
||||||
nsCString mUserSetCookieHeader;
|
|
||||||
|
|
||||||
NetAddr mSelfAddr;
|
NetAddr mSelfAddr;
|
||||||
NetAddr mPeerAddr;
|
NetAddr mPeerAddr;
|
||||||
|
|
||||||
// HTTP Upgrade Data
|
nsTArray<Pair<nsString, nsString>> mSecurityConsoleMessages;
|
||||||
nsCString mUpgradeProtocol;
|
nsTArray<nsCString> mUnsafeHeaders;
|
||||||
nsCOMPtr<nsIHttpUpgradeListener> mUpgradeProtocolCallback;
|
|
||||||
|
// A time value equal to the starting time of the fetch that initiates the
|
||||||
|
// redirect.
|
||||||
|
mozilla::TimeStamp mRedirectStartTimeStamp;
|
||||||
|
// A time value equal to the time immediately after receiving the last byte of
|
||||||
|
// the response of the last redirect.
|
||||||
|
mozilla::TimeStamp mRedirectEndTimeStamp;
|
||||||
|
|
||||||
|
PRTime mChannelCreationTime;
|
||||||
|
TimeStamp mChannelCreationTimestamp;
|
||||||
|
TimeStamp mAsyncOpenTime;
|
||||||
|
TimeStamp mCacheReadStart;
|
||||||
|
TimeStamp mCacheReadEnd;
|
||||||
|
TimeStamp mLaunchServiceWorkerStart;
|
||||||
|
TimeStamp mLaunchServiceWorkerEnd;
|
||||||
|
TimeStamp mDispatchFetchEventStart;
|
||||||
|
TimeStamp mDispatchFetchEventEnd;
|
||||||
|
TimeStamp mHandleFetchEventStart;
|
||||||
|
TimeStamp mHandleFetchEventEnd;
|
||||||
|
// copied from the transaction before we null out mTransaction
|
||||||
|
// so that the timing can still be queried from OnStopRequest
|
||||||
|
TimingStruct mTransactionTimings;
|
||||||
|
|
||||||
// Resumable channel specific data
|
|
||||||
nsCString mEntityID;
|
|
||||||
uint64_t mStartPos;
|
uint64_t mStartPos;
|
||||||
|
uint64_t mTransferSize;
|
||||||
|
uint64_t mDecodedBodySize;
|
||||||
|
uint64_t mEncodedBodySize;
|
||||||
|
uint64_t mRequestContextID;
|
||||||
|
// ID of the top-level document's inner window this channel is being
|
||||||
|
// originated from.
|
||||||
|
uint64_t mContentWindowId;
|
||||||
|
uint64_t mTopLevelOuterContentWindowId;
|
||||||
|
int64_t mAltDataLength;
|
||||||
|
uint64_t mChannelId;
|
||||||
|
uint64_t mReqContentLength;
|
||||||
|
|
||||||
Atomic<nsresult, ReleaseAcquire> mStatus;
|
Atomic<nsresult, ReleaseAcquire> mStatus;
|
||||||
|
|
||||||
|
// Use Release-Acquire ordering to ensure the OMT ODA is ignored while channel
|
||||||
|
// is canceled on main thread.
|
||||||
|
Atomic<bool, ReleaseAcquire> mCanceled;
|
||||||
|
Atomic<bool, ReleaseAcquire> mIsTrackingResource;
|
||||||
|
|
||||||
uint32_t mLoadFlags;
|
uint32_t mLoadFlags;
|
||||||
uint32_t mCaps;
|
uint32_t mCaps;
|
||||||
uint32_t mClassOfService;
|
uint32_t mClassOfService;
|
||||||
int16_t mPriority;
|
|
||||||
uint8_t mRedirectionLimit;
|
|
||||||
|
|
||||||
uint32_t mUpgradeToSecure : 1;
|
uint32_t mUpgradeToSecure : 1;
|
||||||
uint32_t mApplyConversion : 1;
|
uint32_t mApplyConversion : 1;
|
||||||
|
|
@ -626,6 +679,11 @@ protected:
|
||||||
// callback, passing the stream length value.
|
// callback, passing the stream length value.
|
||||||
uint32_t mAsyncOpenWaitingForStreamLength : 1;
|
uint32_t mAsyncOpenWaitingForStreamLength : 1;
|
||||||
|
|
||||||
|
// Defaults to true. This is set to false when it is no longer possible
|
||||||
|
// to upgrade the request to a secure channel.
|
||||||
|
uint32_t mUpgradableToSecure : 1;
|
||||||
|
|
||||||
|
|
||||||
// An opaque flags for non-standard behavior of the TLS system.
|
// An opaque flags for non-standard behavior of the TLS system.
|
||||||
// It is unlikely this will need to be set outside of telemetry studies
|
// It is unlikely this will need to be set outside of telemetry studies
|
||||||
// relating to the TLS implementation.
|
// relating to the TLS implementation.
|
||||||
|
|
@ -637,74 +695,54 @@ protected:
|
||||||
// Per channel transport window override (0 means no override)
|
// Per channel transport window override (0 means no override)
|
||||||
uint32_t mInitialRwin;
|
uint32_t mInitialRwin;
|
||||||
|
|
||||||
nsAutoPtr<nsTArray<nsCString> > mRedirectedCachekeys;
|
|
||||||
|
|
||||||
uint32_t mProxyResolveFlags;
|
uint32_t mProxyResolveFlags;
|
||||||
|
|
||||||
uint32_t mContentDispositionHint;
|
uint32_t mContentDispositionHint;
|
||||||
nsAutoPtr<nsString> mContentDispositionFilename;
|
|
||||||
|
|
||||||
RefPtr<nsHttpHandler> mHttpHandler; // keep gHttpHandler alive
|
|
||||||
|
|
||||||
uint32_t mReferrerPolicy;
|
uint32_t mReferrerPolicy;
|
||||||
|
|
||||||
|
uint32_t mCorsMode;
|
||||||
|
uint32_t mRedirectMode;
|
||||||
|
|
||||||
|
// If this channel was created as the result of a redirect, then this value
|
||||||
|
// will reflect the redirect flags passed to the SetupReplacementChannel()
|
||||||
|
// method.
|
||||||
|
uint32_t mLastRedirectFlags;
|
||||||
|
|
||||||
|
int16_t mPriority;
|
||||||
|
uint8_t mRedirectionLimit;
|
||||||
|
|
||||||
// Performance tracking
|
// Performance tracking
|
||||||
// The initiator type (for this resource) - how was the resource referenced in
|
|
||||||
// the HTML file.
|
|
||||||
nsString mInitiatorType;
|
|
||||||
// Number of redirects that has occurred.
|
// Number of redirects that has occurred.
|
||||||
int8_t mRedirectCount;
|
int8_t mRedirectCount;
|
||||||
// Number of internal redirects that has occurred.
|
// Number of internal redirects that has occurred.
|
||||||
int8_t mInternalRedirectCount;
|
int8_t mInternalRedirectCount;
|
||||||
// A time value equal to the starting time of the fetch that initiates the
|
|
||||||
// redirect.
|
|
||||||
mozilla::TimeStamp mRedirectStartTimeStamp;
|
|
||||||
// A time value equal to the time immediately after receiving the last byte of
|
|
||||||
// the response of the last redirect.
|
|
||||||
mozilla::TimeStamp mRedirectEndTimeStamp;
|
|
||||||
|
|
||||||
PRTime mChannelCreationTime;
|
|
||||||
TimeStamp mChannelCreationTimestamp;
|
|
||||||
TimeStamp mAsyncOpenTime;
|
|
||||||
TimeStamp mCacheReadStart;
|
|
||||||
TimeStamp mCacheReadEnd;
|
|
||||||
TimeStamp mLaunchServiceWorkerStart;
|
|
||||||
TimeStamp mLaunchServiceWorkerEnd;
|
|
||||||
TimeStamp mDispatchFetchEventStart;
|
|
||||||
TimeStamp mDispatchFetchEventEnd;
|
|
||||||
TimeStamp mHandleFetchEventStart;
|
|
||||||
TimeStamp mHandleFetchEventEnd;
|
|
||||||
// copied from the transaction before we null out mTransaction
|
|
||||||
// so that the timing can still be queried from OnStopRequest
|
|
||||||
TimingStruct mTransactionTimings;
|
|
||||||
|
|
||||||
bool mAsyncOpenTimeOverriden;
|
bool mAsyncOpenTimeOverriden;
|
||||||
bool mForcePending;
|
bool mForcePending;
|
||||||
|
|
||||||
bool mCorsIncludeCredentials;
|
bool mCorsIncludeCredentials;
|
||||||
uint32_t mCorsMode;
|
|
||||||
uint32_t mRedirectMode;
|
|
||||||
|
|
||||||
// These parameters are used to ensure that we do not call OnStartRequest and
|
// These parameters are used to ensure that we do not call OnStartRequest and
|
||||||
// OnStopRequest more than once.
|
// OnStopRequest more than once.
|
||||||
bool mOnStartRequestCalled;
|
bool mOnStartRequestCalled;
|
||||||
bool mOnStopRequestCalled;
|
bool mOnStopRequestCalled;
|
||||||
|
|
||||||
// Defaults to true. This is set to false when it is no longer possible
|
|
||||||
// to upgrade the request to a secure channel.
|
|
||||||
uint32_t mUpgradableToSecure : 1;
|
|
||||||
|
|
||||||
// Defaults to false. Is set to true at the begining of OnStartRequest.
|
// Defaults to false. Is set to true at the begining of OnStartRequest.
|
||||||
// Used to ensure methods can't be called before OnStartRequest.
|
// Used to ensure methods can't be called before OnStartRequest.
|
||||||
bool mAfterOnStartRequestBegun;
|
bool mAfterOnStartRequestBegun;
|
||||||
|
|
||||||
uint64_t mTransferSize;
|
bool mRequireCORSPreflight;
|
||||||
uint64_t mDecodedBodySize;
|
|
||||||
uint64_t mEncodedBodySize;
|
// This flag will be true if the consumer is requesting alt-data AND the
|
||||||
|
// consumer is in the child process.
|
||||||
|
bool mAltDataForChild;
|
||||||
|
|
||||||
|
bool mForceMainDocumentChannel;
|
||||||
|
// This is set true if the channel is waiting for the
|
||||||
|
// InputStreamLengthHelper::GetAsyncLength callback.
|
||||||
|
bool mPendingInputStreamLengthOperation;
|
||||||
|
|
||||||
uint64_t mRequestContextID;
|
|
||||||
bool EnsureRequestContextID();
|
bool EnsureRequestContextID();
|
||||||
nsCOMPtr<nsIRequestContext> mRequestContext;
|
|
||||||
bool EnsureRequestContext();
|
bool EnsureRequestContext();
|
||||||
|
|
||||||
// Adds/removes this channel as a non-tailed request in its request context
|
// Adds/removes this channel as a non-tailed request in its request context
|
||||||
|
|
@ -713,49 +751,7 @@ protected:
|
||||||
void AddAsNonTailRequest();
|
void AddAsNonTailRequest();
|
||||||
void RemoveAsNonTailRequest();
|
void RemoveAsNonTailRequest();
|
||||||
|
|
||||||
// ID of the top-level document's inner window this channel is being
|
|
||||||
// originated from.
|
|
||||||
uint64_t mContentWindowId;
|
|
||||||
|
|
||||||
uint64_t mTopLevelOuterContentWindowId;
|
|
||||||
void EnsureTopLevelOuterContentWindowId();
|
void EnsureTopLevelOuterContentWindowId();
|
||||||
|
|
||||||
bool mRequireCORSPreflight;
|
|
||||||
nsTArray<nsCString> mUnsafeHeaders;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIConsoleReportCollector> mReportCollector;
|
|
||||||
|
|
||||||
// Holds the name of the preferred alt-data type.
|
|
||||||
nsCString mPreferredCachedAltDataType;
|
|
||||||
// Holds the name of the alternative data type the channel returned.
|
|
||||||
nsCString mAvailableCachedAltDataType;
|
|
||||||
int64_t mAltDataLength;
|
|
||||||
// This flag will be true if the consumer is requesting alt-data AND the
|
|
||||||
// consumer is in the child process.
|
|
||||||
bool mAltDataForChild;
|
|
||||||
|
|
||||||
bool mForceMainDocumentChannel;
|
|
||||||
Atomic<bool, ReleaseAcquire> mIsTrackingResource;
|
|
||||||
|
|
||||||
uint64_t mChannelId;
|
|
||||||
|
|
||||||
// If this channel was created as the result of a redirect, then this value
|
|
||||||
// will reflect the redirect flags passed to the SetupReplacementChannel()
|
|
||||||
// method.
|
|
||||||
uint32_t mLastRedirectFlags;
|
|
||||||
|
|
||||||
uint64_t mReqContentLength;
|
|
||||||
|
|
||||||
nsString mIntegrityMetadata;
|
|
||||||
|
|
||||||
// Classified channel's matched information
|
|
||||||
nsCString mMatchedList;
|
|
||||||
nsCString mMatchedProvider;
|
|
||||||
nsCString mMatchedFullHash;
|
|
||||||
|
|
||||||
// This is set true if the channel is waiting for the
|
|
||||||
// InputStreamLengthHelper::GetAsyncLength callback.
|
|
||||||
bool mPendingInputStreamLengthOperation;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(HttpBaseChannel, HTTP_BASE_CHANNEL_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(HttpBaseChannel, HTTP_BASE_CHANNEL_IID)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue