Bug 1240547 - Part 5: Reorder HttpBaseChannel member variables. r=valentin

--HG--
extra : rebase_source : af73138c747517bb82658a4a1e9f3cf357db2f91
This commit is contained in:
Eric Rahm 2018-07-20 16:56:22 -07:00
parent 34bd603e7b
commit c8e70cc096
2 changed files with 114 additions and 118 deletions

View File

@ -156,14 +156,25 @@ private:
NS_IMPL_ISUPPORTS(AddHeadersToChannelVisitor, nsIHttpHeaderVisitor)
HttpBaseChannel::HttpBaseChannel()
: mCanceled(false)
: mReportCollector(new ConsoleReportCollector())
, mHttpHandler(gHttpHandler)
, mChannelCreationTime(0)
, mStartPos(UINT64_MAX)
, mTransferSize(0)
, mDecodedBodySize(0)
, mEncodedBodySize(0)
, mRequestContextID(0)
, mContentWindowId(0)
, mTopLevelOuterContentWindowId(0)
, mAltDataLength(0)
, mChannelId(0)
, mReqContentLength(0U)
, mStatus(NS_OK)
, mCanceled(false)
, mIsTrackingResource(false)
, mLoadFlags(LOAD_NORMAL)
, mCaps(0)
, mClassOfService(0)
, mPriority(PRIORITY_NORMAL)
, mRedirectionLimit(gHttpHandler->RedirectionLimit())
, mUpgradeToSecure(false)
, mApplyConversion(true)
, mIsPending(false)
@ -192,40 +203,29 @@ HttpBaseChannel::HttpBaseChannel()
, mAllowStaleCacheContent(false)
, mAddedAsNonTailRequest(false)
, mAsyncOpenWaitingForStreamLength(false)
, mUpgradableToSecure(true)
, mTlsFlags(0)
, mSuspendCount(0)
, mInitialRwin(0)
, mProxyResolveFlags(0)
, mContentDispositionHint(UINT32_MAX)
, mHttpHandler(gHttpHandler)
, mReferrerPolicy(NS_GetDefaultReferrerPolicy())
, mCorsMode(nsIHttpChannelInternal::CORS_MODE_NO_CORS)
, mRedirectMode(nsIHttpChannelInternal::REDIRECT_MODE_FOLLOW)
, mLastRedirectFlags(0)
, mPriority(PRIORITY_NORMAL)
, mRedirectionLimit(gHttpHandler->RedirectionLimit())
, mRedirectCount(0)
, mInternalRedirectCount(0)
, mChannelCreationTime(0)
, mAsyncOpenTimeOverriden(false)
, mForcePending(false)
, mCorsIncludeCredentials(false)
, mCorsMode(nsIHttpChannelInternal::CORS_MODE_NO_CORS)
, mRedirectMode(nsIHttpChannelInternal::REDIRECT_MODE_FOLLOW)
, mOnStartRequestCalled(false)
, mOnStopRequestCalled(false)
, mUpgradableToSecure(true)
, mAfterOnStartRequestBegun(false)
, mTransferSize(0)
, mDecodedBodySize(0)
, mEncodedBodySize(0)
, mRequestContextID(0)
, mContentWindowId(0)
, mTopLevelOuterContentWindowId(0)
, mRequireCORSPreflight(false)
, mReportCollector(new ConsoleReportCollector())
, mAltDataLength(0)
, mAltDataForChild(false)
, mForceMainDocumentChannel(false)
, mIsTrackingResource(false)
, mChannelId(0)
, mLastRedirectFlags(0)
, mReqContentLength(0U)
, mPendingInputStreamLengthOperation(false)
{
this->mSelfAddr.inet = {};

View File

@ -536,11 +536,28 @@ private:
MaybeResumeAsyncOpen();
protected:
// Use Release-Acquire ordering to ensure the OMT ODA is ignored while channel
// is canceled on main thread.
Atomic<bool, ReleaseAcquire> mCanceled;
nsCString mSpec; // ASCII encoded URL spec
nsCString mContentTypeHint;
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;
@ -554,29 +571,65 @@ protected:
RefPtr<nsHttpConnectionInfo> mConnectionInfo;
nsCOMPtr<nsIProxyInfo> mProxyInfo;
nsCOMPtr<nsISupports> mSecurityInfo;
nsCOMPtr<nsIHttpUpgradeListener> mUpgradeProtocolCallback;
nsAutoPtr<nsString> mContentDispositionFilename;
nsCOMPtr<nsIConsoleReportCollector> mReportCollector;
nsCString mSpec; // ASCII encoded URL spec
nsCString mContentTypeHint;
nsCString mContentCharsetHint;
nsCString mUserSetCookieHeader;
RefPtr<nsHttpHandler> mHttpHandler; // keep gHttpHandler alive
nsAutoPtr<nsTArray<nsCString> > mRedirectedCachekeys;
nsCOMPtr<nsIRequestContext> mRequestContext;
NetAddr mSelfAddr;
NetAddr mPeerAddr;
// HTTP Upgrade Data
nsCString mUpgradeProtocol;
nsCOMPtr<nsIHttpUpgradeListener> mUpgradeProtocolCallback;
nsTArray<Pair<nsString, nsString>> mSecurityConsoleMessages;
nsTArray<nsCString> mUnsafeHeaders;
// 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 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;
// 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 mCaps;
uint32_t mClassOfService;
int16_t mPriority;
uint8_t mRedirectionLimit;
uint32_t mUpgradeToSecure : 1;
uint32_t mApplyConversion : 1;
@ -626,6 +679,11 @@ protected:
// callback, passing the stream length value.
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.
// It is unlikely this will need to be set outside of telemetry studies
// relating to the TLS implementation.
@ -637,74 +695,54 @@ protected:
// Per channel transport window override (0 means no override)
uint32_t mInitialRwin;
nsAutoPtr<nsTArray<nsCString> > mRedirectedCachekeys;
uint32_t mProxyResolveFlags;
uint32_t mContentDispositionHint;
nsAutoPtr<nsString> mContentDispositionFilename;
RefPtr<nsHttpHandler> mHttpHandler; // keep gHttpHandler alive
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
// The initiator type (for this resource) - how was the resource referenced in
// the HTML file.
nsString mInitiatorType;
// Number of redirects that has occurred.
int8_t mRedirectCount;
// Number of internal redirects that has occurred.
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 mForcePending;
bool mCorsIncludeCredentials;
uint32_t mCorsMode;
uint32_t mRedirectMode;
// These parameters are used to ensure that we do not call OnStartRequest and
// OnStopRequest more than once.
bool mOnStartRequestCalled;
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.
// Used to ensure methods can't be called before OnStartRequest.
bool mAfterOnStartRequestBegun;
uint64_t mTransferSize;
uint64_t mDecodedBodySize;
uint64_t mEncodedBodySize;
bool mRequireCORSPreflight;
// 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();
nsCOMPtr<nsIRequestContext> mRequestContext;
bool EnsureRequestContext();
// Adds/removes this channel as a non-tailed request in its request context
@ -713,49 +751,7 @@ protected:
void AddAsNonTailRequest();
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();
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)