зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1714307 - Run modernize-use-default-member-init --fix check on netwerk r=necko-reviewers,kershaw
This changeset is the result of adding modernize-use-default-member-init to tools/clang-tidy/config.yaml then proceeding to run `./mach static-analysis check netwerk/ --fix` I then went through the resulting fix and manually updated all of the member variables which were missed due to them having a non-trivial constructor. Note that the tool was only run on Linux, so code that only runs on some platforms may have been missed. The member variables that are still initialized in the contructor definition are: - bitfields (not all currently supported compilers allow default-member-init - variables that are initialized via a parameter - variables that use code not visible in the header file There are a few advantages to landing this change: - fewer lines of code - now declaration is in the same place as initialization this also makes it easier to see when looking at the header. - it makes it harder to miss initializing a member when adding a new contructor - variables that depend on an include guard look much nicer now Additionally I removed some unnecessary reinitialization of NetAddr members (it has a constructor that does that now), and changed nsWifiScannerDBus to use the thread-safe strtok_r instead of strtok. Differential Revision: https://phabricator.services.mozilla.com/D116980
This commit is contained in:
Родитель
690a925370
Коммит
1a1f42da37
|
@ -17,9 +17,6 @@ using mozilla::dom::RootingCx;
|
|||
NS_IMPL_ISUPPORTS(ArrayBufferInputStream, nsIArrayBufferInputStream,
|
||||
nsIInputStream);
|
||||
|
||||
ArrayBufferInputStream::ArrayBufferInputStream()
|
||||
: mBufferLength(0), mPos(0), mClosed(false) {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ArrayBufferInputStream::SetData(JS::Handle<JS::Value> aBuffer,
|
||||
uint64_t aByteOffset, uint64_t aLength) {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
class ArrayBufferInputStream : public nsIArrayBufferInputStream {
|
||||
public:
|
||||
ArrayBufferInputStream();
|
||||
ArrayBufferInputStream() = default;
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIARRAYBUFFERINPUTSTREAM
|
||||
|
@ -32,9 +32,9 @@ class ArrayBufferInputStream : public nsIArrayBufferInputStream {
|
|||
private:
|
||||
virtual ~ArrayBufferInputStream() = default;
|
||||
mozilla::UniquePtr<char[]> mArrayBuffer;
|
||||
uint32_t mBufferLength;
|
||||
uint32_t mPos;
|
||||
bool mClosed;
|
||||
uint32_t mBufferLength{0};
|
||||
uint32_t mPos{0};
|
||||
bool mClosed{false};
|
||||
};
|
||||
|
||||
#endif // ArrayBufferInputStream_h
|
||||
|
|
|
@ -82,27 +82,7 @@ class NotifyTargetChangeRunnable final : public Runnable {
|
|||
uint32_t BackgroundFileSaver::sThreadCount = 0;
|
||||
uint32_t BackgroundFileSaver::sTelemetryMaxThreadCount = 0;
|
||||
|
||||
BackgroundFileSaver::BackgroundFileSaver()
|
||||
: mControlEventTarget(nullptr),
|
||||
mBackgroundET(nullptr),
|
||||
mPipeOutputStream(nullptr),
|
||||
mPipeInputStream(nullptr),
|
||||
mObserver(nullptr),
|
||||
mLock("BackgroundFileSaver.mLock"),
|
||||
mWorkerThreadAttentionRequested(false),
|
||||
mFinishRequested(false),
|
||||
mComplete(false),
|
||||
mStatus(NS_OK),
|
||||
mAppend(false),
|
||||
mInitialTarget(nullptr),
|
||||
mInitialTargetKeepPartial(false),
|
||||
mRenamedTarget(nullptr),
|
||||
mRenamedTargetKeepPartial(false),
|
||||
mAsyncCopyContext(nullptr),
|
||||
mSha256Enabled(false),
|
||||
mSignatureInfoEnabled(false),
|
||||
mActualTarget(nullptr),
|
||||
mActualTargetKeepPartial(false) {
|
||||
BackgroundFileSaver::BackgroundFileSaver() {
|
||||
LOG(("Created BackgroundFileSaver [this = %p]", this));
|
||||
}
|
||||
|
||||
|
@ -931,13 +911,6 @@ BackgroundFileSaverOutputStream::OnOutputStreamReady(
|
|||
NS_IMPL_ISUPPORTS(BackgroundFileSaverStreamListener, nsIBackgroundFileSaver,
|
||||
nsIRequestObserver, nsIStreamListener)
|
||||
|
||||
BackgroundFileSaverStreamListener::BackgroundFileSaverStreamListener()
|
||||
: BackgroundFileSaver(),
|
||||
mSuspensionLock("BackgroundFileSaverStreamListener.mSuspensionLock"),
|
||||
mReceivedTooMuchData(false),
|
||||
mRequest(nullptr),
|
||||
mRequestSuspended(false) {}
|
||||
|
||||
bool BackgroundFileSaverStreamListener::HasInfiniteBuffer() { return true; }
|
||||
|
||||
nsAsyncCopyProgressFun
|
||||
|
|
|
@ -117,22 +117,22 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
|
|||
* Protects the shared state between control and worker threads. This mutex
|
||||
* is always locked for a very short time, never during input/output.
|
||||
*/
|
||||
mozilla::Mutex mLock;
|
||||
mozilla::Mutex mLock{"BackgroundFileSaver.mLock"};
|
||||
|
||||
/**
|
||||
* True if the worker thread is already waiting to process a change in state.
|
||||
*/
|
||||
bool mWorkerThreadAttentionRequested;
|
||||
bool mWorkerThreadAttentionRequested{false};
|
||||
|
||||
/**
|
||||
* True if the operation should finish as soon as possibile.
|
||||
*/
|
||||
bool mFinishRequested;
|
||||
bool mFinishRequested{false};
|
||||
|
||||
/**
|
||||
* True if the operation completed, with either success or failure.
|
||||
*/
|
||||
bool mComplete;
|
||||
bool mComplete{false};
|
||||
|
||||
/**
|
||||
* Holds the current file saver status. This is a success status while the
|
||||
|
@ -140,13 +140,13 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
|
|||
* successfully. This becomes an error status when an error occurs on the
|
||||
* worker thread, or when the operation is canceled.
|
||||
*/
|
||||
nsresult mStatus;
|
||||
nsresult mStatus{NS_OK};
|
||||
|
||||
/**
|
||||
* True if we should append data to the initial target file, instead of
|
||||
* overwriting it.
|
||||
*/
|
||||
bool mAppend;
|
||||
bool mAppend{false};
|
||||
|
||||
/**
|
||||
* This is set by the first SetTarget call on the control thread, and contains
|
||||
|
@ -161,7 +161,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
|
|||
* indicates whether mInitialTarget should be kept as partially completed,
|
||||
* rather than deleted, if the operation fails or is canceled.
|
||||
*/
|
||||
bool mInitialTargetKeepPartial;
|
||||
bool mInitialTargetKeepPartial{false};
|
||||
|
||||
/**
|
||||
* This is set by subsequent SetTarget calls on the control thread, and
|
||||
|
@ -179,7 +179,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
|
|||
* indicates whether mRenamedTarget should be kept as partially completed,
|
||||
* rather than deleted, if the operation fails or is canceled.
|
||||
*/
|
||||
bool mRenamedTargetKeepPartial;
|
||||
bool mRenamedTargetKeepPartial{false};
|
||||
|
||||
/**
|
||||
* While NS_AsyncCopy is in progress, allows canceling it. Null otherwise.
|
||||
|
@ -197,7 +197,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
|
|||
* Whether or not to compute the hash. Must be set on the main thread before
|
||||
* setTarget is called.
|
||||
*/
|
||||
bool mSha256Enabled;
|
||||
bool mSha256Enabled{false};
|
||||
|
||||
/**
|
||||
* Store the signature info.
|
||||
|
@ -208,7 +208,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
|
|||
* Whether or not to extract the signature. Must be set on the main thread
|
||||
* before setTarget is called.
|
||||
*/
|
||||
bool mSignatureInfoEnabled;
|
||||
bool mSignatureInfoEnabled{false};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// State handled exclusively by the worker thread
|
||||
|
@ -222,7 +222,7 @@ class BackgroundFileSaver : public nsIBackgroundFileSaver {
|
|||
* Indicates whether mActualTarget should be kept as partially completed,
|
||||
* rather than deleted, if the operation fails or is canceled.
|
||||
*/
|
||||
bool mActualTargetKeepPartial;
|
||||
bool mActualTargetKeepPartial{false};
|
||||
|
||||
/**
|
||||
* Used to calculate the file hash. This keeps state across file renames and
|
||||
|
@ -327,7 +327,7 @@ class BackgroundFileSaverStreamListener final : public BackgroundFileSaver,
|
|||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
BackgroundFileSaverStreamListener();
|
||||
BackgroundFileSaverStreamListener() = default;
|
||||
|
||||
protected:
|
||||
virtual bool HasInfiniteBuffer() override;
|
||||
|
@ -339,12 +339,13 @@ class BackgroundFileSaverStreamListener final : public BackgroundFileSaver,
|
|||
/**
|
||||
* Protects the state related to whether the request should be suspended.
|
||||
*/
|
||||
mozilla::Mutex mSuspensionLock;
|
||||
mozilla::Mutex mSuspensionLock{
|
||||
"BackgroundFileSaverStreamListener.mSuspensionLock"};
|
||||
|
||||
/**
|
||||
* Whether we should suspend the request because we received too much data.
|
||||
*/
|
||||
bool mReceivedTooMuchData;
|
||||
bool mReceivedTooMuchData{false};
|
||||
|
||||
/**
|
||||
* Request for which we received too much data. This is populated when
|
||||
|
@ -355,7 +356,7 @@ class BackgroundFileSaverStreamListener final : public BackgroundFileSaver,
|
|||
/**
|
||||
* Whether mRequest is currently suspended.
|
||||
*/
|
||||
bool mRequestSuspended;
|
||||
bool mRequestSuspended{false};
|
||||
|
||||
/**
|
||||
* Called while NS_AsyncCopy is copying data.
|
||||
|
|
|
@ -38,17 +38,13 @@ class SocketData : public nsISupports {
|
|||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
SocketData() {
|
||||
mTotalSent = 0;
|
||||
mTotalRecv = 0;
|
||||
mEventTarget = nullptr;
|
||||
}
|
||||
SocketData() = default;
|
||||
|
||||
uint64_t mTotalSent;
|
||||
uint64_t mTotalRecv;
|
||||
uint64_t mTotalSent{0};
|
||||
uint64_t mTotalRecv{0};
|
||||
nsTArray<SocketInfo> mData;
|
||||
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
|
||||
nsIEventTarget* mEventTarget;
|
||||
nsIEventTarget* mEventTarget{nullptr};
|
||||
|
||||
private:
|
||||
virtual ~SocketData() = default;
|
||||
|
@ -64,11 +60,11 @@ class HttpData : public nsISupports {
|
|||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
HttpData() { mEventTarget = nullptr; }
|
||||
HttpData() = default;
|
||||
|
||||
nsTArray<HttpRetParams> mData;
|
||||
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
|
||||
nsIEventTarget* mEventTarget;
|
||||
nsIEventTarget* mEventTarget{nullptr};
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS0(HttpData)
|
||||
|
@ -79,10 +75,10 @@ class WebSocketRequest : public nsISupports {
|
|||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
WebSocketRequest() { mEventTarget = nullptr; }
|
||||
WebSocketRequest() = default;
|
||||
|
||||
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
|
||||
nsIEventTarget* mEventTarget;
|
||||
nsIEventTarget* mEventTarget{nullptr};
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS0(WebSocketRequest)
|
||||
|
@ -93,11 +89,11 @@ class DnsData : public nsISupports {
|
|||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
DnsData() { mEventTarget = nullptr; }
|
||||
DnsData() = default;
|
||||
|
||||
nsTArray<DNSCacheEntries> mData;
|
||||
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
|
||||
nsIEventTarget* mEventTarget;
|
||||
nsIEventTarget* mEventTarget{nullptr};
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS0(DnsData)
|
||||
|
@ -124,22 +120,19 @@ class ConnectionData : public nsITransportEventSink,
|
|||
void StartTimer(uint32_t aTimeout);
|
||||
void StopTimer();
|
||||
|
||||
explicit ConnectionData(Dashboard* target) : mPort(0), mTimeout(0) {
|
||||
mEventTarget = nullptr;
|
||||
mDashboard = target;
|
||||
}
|
||||
explicit ConnectionData(Dashboard* target) { mDashboard = target; }
|
||||
|
||||
nsCOMPtr<nsISocketTransport> mSocket;
|
||||
nsCOMPtr<nsIInputStream> mStreamIn;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
|
||||
nsIEventTarget* mEventTarget;
|
||||
nsIEventTarget* mEventTarget{nullptr};
|
||||
Dashboard* mDashboard;
|
||||
|
||||
nsCString mHost;
|
||||
uint32_t mPort;
|
||||
uint32_t mPort{0};
|
||||
nsCString mProtocol;
|
||||
uint32_t mTimeout;
|
||||
uint32_t mTimeout{0};
|
||||
|
||||
nsString mStatus;
|
||||
};
|
||||
|
@ -153,10 +146,10 @@ class RcwnData : public nsISupports {
|
|||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
RcwnData() { mEventTarget = nullptr; }
|
||||
RcwnData() = default;
|
||||
|
||||
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
|
||||
nsIEventTarget* mEventTarget;
|
||||
nsIEventTarget* mEventTarget{nullptr};
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS0(RcwnData)
|
||||
|
@ -243,7 +236,7 @@ class LookupHelper final : public nsIDNSListener {
|
|||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIDNSLISTENER
|
||||
|
||||
LookupHelper() : mEventTarget{nullptr}, mStatus{NS_ERROR_NOT_INITIALIZED} {}
|
||||
LookupHelper() = default;
|
||||
|
||||
nsresult ConstructAnswer(LookupArgument* aArgument);
|
||||
nsresult ConstructHTTPSRRAnswer(LookupArgument* aArgument);
|
||||
|
@ -251,8 +244,8 @@ class LookupHelper final : public nsIDNSListener {
|
|||
public:
|
||||
nsCOMPtr<nsICancelable> mCancel;
|
||||
nsMainThreadPtrHandle<nsINetDashboardCallback> mCallback;
|
||||
nsIEventTarget* mEventTarget;
|
||||
nsresult mStatus;
|
||||
nsIEventTarget* mEventTarget{nullptr};
|
||||
nsresult mStatus{NS_ERROR_NOT_INITIALIZED};
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(LookupHelper, nsIDNSListener)
|
||||
|
|
|
@ -104,7 +104,7 @@ LoadInfo::LoadInfo(
|
|||
mLoadingContext(do_GetWeakReference(aLoadingContext)),
|
||||
mSecurityFlags(aSecurityFlags),
|
||||
mSandboxFlags(aSandboxFlags),
|
||||
mTriggeringSandboxFlags(0),
|
||||
|
||||
mInternalContentPolicyType(aContentPolicyType) {
|
||||
MOZ_ASSERT(mLoadingPrincipal);
|
||||
MOZ_ASSERT(mTriggeringPrincipal);
|
||||
|
@ -320,7 +320,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
|
|||
mContextForTopLevelLoad(do_GetWeakReference(aContextForTopLevelLoad)),
|
||||
mSecurityFlags(aSecurityFlags),
|
||||
mSandboxFlags(aSandboxFlags),
|
||||
mTriggeringSandboxFlags(0),
|
||||
|
||||
mInternalContentPolicyType(nsIContentPolicy::TYPE_DOCUMENT) {
|
||||
// Top-level loads are never third-party
|
||||
// Grab the information we can out of the window.
|
||||
|
@ -379,7 +379,7 @@ LoadInfo::LoadInfo(dom::CanonicalBrowsingContext* aBrowsingContext,
|
|||
: mTriggeringPrincipal(aTriggeringPrincipal),
|
||||
mSecurityFlags(aSecurityFlags),
|
||||
mSandboxFlags(aSandboxFlags),
|
||||
mTriggeringSandboxFlags(0),
|
||||
|
||||
mInternalContentPolicyType(nsIContentPolicy::TYPE_DOCUMENT) {
|
||||
// Top-level loads are never third-party
|
||||
// Grab the information we can out of the window.
|
||||
|
@ -575,9 +575,7 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
|
|||
mForcePreflight(rhs.mForcePreflight),
|
||||
mIsPreflight(rhs.mIsPreflight),
|
||||
mLoadTriggeredFromExternal(rhs.mLoadTriggeredFromExternal),
|
||||
// mServiceWorkerTaintingSynthesized must be handled specially during
|
||||
// redirect
|
||||
mServiceWorkerTaintingSynthesized(false),
|
||||
|
||||
mDocumentHasUserInteracted(rhs.mDocumentHasUserInteracted),
|
||||
mAllowListFutureDocumentsCreatedFromThisRedirectChain(
|
||||
rhs.mAllowListFutureDocumentsCreatedFromThisRedirectChain),
|
||||
|
@ -702,9 +700,7 @@ LoadInfo::LoadInfo(
|
|||
mParserCreatedScript(aParserCreatedScript),
|
||||
mHasStoragePermission(aHasStoragePermission),
|
||||
mIsMetaRefresh(aIsMetaRefresh),
|
||||
mIsFromProcessingFrameAttributes(false),
|
||||
mIsMediaRequest(false),
|
||||
mIsMediaInitialRequest(false),
|
||||
|
||||
mLoadingEmbedderPolicy(aLoadingEmbedderPolicy),
|
||||
mUnstrippedURI(aUnstrippedURI) {
|
||||
// Only top level TYPE_DOCUMENT loads can have a null loadingPrincipal
|
||||
|
|
|
@ -138,11 +138,8 @@ failed:
|
|||
#endif
|
||||
|
||||
PollableEvent::PollableEvent()
|
||||
: mWriteFD(nullptr),
|
||||
mReadFD(nullptr),
|
||||
mSignaled(false),
|
||||
mWriteFailed(false),
|
||||
mSignalTimestampAdjusted(false) {
|
||||
|
||||
{
|
||||
MOZ_COUNT_CTOR(PollableEvent);
|
||||
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
|
||||
// create pair of prfiledesc that can be used as a poll()ble
|
||||
|
|
|
@ -46,16 +46,16 @@ class PollableEvent {
|
|||
PRFileDesc* PollableFD() { return mReadFD; }
|
||||
|
||||
private:
|
||||
PRFileDesc* mWriteFD;
|
||||
PRFileDesc* mReadFD;
|
||||
bool mSignaled;
|
||||
PRFileDesc* mWriteFD{nullptr};
|
||||
PRFileDesc* mReadFD{nullptr};
|
||||
bool mSignaled{false};
|
||||
// true when PR_Write to the socket pair has failed (status < 1)
|
||||
bool mWriteFailed;
|
||||
bool mWriteFailed{false};
|
||||
// Set true after AdjustFirstSignalTimestamp() was called
|
||||
// Set false after Clear() was called
|
||||
// Ensures shifting the timestamp before entering poll() only once
|
||||
// between Clear()'ings.
|
||||
bool mSignalTimestampAdjusted;
|
||||
bool mSignalTimestampAdjusted{false};
|
||||
// Timestamp of the first call to Signal() (or time we enter poll())
|
||||
// that happened after the last Clear() call
|
||||
TimeStamp mFirstSignalAfterClear;
|
||||
|
|
|
@ -229,10 +229,8 @@ NS_IMPL_ISUPPORTS(Predictor, nsINetworkPredictor, nsIObserver,
|
|||
nsICacheEntryMetaDataVisitor, nsINetworkPredictorVerifier)
|
||||
|
||||
Predictor::Predictor()
|
||||
: mInitialized(false),
|
||||
mStartupTime(0),
|
||||
mLastStartupTime(0),
|
||||
mStartupCount(1) {
|
||||
|
||||
{
|
||||
MOZ_ASSERT(!sSelf, "multiple Predictor instances!");
|
||||
sSelf = this;
|
||||
}
|
||||
|
|
|
@ -427,7 +427,7 @@ class Predictor final : public nsINetworkPredictor,
|
|||
uint32_t ClampedPrefetchRollingLoadCount();
|
||||
|
||||
// Our state
|
||||
bool mInitialized;
|
||||
bool mInitialized{false};
|
||||
|
||||
nsTArray<nsCString> mKeysToOperateOn;
|
||||
nsTArray<nsCString> mValuesToOperateOn;
|
||||
|
@ -437,9 +437,9 @@ class Predictor final : public nsINetworkPredictor,
|
|||
nsCOMPtr<nsISpeculativeConnect> mSpeculativeService;
|
||||
|
||||
nsCOMPtr<nsIURI> mStartupURI;
|
||||
uint32_t mStartupTime;
|
||||
uint32_t mLastStartupTime;
|
||||
int32_t mStartupCount;
|
||||
uint32_t mStartupTime{0};
|
||||
uint32_t mLastStartupTime{0};
|
||||
int32_t mStartupCount{1};
|
||||
|
||||
nsCOMPtr<nsIDNSService> mDnsService;
|
||||
|
||||
|
|
|
@ -430,11 +430,8 @@ static bool PACResolve(const nsCString& aHostName, NetAddr* aNetAddr,
|
|||
}
|
||||
|
||||
ProxyAutoConfig::ProxyAutoConfig()
|
||||
: mJSContext(nullptr),
|
||||
mJSNeedsSetup(false),
|
||||
mShutdown(true),
|
||||
mIncludePath(false),
|
||||
mExtraHeapSize(0) {
|
||||
|
||||
{
|
||||
MOZ_COUNT_CTOR(ProxyAutoConfig);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,13 +89,13 @@ class ProxyAutoConfig {
|
|||
bool MyIPAddressTryHost(const nsCString& hostName, unsigned int timeout,
|
||||
const JS::CallArgs& aArgs, bool* aResult);
|
||||
|
||||
JSContextWrapper* mJSContext;
|
||||
bool mJSNeedsSetup;
|
||||
bool mShutdown;
|
||||
JSContextWrapper* mJSContext{nullptr};
|
||||
bool mJSNeedsSetup{false};
|
||||
bool mShutdown{true};
|
||||
nsCString mConcatenatedPACData;
|
||||
nsCString mPACURI;
|
||||
bool mIncludePath;
|
||||
uint32_t mExtraHeapSize;
|
||||
bool mIncludePath{false};
|
||||
uint32_t mExtraHeapSize{0};
|
||||
nsCString mRunningHost;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsCOMPtr<nsIEventTarget> mMainThreadEventTarget;
|
||||
|
|
|
@ -423,8 +423,7 @@ RequestContextService* RequestContextService::sSelf = nullptr;
|
|||
|
||||
NS_IMPL_ISUPPORTS(RequestContextService, nsIRequestContextService, nsIObserver)
|
||||
|
||||
RequestContextService::RequestContextService()
|
||||
: mRCIDNamespace(0), mNextRCID(1) {
|
||||
RequestContextService::RequestContextService() {
|
||||
MOZ_ASSERT(!sSelf, "multiple rcs instances!");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
sSelf = this;
|
||||
|
|
|
@ -34,8 +34,8 @@ class RequestContextService final : public nsIRequestContextService,
|
|||
static RequestContextService* sSelf;
|
||||
|
||||
nsInterfaceHashtable<nsUint64HashKey, nsIRequestContext> mTable;
|
||||
uint32_t mRCIDNamespace;
|
||||
uint32_t mNextRCID;
|
||||
uint32_t mRCIDNamespace{0};
|
||||
uint32_t mNextRCID{1};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -110,9 +110,7 @@ nsresult SSLTokensCache::Shutdown() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
SSLTokensCache::SSLTokensCache() : mCacheSize(0) {
|
||||
LOG(("SSLTokensCache::SSLTokensCache"));
|
||||
}
|
||||
SSLTokensCache::SSLTokensCache() { LOG(("SSLTokensCache::SSLTokensCache")); }
|
||||
|
||||
SSLTokensCache::~SSLTokensCache() { LOG(("SSLTokensCache::~SSLTokensCache")); }
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class SSLTokensCache : public nsIMemoryReporter {
|
|||
static mozilla::StaticRefPtr<SSLTokensCache> gInstance;
|
||||
static StaticMutex sLock;
|
||||
|
||||
uint32_t mCacheSize; // Actual cache size in bytes
|
||||
uint32_t mCacheSize{0}; // Actual cache size in bytes
|
||||
|
||||
class TokenCacheRecord {
|
||||
public:
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
SimpleBuffer::SimpleBuffer() : mStatus(NS_OK), mAvailable(0) {}
|
||||
|
||||
nsresult SimpleBuffer::Write(char* src, size_t len) {
|
||||
NS_ASSERT_OWNINGTHREAD(SimpleBuffer);
|
||||
if (NS_FAILED(mStatus)) {
|
||||
|
|
|
@ -21,19 +21,19 @@ namespace net {
|
|||
|
||||
class SimpleBufferPage : public LinkedListElement<SimpleBufferPage> {
|
||||
public:
|
||||
SimpleBufferPage() : mReadOffset(0), mWriteOffset(0) {}
|
||||
SimpleBufferPage() = default;
|
||||
static const size_t kSimpleBufferPageSize = 32000;
|
||||
|
||||
private:
|
||||
friend class SimpleBuffer;
|
||||
char mBuffer[kSimpleBufferPageSize]{0};
|
||||
size_t mReadOffset;
|
||||
size_t mWriteOffset;
|
||||
size_t mReadOffset{0};
|
||||
size_t mWriteOffset{0};
|
||||
};
|
||||
|
||||
class SimpleBuffer {
|
||||
public:
|
||||
SimpleBuffer();
|
||||
SimpleBuffer() = default;
|
||||
~SimpleBuffer() = default;
|
||||
|
||||
nsresult Write(char* src, size_t len); // return OK or OUT_OF_MEMORY
|
||||
|
@ -44,9 +44,9 @@ class SimpleBuffer {
|
|||
private:
|
||||
NS_DECL_OWNINGTHREAD
|
||||
|
||||
nsresult mStatus;
|
||||
nsresult mStatus{NS_OK};
|
||||
AutoCleanLinkedList<SimpleBufferPage> mBufferList;
|
||||
size_t mAvailable;
|
||||
size_t mAvailable{0};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -26,8 +26,6 @@ namespace net {
|
|||
// TLSServerSocket
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TLSServerSocket::TLSServerSocket() : mServerCert(nullptr) {}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(TLSServerSocket, nsServerSocket, nsITLSServerSocket)
|
||||
|
||||
nsresult TLSServerSocket::SetSocketDefaults() {
|
||||
|
@ -267,16 +265,6 @@ TLSServerSecurityObserverProxy::OnHandshakeDoneRunnable::Run() {
|
|||
NS_IMPL_ISUPPORTS(TLSServerConnectionInfo, nsITLSServerConnectionInfo,
|
||||
nsITLSClientStatus)
|
||||
|
||||
TLSServerConnectionInfo::TLSServerConnectionInfo()
|
||||
: mServerSocket(nullptr),
|
||||
mTransport(nullptr),
|
||||
mPeerCert(nullptr),
|
||||
mTlsVersionUsed(TLS_VERSION_UNKNOWN),
|
||||
mKeyLength(0),
|
||||
mMacLength(0),
|
||||
mLock("TLSServerConnectionInfo.mLock"),
|
||||
mSecurityObserver(nullptr) {}
|
||||
|
||||
TLSServerConnectionInfo::~TLSServerConnectionInfo() {
|
||||
RefPtr<nsITLSServerSecurityObserver> observer;
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ class TLSServerSocket final : public nsServerSocket, public nsITLSServerSocket {
|
|||
virtual nsresult SetSocketDefaults() override;
|
||||
virtual nsresult OnSocketListen() override;
|
||||
|
||||
TLSServerSocket();
|
||||
TLSServerSocket() = default;
|
||||
|
||||
private:
|
||||
virtual ~TLSServerSocket() = default;
|
||||
|
@ -47,7 +47,7 @@ class TLSServerConnectionInfo : public nsITLSServerConnectionInfo,
|
|||
NS_DECL_NSITLSSERVERCONNECTIONINFO
|
||||
NS_DECL_NSITLSCLIENTSTATUS
|
||||
|
||||
TLSServerConnectionInfo();
|
||||
TLSServerConnectionInfo() = default;
|
||||
|
||||
private:
|
||||
virtual ~TLSServerConnectionInfo();
|
||||
|
@ -60,14 +60,14 @@ class TLSServerConnectionInfo : public nsITLSServerConnectionInfo,
|
|||
// reference to the TLSServerConnectionInfo object. This is not handed out to
|
||||
// anyone, and is only used in HandshakeCallback to close the transport in
|
||||
// case of an error. After this, it's set to nullptr.
|
||||
nsISocketTransport* mTransport;
|
||||
nsISocketTransport* mTransport{nullptr};
|
||||
nsCOMPtr<nsIX509Cert> mPeerCert;
|
||||
int16_t mTlsVersionUsed;
|
||||
int16_t mTlsVersionUsed{TLS_VERSION_UNKNOWN};
|
||||
nsCString mCipherName;
|
||||
uint32_t mKeyLength;
|
||||
uint32_t mMacLength;
|
||||
uint32_t mKeyLength{0};
|
||||
uint32_t mMacLength{0};
|
||||
// lock protects access to mSecurityObserver
|
||||
mozilla::Mutex mLock;
|
||||
mozilla::Mutex mLock{"TLSServerConnectionInfo.mLock"};
|
||||
nsCOMPtr<nsITLSServerSecurityObserver> mSecurityObserver;
|
||||
};
|
||||
|
||||
|
|
|
@ -234,10 +234,8 @@ NS_IMPL_ISUPPORTS(ThrottleQueue, nsIInputChannelThrottleQueue, nsITimerCallback,
|
|||
nsINamed)
|
||||
|
||||
ThrottleQueue::ThrottleQueue()
|
||||
: mMeanBytesPerSecond(0),
|
||||
mMaxBytesPerSecond(0),
|
||||
mBytesProcessed(0),
|
||||
mTimerArmed(false) {
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIEventTarget> sts;
|
||||
nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
|
||||
|
|
|
@ -50,13 +50,13 @@ class ThrottleQueue : public nsIInputChannelThrottleQueue,
|
|||
};
|
||||
|
||||
nsTArray<ThrottleEntry> mReadEvents;
|
||||
uint32_t mMeanBytesPerSecond;
|
||||
uint32_t mMaxBytesPerSecond;
|
||||
uint64_t mBytesProcessed;
|
||||
uint32_t mMeanBytesPerSecond{0};
|
||||
uint32_t mMaxBytesPerSecond{0};
|
||||
uint64_t mBytesProcessed{0};
|
||||
|
||||
nsTArray<RefPtr<ThrottleInputStream>> mAsyncEvents;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
bool mTimerArmed;
|
||||
bool mTimerArmed{false};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -14,25 +14,21 @@
|
|||
|
||||
class nsASocketHandler : public nsISupports {
|
||||
public:
|
||||
nsASocketHandler()
|
||||
: mCondition(NS_OK),
|
||||
mPollFlags(0),
|
||||
mPollTimeout(UINT16_MAX),
|
||||
mIsPrivate(false) {}
|
||||
nsASocketHandler() = default;
|
||||
|
||||
//
|
||||
// this condition variable will be checked to determine if the socket
|
||||
// handler should be detached. it must only be accessed on the socket
|
||||
// thread.
|
||||
//
|
||||
nsresult mCondition;
|
||||
nsresult mCondition{NS_OK};
|
||||
|
||||
//
|
||||
// these flags can only be modified on the socket transport thread.
|
||||
// the socket transport service will check these flags before calling
|
||||
// PR_Poll.
|
||||
//
|
||||
uint16_t mPollFlags;
|
||||
uint16_t mPollFlags{0};
|
||||
|
||||
//
|
||||
// this value specifies the maximum amount of time in seconds that may be
|
||||
|
@ -43,9 +39,9 @@ class nsASocketHandler : public nsISupports {
|
|||
// timeout error checking. (i.e., a timeout value of UINT16_MAX is
|
||||
// never reached.)
|
||||
//
|
||||
uint16_t mPollTimeout;
|
||||
uint16_t mPollTimeout{UINT16_MAX};
|
||||
|
||||
bool mIsPrivate;
|
||||
bool mIsPrivate{false};
|
||||
|
||||
//
|
||||
// called to service a socket
|
||||
|
|
|
@ -47,13 +47,6 @@ class nsAsyncVerifyRedirectCallbackEvent : public Runnable {
|
|||
nsresult mResult;
|
||||
};
|
||||
|
||||
nsAsyncRedirectVerifyHelper::nsAsyncRedirectVerifyHelper()
|
||||
: mFlags(0),
|
||||
mWaitingForRedirectCallback(false),
|
||||
mCallbackInitiated(false),
|
||||
mExpectedCallbacks(0),
|
||||
mResult(NS_OK) {}
|
||||
|
||||
nsAsyncRedirectVerifyHelper::~nsAsyncRedirectVerifyHelper() {
|
||||
NS_ASSERTION(NS_FAILED(mResult) || mExpectedCallbacks == 0,
|
||||
"Did not receive all required callbacks!");
|
||||
|
|
|
@ -34,7 +34,7 @@ class nsAsyncRedirectVerifyHelper final
|
|||
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
|
||||
|
||||
public:
|
||||
nsAsyncRedirectVerifyHelper();
|
||||
nsAsyncRedirectVerifyHelper() = default;
|
||||
|
||||
/*
|
||||
* Calls AsyncOnChannelRedirect() on the given sink with the given
|
||||
|
@ -69,12 +69,12 @@ class nsAsyncRedirectVerifyHelper final
|
|||
protected:
|
||||
nsCOMPtr<nsIChannel> mOldChan;
|
||||
nsCOMPtr<nsIChannel> mNewChan;
|
||||
uint32_t mFlags;
|
||||
bool mWaitingForRedirectCallback;
|
||||
uint32_t mFlags{0};
|
||||
bool mWaitingForRedirectCallback{false};
|
||||
nsCOMPtr<nsIEventTarget> mCallbackEventTarget;
|
||||
bool mCallbackInitiated;
|
||||
int32_t mExpectedCallbacks;
|
||||
nsresult mResult; // value passed to callback
|
||||
bool mCallbackInitiated{false};
|
||||
int32_t mExpectedCallbacks{0};
|
||||
nsresult mResult{NS_OK}; // value passed to callback
|
||||
|
||||
void InitCallback();
|
||||
|
||||
|
|
|
@ -64,14 +64,7 @@ class AsyncApplyBufferingPolicyEvent final : public Runnable {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
nsAsyncStreamCopier::nsAsyncStreamCopier()
|
||||
: mLock("nsAsyncStreamCopier.mLock"),
|
||||
mMode(NS_ASYNCCOPY_VIA_READSEGMENTS),
|
||||
mChunkSize(nsIOService::gDefaultSegmentSize),
|
||||
mStatus(NS_OK),
|
||||
mIsPending(false),
|
||||
mCloseSource{false},
|
||||
mCloseSink{false},
|
||||
mShouldSniffBuffering(false) {
|
||||
: mChunkSize(nsIOService::gDefaultSegmentSize) {
|
||||
LOG(("Creating nsAsyncStreamCopier @%p\n", this));
|
||||
}
|
||||
|
||||
|
|
|
@ -59,15 +59,15 @@ class nsAsyncStreamCopier final : public nsIAsyncStreamCopier,
|
|||
|
||||
nsCOMPtr<nsISupports> mCopierCtx;
|
||||
|
||||
mozilla::Mutex mLock;
|
||||
mozilla::Mutex mLock{"nsAsyncStreamCopier.mLock"};
|
||||
|
||||
nsAsyncCopyMode mMode;
|
||||
nsAsyncCopyMode mMode{NS_ASYNCCOPY_VIA_READSEGMENTS};
|
||||
uint32_t mChunkSize;
|
||||
nsresult mStatus;
|
||||
bool mIsPending;
|
||||
bool mCloseSource;
|
||||
bool mCloseSink;
|
||||
bool mShouldSniffBuffering;
|
||||
nsresult mStatus{NS_OK};
|
||||
bool mIsPending{false};
|
||||
bool mCloseSource{false};
|
||||
bool mCloseSink{false};
|
||||
bool mShouldSniffBuffering{false};
|
||||
|
||||
friend class ProceedWithAsyncCopy;
|
||||
friend class AsyncApplyBufferingPolicyEvent;
|
||||
|
|
|
@ -52,21 +52,7 @@ class ScopedRequestSuspender {
|
|||
//-----------------------------------------------------------------------------
|
||||
// nsBaseChannel
|
||||
|
||||
nsBaseChannel::nsBaseChannel()
|
||||
: NeckoTargetHolder(nullptr),
|
||||
mPumpingData(false),
|
||||
mLoadFlags(LOAD_NORMAL),
|
||||
mQueriedProgressSink(true),
|
||||
mSynthProgressEvents(false),
|
||||
mAllowThreadRetargeting(true),
|
||||
mWaitingOnAsyncRedirect(false),
|
||||
mOpenRedirectChannel(false),
|
||||
mRedirectFlags{0},
|
||||
mStatus(NS_OK),
|
||||
mContentDispositionHint(UINT32_MAX),
|
||||
mContentLength(-1),
|
||||
mWasOpened(false),
|
||||
mCanceled(false) {
|
||||
nsBaseChannel::nsBaseChannel() : NeckoTargetHolder(nullptr) {
|
||||
mContentType.AssignLiteral(UNKNOWN_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ class nsBaseChannel
|
|||
|
||||
RefPtr<nsInputStreamPump> mPump;
|
||||
RefPtr<nsIRequest> mRequest;
|
||||
bool mPumpingData;
|
||||
bool mPumpingData{false};
|
||||
nsCOMPtr<nsIProgressEventSink> mProgressSink;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
@ -279,13 +279,13 @@ class nsBaseChannel
|
|||
nsCOMPtr<nsIChannel> mRedirectChannel;
|
||||
nsCString mContentType;
|
||||
nsCString mContentCharset;
|
||||
uint32_t mLoadFlags;
|
||||
bool mQueriedProgressSink;
|
||||
bool mSynthProgressEvents;
|
||||
bool mAllowThreadRetargeting;
|
||||
bool mWaitingOnAsyncRedirect;
|
||||
bool mOpenRedirectChannel;
|
||||
uint32_t mRedirectFlags;
|
||||
uint32_t mLoadFlags{LOAD_NORMAL};
|
||||
bool mQueriedProgressSink{true};
|
||||
bool mSynthProgressEvents{false};
|
||||
bool mAllowThreadRetargeting{true};
|
||||
bool mWaitingOnAsyncRedirect{false};
|
||||
bool mOpenRedirectChannel{false};
|
||||
uint32_t mRedirectFlags{0};
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
@ -293,12 +293,12 @@ class nsBaseChannel
|
|||
nsCOMPtr<nsILoadInfo> mLoadInfo;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
nsresult mStatus;
|
||||
uint32_t mContentDispositionHint;
|
||||
nsresult mStatus{NS_OK};
|
||||
uint32_t mContentDispositionHint{UINT32_MAX};
|
||||
mozilla::UniquePtr<nsString> mContentDispositionFilename;
|
||||
int64_t mContentLength;
|
||||
bool mWasOpened;
|
||||
bool mCanceled;
|
||||
int64_t mContentLength{-1};
|
||||
bool mWasOpened{false};
|
||||
bool mCanceled{false};
|
||||
|
||||
friend class mozilla::net::PrivateBrowsingChannel<nsBaseChannel>;
|
||||
};
|
||||
|
|
|
@ -48,17 +48,6 @@ using mozilla::Some;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsBufferedStream
|
||||
|
||||
nsBufferedStream::nsBufferedStream()
|
||||
: mBufferSize(0),
|
||||
mBuffer(nullptr),
|
||||
mBufferStartOffset(0),
|
||||
mCursor(0),
|
||||
mFillPoint(0),
|
||||
mStream(nullptr),
|
||||
mBufferDisabled(false),
|
||||
mEOF(false),
|
||||
mGetBufferCount(0) {}
|
||||
|
||||
nsBufferedStream::~nsBufferedStream() { Close(); }
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsBufferedStream, nsITellableStream, nsISeekableStream)
|
||||
|
@ -313,15 +302,6 @@ NS_IMPL_CI_INTERFACE_GETTER(nsBufferedInputStream, nsIInputStream,
|
|||
nsIBufferedInputStream, nsISeekableStream,
|
||||
nsITellableStream, nsIStreamBufferAccess)
|
||||
|
||||
nsBufferedInputStream::nsBufferedInputStream()
|
||||
: nsBufferedStream(),
|
||||
mMutex("nsBufferedInputStream::mMutex"),
|
||||
mIsIPCSerializable(true),
|
||||
mIsAsyncInputStream(false),
|
||||
mIsCloneableInputStream(false),
|
||||
mIsInputStreamLength(false),
|
||||
mIsAsyncInputStreamLength(false) {}
|
||||
|
||||
nsresult nsBufferedInputStream::Create(nsISupports* aOuter, REFNSIID aIID,
|
||||
void** aResult) {
|
||||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
|
|
@ -27,7 +27,7 @@ class nsBufferedStream : public nsISeekableStream {
|
|||
NS_DECL_NSISEEKABLESTREAM
|
||||
NS_DECL_NSITELLABLESTREAM
|
||||
|
||||
nsBufferedStream();
|
||||
nsBufferedStream() = default;
|
||||
|
||||
void Close();
|
||||
|
||||
|
@ -39,26 +39,26 @@ class nsBufferedStream : public nsISeekableStream {
|
|||
NS_IMETHOD Fill() = 0;
|
||||
NS_IMETHOD Flush() = 0;
|
||||
|
||||
uint32_t mBufferSize;
|
||||
char* mBuffer;
|
||||
uint32_t mBufferSize{0};
|
||||
char* mBuffer{nullptr};
|
||||
|
||||
// mBufferStartOffset is the offset relative to the start of mStream.
|
||||
int64_t mBufferStartOffset;
|
||||
int64_t mBufferStartOffset{0};
|
||||
|
||||
// mCursor is the read cursor for input streams, or write cursor for
|
||||
// output streams, and is relative to mBufferStartOffset.
|
||||
uint32_t mCursor;
|
||||
uint32_t mCursor{0};
|
||||
|
||||
// mFillPoint is the amount available in the buffer for input streams,
|
||||
// or the high watermark of bytes written into the buffer, and therefore
|
||||
// is relative to mBufferStartOffset.
|
||||
uint32_t mFillPoint;
|
||||
uint32_t mFillPoint{0};
|
||||
|
||||
nsCOMPtr<nsISupports> mStream; // cast to appropriate subclass
|
||||
|
||||
bool mBufferDisabled;
|
||||
bool mEOF; // True if mStream is at EOF
|
||||
uint8_t mGetBufferCount;
|
||||
bool mBufferDisabled{false};
|
||||
bool mEOF{false}; // True if mStream is at EOF
|
||||
uint8_t mGetBufferCount{0};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -86,7 +86,7 @@ class nsBufferedInputStream final : public nsBufferedStream,
|
|||
NS_DECL_NSIASYNCINPUTSTREAMLENGTH
|
||||
NS_DECL_NSIINPUTSTREAMLENGTHCALLBACK
|
||||
|
||||
nsBufferedInputStream();
|
||||
nsBufferedInputStream() : nsBufferedStream() {}
|
||||
|
||||
static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
||||
|
||||
|
@ -120,7 +120,7 @@ class nsBufferedInputStream final : public nsBufferedStream,
|
|||
NS_IMETHOD Fill() override;
|
||||
NS_IMETHOD Flush() override { return NS_OK; } // no-op for input streams
|
||||
|
||||
mozilla::Mutex mMutex;
|
||||
mozilla::Mutex mMutex{"nsBufferedInputStream::mMutex"};
|
||||
|
||||
// This value is protected by mutex.
|
||||
nsCOMPtr<nsIInputStreamCallback> mAsyncWaitCallback;
|
||||
|
@ -128,11 +128,11 @@ class nsBufferedInputStream final : public nsBufferedStream,
|
|||
// This value is protected by mutex.
|
||||
nsCOMPtr<nsIInputStreamLengthCallback> mAsyncInputStreamLengthCallback;
|
||||
|
||||
bool mIsIPCSerializable;
|
||||
bool mIsAsyncInputStream;
|
||||
bool mIsCloneableInputStream;
|
||||
bool mIsInputStreamLength;
|
||||
bool mIsAsyncInputStreamLength;
|
||||
bool mIsIPCSerializable{true};
|
||||
bool mIsAsyncInputStream{false};
|
||||
bool mIsCloneableInputStream{false};
|
||||
bool mIsInputStreamLength{false};
|
||||
bool mIsAsyncInputStreamLength{false};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -38,8 +38,7 @@
|
|||
using namespace mozilla;
|
||||
static LazyLogModule gLog("nsDirectoryIndexStream");
|
||||
|
||||
nsDirectoryIndexStream::nsDirectoryIndexStream()
|
||||
: mOffset(0), mStatus(NS_OK), mPos(0) {
|
||||
nsDirectoryIndexStream::nsDirectoryIndexStream() {
|
||||
MOZ_LOG(gLog, LogLevel::Debug, ("nsDirectoryIndexStream[%p]: created", this));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ class nsIFile;
|
|||
class nsDirectoryIndexStream final : public nsIInputStream {
|
||||
private:
|
||||
nsCString mBuf;
|
||||
int32_t mOffset;
|
||||
nsresult mStatus;
|
||||
int32_t mOffset{0};
|
||||
nsresult mStatus{NS_OK};
|
||||
|
||||
int32_t mPos; // position within mArray
|
||||
int32_t mPos{0}; // position within mArray
|
||||
nsCOMArray<nsIFile> mArray; // file objects within the directory
|
||||
|
||||
nsDirectoryIndexStream();
|
||||
|
|
|
@ -18,7 +18,7 @@ class nsDownloader : public nsIDownloader {
|
|||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
nsDownloader() : mLocationIsTemp(false) {}
|
||||
nsDownloader() = default;
|
||||
|
||||
protected:
|
||||
virtual ~nsDownloader();
|
||||
|
@ -30,7 +30,7 @@ class nsDownloader : public nsIDownloader {
|
|||
nsCOMPtr<nsIDownloadObserver> mObserver;
|
||||
nsCOMPtr<nsIFile> mLocation;
|
||||
nsCOMPtr<nsIOutputStream> mSink;
|
||||
bool mLocationIsTemp;
|
||||
bool mLocationIsTemp{false};
|
||||
};
|
||||
|
||||
#endif // nsDownloader_h__
|
||||
|
|
|
@ -43,12 +43,6 @@ using mozilla::Some;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsFileStreamBase
|
||||
|
||||
nsFileStreamBase::nsFileStreamBase()
|
||||
: mFD(nullptr),
|
||||
mBehaviorFlags(0),
|
||||
mState(eUnitialized),
|
||||
mErrorValue(NS_ERROR_FAILURE) {}
|
||||
|
||||
nsFileStreamBase::~nsFileStreamBase() {
|
||||
// We don't want to try to rewrind the stream when shutting down.
|
||||
mBehaviorFlags &= ~nsIFileInputStream::REOPEN_ON_REWIND;
|
||||
|
|
|
@ -35,7 +35,7 @@ class nsFileStreamBase : public nsISeekableStream, public nsIFileMetadata {
|
|||
NS_DECL_NSITELLABLESTREAM
|
||||
NS_DECL_NSIFILEMETADATA
|
||||
|
||||
nsFileStreamBase();
|
||||
nsFileStreamBase() = default;
|
||||
|
||||
protected:
|
||||
virtual ~nsFileStreamBase();
|
||||
|
@ -53,12 +53,12 @@ class nsFileStreamBase : public nsISeekableStream, public nsIFileMetadata {
|
|||
nsresult WriteSegments(nsReadSegmentFun aReader, void* aClosure,
|
||||
uint32_t aCount, uint32_t* _retval);
|
||||
|
||||
PRFileDesc* mFD;
|
||||
PRFileDesc* mFD{nullptr};
|
||||
|
||||
/**
|
||||
* Flags describing our behavior. See the IDL file for possible values.
|
||||
*/
|
||||
int32_t mBehaviorFlags;
|
||||
int32_t mBehaviorFlags{0};
|
||||
|
||||
enum {
|
||||
// This is the default value. It will be changed by Deserialize or Init.
|
||||
|
@ -72,7 +72,7 @@ class nsFileStreamBase : public nsISeekableStream, public nsIFileMetadata {
|
|||
// Something bad happen in the Open() or in Deserialize(). The actual
|
||||
// error value is stored in mErrorValue.
|
||||
eError
|
||||
} mState;
|
||||
} mState{eUnitialized};
|
||||
|
||||
struct OpenParams {
|
||||
nsCOMPtr<nsIFile> localFile;
|
||||
|
@ -85,7 +85,7 @@ class nsFileStreamBase : public nsISeekableStream, public nsIFileMetadata {
|
|||
*/
|
||||
OpenParams mOpenParams;
|
||||
|
||||
nsresult mErrorValue;
|
||||
nsresult mErrorValue{NS_ERROR_FAILURE};
|
||||
|
||||
/**
|
||||
* Prepares the data we need to open the file, and either does the open now
|
||||
|
@ -148,8 +148,7 @@ class nsFileInputStream : public nsFileStreamBase,
|
|||
// Overrided from nsFileStreamBase
|
||||
NS_IMETHOD Seek(int32_t aWhence, int64_t aOffset) override;
|
||||
|
||||
nsFileInputStream()
|
||||
: mLineBuffer(nullptr), mIOFlags(0), mPerm(0), mCachedPosition(0) {}
|
||||
nsFileInputStream() : mLineBuffer(nullptr) {}
|
||||
|
||||
static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
||||
|
||||
|
@ -171,16 +170,16 @@ class nsFileInputStream : public nsFileStreamBase,
|
|||
/**
|
||||
* The IO flags passed to Init() for the file open.
|
||||
*/
|
||||
int32_t mIOFlags;
|
||||
int32_t mIOFlags{0};
|
||||
/**
|
||||
* The permissions passed to Init() for the file open.
|
||||
*/
|
||||
int32_t mPerm;
|
||||
int32_t mPerm{0};
|
||||
|
||||
/**
|
||||
* Cached position for Tell for automatically reopening streams.
|
||||
*/
|
||||
int64_t mCachedPosition;
|
||||
int64_t mCachedPosition{0};
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -220,7 +219,7 @@ class nsAtomicFileOutputStream : public nsFileOutputStream,
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSISAFEOUTPUTSTREAM
|
||||
|
||||
nsAtomicFileOutputStream() : mTargetFileExists(true), mWriteResult(NS_OK) {}
|
||||
nsAtomicFileOutputStream() = default;
|
||||
|
||||
virtual nsresult DoOpen() override;
|
||||
|
||||
|
@ -235,8 +234,8 @@ class nsAtomicFileOutputStream : public nsFileOutputStream,
|
|||
nsCOMPtr<nsIFile> mTargetFile;
|
||||
nsCOMPtr<nsIFile> mTempFile;
|
||||
|
||||
bool mTargetFileExists;
|
||||
nsresult mWriteResult; // Internally set in Write()
|
||||
bool mTargetFileExists{true};
|
||||
nsresult mWriteResult{NS_OK}; // Internally set in Write()
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -196,26 +196,9 @@ uint32_t nsIOService::gDefaultSegmentCount = 24;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsIOService::nsIOService()
|
||||
: mOffline(true),
|
||||
mOfflineForProfileChange(false),
|
||||
mManageLinkStatus(false),
|
||||
mConnectivity(true),
|
||||
mSettingOffline(false),
|
||||
mSetOfflineValue(false),
|
||||
mSocketProcessLaunchComplete(false),
|
||||
mShutdown(false),
|
||||
mHttpHandlerAlreadyShutingDown(false),
|
||||
mNetworkLinkServiceInitialized(false),
|
||||
mChannelEventSinks(NS_CHANNEL_EVENT_SINK_CATEGORY),
|
||||
mMutex("nsIOService::mMutex"),
|
||||
mTotalRequests(0),
|
||||
mCacheWon(0),
|
||||
mNetWon(0),
|
||||
mLastOfflineStateChange(PR_IntervalNow()),
|
||||
: mLastOfflineStateChange(PR_IntervalNow()),
|
||||
mLastConnectivityChange(PR_IntervalNow()),
|
||||
mLastNetworkLinkChange(PR_IntervalNow()),
|
||||
mNetTearingDownStarted(0),
|
||||
mSocketProcess(nullptr) {}
|
||||
mLastNetworkLinkChange(PR_IntervalNow()) {}
|
||||
|
||||
static const char* gCallbackPrefs[] = {
|
||||
PORT_PREF_PREFIX,
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsTHashSet.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsNetCID.h"
|
||||
|
||||
#define NS_N(x) (sizeof(x) / sizeof(*(x)))
|
||||
|
||||
|
@ -199,38 +200,39 @@ class nsIOService final : public nsIIOService,
|
|||
void DestroySocketProcess();
|
||||
|
||||
private:
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mOffline;
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mOfflineForProfileChange;
|
||||
bool mManageLinkStatus;
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mConnectivity;
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mOffline{true};
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mOfflineForProfileChange{false};
|
||||
bool mManageLinkStatus{false};
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mConnectivity{true};
|
||||
|
||||
// Used to handle SetOffline() reentrancy. See the comment in
|
||||
// SetOffline() for more details.
|
||||
bool mSettingOffline;
|
||||
bool mSetOfflineValue;
|
||||
bool mSettingOffline{false};
|
||||
bool mSetOfflineValue{false};
|
||||
|
||||
bool mSocketProcessLaunchComplete;
|
||||
bool mSocketProcessLaunchComplete{false};
|
||||
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mShutdown;
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mHttpHandlerAlreadyShutingDown;
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mShutdown{false};
|
||||
mozilla::Atomic<bool, mozilla::Relaxed> mHttpHandlerAlreadyShutingDown{false};
|
||||
|
||||
nsCOMPtr<nsPISocketTransportService> mSocketTransportService;
|
||||
nsCOMPtr<nsICaptivePortalService> mCaptivePortalService;
|
||||
nsCOMPtr<nsINetworkLinkService> mNetworkLinkService;
|
||||
bool mNetworkLinkServiceInitialized;
|
||||
bool mNetworkLinkServiceInitialized{false};
|
||||
|
||||
// Cached protocol handlers, only accessed on the main thread
|
||||
nsWeakPtr mWeakHandler[NS_N(gScheme)];
|
||||
|
||||
// cached categories
|
||||
nsCategoryCache<nsIChannelEventSink> mChannelEventSinks;
|
||||
nsCategoryCache<nsIChannelEventSink> mChannelEventSinks{
|
||||
NS_CHANNEL_EVENT_SINK_CATEGORY};
|
||||
|
||||
Mutex mMutex;
|
||||
Mutex mMutex{"nsIOService::mMutex"};
|
||||
nsTArray<int32_t> mRestrictedPortList;
|
||||
|
||||
uint32_t mTotalRequests;
|
||||
uint32_t mCacheWon;
|
||||
uint32_t mNetWon;
|
||||
uint32_t mTotalRequests{0};
|
||||
uint32_t mCacheWon{0};
|
||||
uint32_t mNetWon{0};
|
||||
|
||||
// These timestamps are needed for collecting telemetry on PR_Connect,
|
||||
// PR_ConnectContinue and PR_Close blocking time. If we spend very long
|
||||
|
@ -241,9 +243,9 @@ class nsIOService final : public nsIIOService,
|
|||
mozilla::Atomic<PRIntervalTime> mLastNetworkLinkChange;
|
||||
|
||||
// Time a network tearing down started.
|
||||
mozilla::Atomic<PRIntervalTime> mNetTearingDownStarted;
|
||||
mozilla::Atomic<PRIntervalTime> mNetTearingDownStarted{0};
|
||||
|
||||
SocketProcessHost* mSocketProcess;
|
||||
SocketProcessHost* mSocketProcess{nullptr};
|
||||
|
||||
// Events should be executed after the socket process is launched. Will
|
||||
// dispatch these events while socket process fires OnProcessLaunchComplete.
|
||||
|
|
|
@ -103,7 +103,7 @@ class nsIncrementalDownload final : public nsIIncrementalDownload,
|
|||
NS_DECL_NSICHANNELEVENTSINK
|
||||
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
|
||||
|
||||
nsIncrementalDownload();
|
||||
nsIncrementalDownload() = default;
|
||||
|
||||
private:
|
||||
~nsIncrementalDownload() = default;
|
||||
|
@ -124,39 +124,23 @@ class nsIncrementalDownload final : public nsIIncrementalDownload,
|
|||
nsCOMPtr<nsIChannel> mChannel;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
mozilla::UniquePtr<char[]> mChunk;
|
||||
int32_t mChunkLen;
|
||||
int32_t mChunkSize;
|
||||
int32_t mInterval;
|
||||
int64_t mTotalSize;
|
||||
int64_t mCurrentSize;
|
||||
uint32_t mLoadFlags;
|
||||
int32_t mNonPartialCount;
|
||||
nsresult mStatus;
|
||||
bool mIsPending;
|
||||
bool mDidOnStartRequest;
|
||||
PRTime mLastProgressUpdate;
|
||||
int32_t mChunkLen{0};
|
||||
int32_t mChunkSize{DEFAULT_CHUNK_SIZE};
|
||||
int32_t mInterval{DEFAULT_INTERVAL};
|
||||
int64_t mTotalSize{-1};
|
||||
int64_t mCurrentSize{-1};
|
||||
uint32_t mLoadFlags{LOAD_NORMAL};
|
||||
int32_t mNonPartialCount{0};
|
||||
nsresult mStatus{NS_OK};
|
||||
bool mIsPending{false};
|
||||
bool mDidOnStartRequest{false};
|
||||
PRTime mLastProgressUpdate{0};
|
||||
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
|
||||
nsCOMPtr<nsIChannel> mNewRedirectChannel;
|
||||
nsCString mPartialValidator;
|
||||
bool mCacheBust;
|
||||
bool mCacheBust{false};
|
||||
};
|
||||
|
||||
nsIncrementalDownload::nsIncrementalDownload()
|
||||
: mChunkLen(0),
|
||||
mChunkSize(DEFAULT_CHUNK_SIZE),
|
||||
mInterval(DEFAULT_INTERVAL),
|
||||
mTotalSize(-1),
|
||||
mCurrentSize(-1),
|
||||
mLoadFlags(LOAD_NORMAL),
|
||||
mNonPartialCount(0),
|
||||
mStatus(NS_OK),
|
||||
mIsPending(false),
|
||||
mDidOnStartRequest(false),
|
||||
mLastProgressUpdate(0),
|
||||
mRedirectCallback(nullptr),
|
||||
mNewRedirectChannel(nullptr),
|
||||
mCacheBust(false) {}
|
||||
|
||||
nsresult nsIncrementalDownload::FlushChunk() {
|
||||
NS_ASSERTION(mTotalSize != int64_t(-1), "total size should be known");
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class nsInputStreamChannel : public nsBaseChannel,
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIINPUTSTREAMCHANNEL
|
||||
|
||||
nsInputStreamChannel() : mIsSrcdocChannel(false) {}
|
||||
nsInputStreamChannel() = default;
|
||||
|
||||
protected:
|
||||
virtual ~nsInputStreamChannel() = default;
|
||||
|
@ -34,7 +34,7 @@ class nsInputStreamChannel : public nsBaseChannel,
|
|||
nsCOMPtr<nsIInputStream> mContentStream;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
nsString mSrcdocData;
|
||||
bool mIsSrcdocChannel;
|
||||
bool mIsSrcdocChannel{false};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -33,23 +33,7 @@ static mozilla::LazyLogModule gStreamPumpLog("nsStreamPump");
|
|||
// nsInputStreamPump methods
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
nsInputStreamPump::nsInputStreamPump()
|
||||
: mState(STATE_IDLE),
|
||||
mStreamOffset(0),
|
||||
mStreamLength(0),
|
||||
mSegSize(0),
|
||||
mSegCount(0),
|
||||
mStatus(NS_OK),
|
||||
mSuspendCount(0),
|
||||
mLoadFlags(LOAD_NORMAL),
|
||||
mIsPending(false),
|
||||
mProcessingCallbacks(false),
|
||||
mWaitingForInputStreamReady(false),
|
||||
mCloseWhenDone(false),
|
||||
mRetargeting(false),
|
||||
mAsyncStreamIsBuffered(false),
|
||||
mOffMainThread(!NS_IsMainThread()),
|
||||
mMutex("nsInputStreamPump") {}
|
||||
nsInputStreamPump::nsInputStreamPump() : mOffMainThread(!NS_IsMainThread()) {}
|
||||
|
||||
nsresult nsInputStreamPump::Create(nsInputStreamPump** result,
|
||||
nsIInputStream* stream, uint32_t segsize,
|
||||
|
|
|
@ -74,34 +74,34 @@ class nsInputStreamPump final : public nsIInputStreamPump,
|
|||
uint32_t OnStateStop();
|
||||
nsresult CreateBufferedStreamIfNeeded();
|
||||
|
||||
uint32_t mState;
|
||||
uint32_t mState{STATE_IDLE};
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
nsCOMPtr<nsIEventTarget> mTargetThread;
|
||||
nsCOMPtr<nsIEventTarget> mLabeledMainThreadTarget;
|
||||
nsCOMPtr<nsIInputStream> mStream;
|
||||
nsCOMPtr<nsIAsyncInputStream> mAsyncStream;
|
||||
uint64_t mStreamOffset;
|
||||
uint64_t mStreamLength;
|
||||
uint32_t mSegSize;
|
||||
uint32_t mSegCount;
|
||||
nsresult mStatus;
|
||||
uint32_t mSuspendCount;
|
||||
uint32_t mLoadFlags;
|
||||
bool mIsPending;
|
||||
uint64_t mStreamOffset{0};
|
||||
uint64_t mStreamLength{0};
|
||||
uint32_t mSegSize{0};
|
||||
uint32_t mSegCount{0};
|
||||
nsresult mStatus{NS_OK};
|
||||
uint32_t mSuspendCount{0};
|
||||
uint32_t mLoadFlags{LOAD_NORMAL};
|
||||
bool mIsPending{false};
|
||||
// True while in OnInputStreamReady, calling OnStateStart, OnStateTransfer
|
||||
// and OnStateStop. Used to prevent calls to AsyncWait during callbacks.
|
||||
bool mProcessingCallbacks;
|
||||
bool mProcessingCallbacks{false};
|
||||
// True if waiting on the "input stream ready" callback.
|
||||
bool mWaitingForInputStreamReady;
|
||||
bool mCloseWhenDone;
|
||||
bool mRetargeting;
|
||||
bool mAsyncStreamIsBuffered;
|
||||
bool mWaitingForInputStreamReady{false};
|
||||
bool mCloseWhenDone{false};
|
||||
bool mRetargeting{false};
|
||||
bool mAsyncStreamIsBuffered{false};
|
||||
// Indicate whether nsInputStreamPump is used completely off main thread.
|
||||
// If true, OnStateStop() is executed off main thread.
|
||||
bool mOffMainThread;
|
||||
// Protects state/member var accesses across multiple threads.
|
||||
mozilla::RecursiveMutex mMutex;
|
||||
mozilla::RecursiveMutex mMutex{"nsInputStreamPump"};
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsInputStreamPump, NS_INPUT_STREAM_PUMP_IID)
|
||||
|
|
|
@ -86,19 +86,7 @@ static void RescheduleRequest(nsIRequest* aRequest, int32_t delta) {
|
|||
}
|
||||
|
||||
nsLoadGroup::nsLoadGroup()
|
||||
: mForegroundCount(0),
|
||||
mLoadFlags(LOAD_NORMAL),
|
||||
mDefaultLoadFlags(0),
|
||||
mPriority(PRIORITY_NORMAL),
|
||||
mRequests(&sRequestHashOps, sizeof(RequestMapEntry)),
|
||||
mStatus(NS_OK),
|
||||
mIsCanceling(false),
|
||||
mDefaultLoadIsTimed(false),
|
||||
mBrowsingContextDiscarded(false),
|
||||
mExternalRequestContext(false),
|
||||
mNotifyObserverAboutBackgroundRequests(false),
|
||||
mTimedRequests(0),
|
||||
mCachedRequests(0) {
|
||||
: mRequests(&sRequestHashOps, sizeof(RequestMapEntry)) {
|
||||
LOG(("LOADGROUP [%p]: Created.\n", this));
|
||||
}
|
||||
|
||||
|
|
|
@ -76,10 +76,10 @@ class nsLoadGroup : public nsILoadGroup,
|
|||
nsresult NotifyRemovalObservers(nsIRequest* aRequest, nsresult aStatus);
|
||||
|
||||
protected:
|
||||
uint32_t mForegroundCount;
|
||||
uint32_t mLoadFlags;
|
||||
uint32_t mDefaultLoadFlags;
|
||||
int32_t mPriority;
|
||||
uint32_t mForegroundCount{0};
|
||||
uint32_t mLoadFlags{LOAD_NORMAL};
|
||||
uint32_t mDefaultLoadFlags{0};
|
||||
int32_t mPriority{PRIORITY_NORMAL};
|
||||
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup; // load groups can contain load groups
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
|
@ -92,17 +92,17 @@ class nsLoadGroup : public nsILoadGroup,
|
|||
nsWeakPtr mObserver;
|
||||
nsWeakPtr mParentLoadGroup;
|
||||
|
||||
nsresult mStatus;
|
||||
bool mIsCanceling;
|
||||
bool mDefaultLoadIsTimed;
|
||||
bool mBrowsingContextDiscarded;
|
||||
bool mExternalRequestContext;
|
||||
bool mNotifyObserverAboutBackgroundRequests;
|
||||
nsresult mStatus{NS_OK};
|
||||
bool mIsCanceling{false};
|
||||
bool mDefaultLoadIsTimed{false};
|
||||
bool mBrowsingContextDiscarded{false};
|
||||
bool mExternalRequestContext{false};
|
||||
bool mNotifyObserverAboutBackgroundRequests{false};
|
||||
|
||||
/* Telemetry */
|
||||
mozilla::TimeStamp mDefaultRequestCreationTime;
|
||||
uint32_t mTimedRequests;
|
||||
uint32_t mCachedRequests;
|
||||
uint32_t mTimedRequests{0};
|
||||
uint32_t mCachedRequests{0};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -42,7 +42,7 @@ class nsMIMEInputStream : public nsIMIMEInputStream,
|
|||
virtual ~nsMIMEInputStream() = default;
|
||||
|
||||
public:
|
||||
nsMIMEInputStream();
|
||||
nsMIMEInputStream() = default;
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIINPUTSTREAM
|
||||
|
@ -84,9 +84,9 @@ class nsMIMEInputStream : public nsIMIMEInputStream,
|
|||
nsTArray<HeaderEntry> mHeaders;
|
||||
|
||||
nsCOMPtr<nsIInputStream> mStream;
|
||||
bool mStartedReading;
|
||||
bool mStartedReading{false};
|
||||
|
||||
mozilla::Mutex mMutex;
|
||||
mozilla::Mutex mMutex{"nsMIMEInputStream::mMutex"};
|
||||
|
||||
// This is protected by mutex.
|
||||
nsCOMPtr<nsIInputStreamCallback> mAsyncWaitCallback;
|
||||
|
@ -126,9 +126,6 @@ NS_IMPL_CI_INTERFACE_GETTER(nsMIMEInputStream, nsIMIMEInputStream,
|
|||
nsIAsyncInputStream, nsIInputStream,
|
||||
nsISeekableStream, nsITellableStream)
|
||||
|
||||
nsMIMEInputStream::nsMIMEInputStream()
|
||||
: mStartedReading(false), mMutex("nsMIMEInputStream::mMutex") {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMIMEInputStream::AddHeader(const char* aName, const char* aValue) {
|
||||
NS_ENSURE_FALSE(mStartedReading, NS_ERROR_FAILURE);
|
||||
|
|
|
@ -128,9 +128,7 @@ class nsAsyncResolveRequest final : public nsIRunnable,
|
|||
nsAsyncResolveRequest(nsProtocolProxyService* pps, nsIChannel* channel,
|
||||
uint32_t aResolveFlags,
|
||||
nsIProtocolProxyCallback* callback)
|
||||
: mStatus(NS_OK),
|
||||
mDispatched(false),
|
||||
mResolveFlags(aResolveFlags),
|
||||
: mResolveFlags(aResolveFlags),
|
||||
mPPS(pps),
|
||||
mXPComPPS(pps),
|
||||
mChannel(channel),
|
||||
|
@ -422,10 +420,10 @@ class nsAsyncResolveRequest final : public nsIRunnable,
|
|||
}
|
||||
|
||||
private:
|
||||
nsresult mStatus;
|
||||
nsresult mStatus{NS_OK};
|
||||
nsCString mPACString;
|
||||
nsCString mPACURL;
|
||||
bool mDispatched;
|
||||
bool mDispatched{false};
|
||||
uint32_t mResolveFlags;
|
||||
|
||||
nsProtocolProxyService* mPPS;
|
||||
|
@ -770,21 +768,7 @@ NS_INTERFACE_MAP_END
|
|||
NS_IMPL_CI_INTERFACE_GETTER(nsProtocolProxyService, nsIProtocolProxyService,
|
||||
nsIProtocolProxyService2)
|
||||
|
||||
nsProtocolProxyService::nsProtocolProxyService()
|
||||
: mFilterLocalHosts(false),
|
||||
mProxyConfig(PROXYCONFIG_DIRECT),
|
||||
mHTTPProxyPort(-1),
|
||||
mHTTPSProxyPort(-1),
|
||||
mSOCKSProxyPort(-1),
|
||||
mSOCKSProxyVersion(4),
|
||||
mSOCKSProxyRemoteDNS(false),
|
||||
mProxyOverTLS(true),
|
||||
mWPADOverDHCPEnabled(false),
|
||||
mPACMan(nullptr),
|
||||
mSessionStart(PR_Now()),
|
||||
mFailedProxyTimeout(30 * 60) // 30 minute default
|
||||
,
|
||||
mIsShutdown(false) {}
|
||||
nsProtocolProxyService::nsProtocolProxyService() : mSessionStart(PR_Now()) {}
|
||||
|
||||
nsProtocolProxyService::~nsProtocolProxyService() {
|
||||
// These should have been cleaned up in our Observe method.
|
||||
|
@ -1505,9 +1489,7 @@ class nsAsyncBridgeRequest final : public nsPACManCallback {
|
|||
|
||||
nsAsyncBridgeRequest()
|
||||
: mMutex("nsDeprecatedCallback"),
|
||||
mCondVar(mMutex, "nsDeprecatedCallback"),
|
||||
mStatus(NS_OK),
|
||||
mCompleted(false) {}
|
||||
mCondVar(mMutex, "nsDeprecatedCallback") {}
|
||||
|
||||
void OnQueryComplete(nsresult status, const nsACString& pacString,
|
||||
const nsACString& newPACURL) override {
|
||||
|
@ -1531,10 +1513,10 @@ class nsAsyncBridgeRequest final : public nsPACManCallback {
|
|||
Mutex mMutex;
|
||||
CondVar mCondVar;
|
||||
|
||||
nsresult mStatus;
|
||||
nsresult mStatus{NS_OK};
|
||||
nsCString mPACString;
|
||||
nsCString mPACURL;
|
||||
bool mCompleted;
|
||||
bool mCompleted{false};
|
||||
};
|
||||
NS_IMPL_ISUPPORTS0(nsAsyncBridgeRequest)
|
||||
|
||||
|
|
|
@ -341,19 +341,19 @@ class nsProtocolProxyService final : public nsIProtocolProxyService2,
|
|||
protected:
|
||||
// simplified array of filters defined by this struct
|
||||
struct HostInfo {
|
||||
bool is_ipaddr;
|
||||
int32_t port;
|
||||
bool is_ipaddr{false};
|
||||
int32_t port{0};
|
||||
// other members intentionally uninitialized
|
||||
union {
|
||||
HostInfoIP ip{};
|
||||
HostInfoIP ip;
|
||||
HostInfoName name;
|
||||
};
|
||||
|
||||
HostInfo()
|
||||
: is_ipaddr(false),
|
||||
port(0) { /* other members intentionally uninitialized */
|
||||
}
|
||||
HostInfo() = default;
|
||||
~HostInfo() {
|
||||
if (!is_ipaddr && name.host) free(name.host);
|
||||
if (!is_ipaddr && name.host) {
|
||||
free(name.host);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -364,7 +364,7 @@ class nsProtocolProxyService final : public nsIProtocolProxyService2,
|
|||
|
||||
protected:
|
||||
// Indicates if local hosts (plain hostnames, no dots) should use the proxy
|
||||
bool mFilterLocalHosts;
|
||||
bool mFilterLocalHosts{false};
|
||||
|
||||
// Holds an array of HostInfo objects
|
||||
nsTArray<UniquePtr<HostInfo>> mHostFiltersArray;
|
||||
|
@ -372,36 +372,37 @@ class nsProtocolProxyService final : public nsIProtocolProxyService2,
|
|||
// Filters, always sorted by the position.
|
||||
nsTArray<RefPtr<FilterLink>> mFilters;
|
||||
|
||||
uint32_t mProxyConfig;
|
||||
uint32_t mProxyConfig{PROXYCONFIG_DIRECT};
|
||||
|
||||
nsCString mHTTPProxyHost;
|
||||
int32_t mHTTPProxyPort;
|
||||
int32_t mHTTPProxyPort{-1};
|
||||
|
||||
nsCString mHTTPSProxyHost;
|
||||
int32_t mHTTPSProxyPort;
|
||||
int32_t mHTTPSProxyPort{-1};
|
||||
|
||||
// mSOCKSProxyTarget could be a host, a domain socket path,
|
||||
// or a named-pipe name.
|
||||
nsCString mSOCKSProxyTarget;
|
||||
int32_t mSOCKSProxyPort;
|
||||
int32_t mSOCKSProxyVersion;
|
||||
bool mSOCKSProxyRemoteDNS;
|
||||
bool mProxyOverTLS;
|
||||
bool mWPADOverDHCPEnabled;
|
||||
int32_t mSOCKSProxyPort{-1};
|
||||
int32_t mSOCKSProxyVersion{4};
|
||||
bool mSOCKSProxyRemoteDNS{false};
|
||||
bool mProxyOverTLS{true};
|
||||
bool mWPADOverDHCPEnabled{false};
|
||||
|
||||
RefPtr<nsPACMan> mPACMan; // non-null if we are using PAC
|
||||
nsCOMPtr<nsISystemProxySettings> mSystemProxySettings;
|
||||
|
||||
PRTime mSessionStart;
|
||||
nsFailedProxyTable mFailedProxies;
|
||||
int32_t mFailedProxyTimeout;
|
||||
// 30 minute default
|
||||
int32_t mFailedProxyTimeout{30 * 60};
|
||||
|
||||
private:
|
||||
nsresult AsyncResolveInternal(nsIChannel* channel, uint32_t flags,
|
||||
nsIProtocolProxyCallback* callback,
|
||||
nsICancelable** result, bool isSyncOK,
|
||||
nsISerialEventTarget* mainThreadEventTarget);
|
||||
bool mIsShutdown;
|
||||
bool mIsShutdown{false};
|
||||
nsCOMPtr<nsITimer> mReloadPACTimer;
|
||||
};
|
||||
|
||||
|
|
|
@ -63,13 +63,7 @@ class nsProxyInfo final : public nsIProxyInfo {
|
|||
private:
|
||||
friend class nsProtocolProxyService;
|
||||
|
||||
explicit nsProxyInfo(const char* type = nullptr)
|
||||
: mType(type),
|
||||
mPort(-1),
|
||||
mFlags(0),
|
||||
mResolveFlags(0),
|
||||
mTimeout(UINT32_MAX),
|
||||
mNext(nullptr) {}
|
||||
explicit nsProxyInfo(const char* type = nullptr) : mType(type) {}
|
||||
|
||||
nsProxyInfo(const nsACString& aType, const nsACString& aHost, int32_t aPort,
|
||||
const nsACString& aUsername, const nsACString& aPassword,
|
||||
|
@ -85,13 +79,13 @@ class nsProxyInfo final : public nsIProxyInfo {
|
|||
nsCString mPassword;
|
||||
nsCString mProxyAuthorizationHeader;
|
||||
nsCString mConnectionIsolationKey;
|
||||
int32_t mPort;
|
||||
uint32_t mFlags;
|
||||
int32_t mPort{-1};
|
||||
uint32_t mFlags{0};
|
||||
// We need to read on multiple threads, but don't need to sync on anything
|
||||
// else
|
||||
Atomic<uint32_t, Relaxed> mResolveFlags;
|
||||
uint32_t mTimeout;
|
||||
nsProxyInfo* mNext;
|
||||
Atomic<uint32_t, Relaxed> mResolveFlags{0};
|
||||
uint32_t mTimeout{UINT32_MAX};
|
||||
nsProxyInfo* mNext{nullptr};
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsProxyInfo, NS_PROXYINFO_IID)
|
||||
|
|
|
@ -35,20 +35,7 @@ static nsresult PostEvent(nsServerSocket* s, nsServerSocketFunc func) {
|
|||
// nsServerSocket
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
nsServerSocket::nsServerSocket()
|
||||
: mFD(nullptr),
|
||||
mLock("nsServerSocket.mLock"),
|
||||
mAttached(false),
|
||||
mKeepWhenOffline(false) {
|
||||
this->mAddr.raw.family = 0;
|
||||
this->mAddr.inet.family = 0;
|
||||
this->mAddr.inet.port = 0;
|
||||
this->mAddr.inet.ip = 0;
|
||||
this->mAddr.ipv6.family = 0;
|
||||
this->mAddr.ipv6.port = 0;
|
||||
this->mAddr.ipv6.flowinfo = 0;
|
||||
this->mAddr.ipv6.scope_id = 0;
|
||||
this->mAddr.local.family = 0;
|
||||
nsServerSocket::nsServerSocket() {
|
||||
// we want to be able to access the STS directly, and it may not have been
|
||||
// constructed yet. the STS constructor sets gSocketTransportService.
|
||||
if (!gSocketTransportService) {
|
||||
|
|
|
@ -40,7 +40,7 @@ class nsServerSocket : public nsASocketHandler, public nsIServerSocket {
|
|||
|
||||
protected:
|
||||
virtual ~nsServerSocket();
|
||||
PRFileDesc* mFD;
|
||||
PRFileDesc* mFD{nullptr};
|
||||
nsCOMPtr<nsIServerSocketListener> mListener;
|
||||
|
||||
private:
|
||||
|
@ -51,11 +51,11 @@ class nsServerSocket : public nsASocketHandler, public nsIServerSocket {
|
|||
nsresult TryAttach();
|
||||
|
||||
// lock protects access to mListener; so it is not cleared while being used.
|
||||
mozilla::Mutex mLock;
|
||||
mozilla::Mutex mLock{"nsServerSocket.mLock"};
|
||||
PRNetAddr mAddr = {.raw = {0, {0}}};
|
||||
nsCOMPtr<nsIEventTarget> mListenerTarget;
|
||||
bool mAttached;
|
||||
bool mKeepWhenOffline;
|
||||
bool mAttached{false};
|
||||
bool mKeepWhenOffline{false};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -54,8 +54,6 @@ NS_IMPL_CI_INTERFACE_GETTER0(nsSimpleURI)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsSimpleURI methods:
|
||||
|
||||
nsSimpleURI::nsSimpleURI() : mIsRefValid(false), mIsQueryValid(false) {}
|
||||
|
||||
NS_IMPL_ADDREF(nsSimpleURI)
|
||||
NS_IMPL_RELEASE(nsSimpleURI)
|
||||
NS_INTERFACE_TABLE_HEAD(nsSimpleURI)
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace net {
|
|||
|
||||
class nsSimpleURI : public nsIURI, public nsISerializable, public nsISizeOf {
|
||||
protected:
|
||||
nsSimpleURI();
|
||||
nsSimpleURI() = default;
|
||||
virtual ~nsSimpleURI() = default;
|
||||
|
||||
public:
|
||||
|
@ -108,8 +108,9 @@ class nsSimpleURI : public nsIURI, public nsISerializable, public nsISizeOf {
|
|||
nsCString mRef; // so that URIs with different refs can share string data.
|
||||
nsCString
|
||||
mQuery; // so that URLs with different querys can share string data.
|
||||
bool mIsRefValid; // To distinguish between empty-ref and no-ref.
|
||||
bool mIsQueryValid; // To distinguish between empty-query and no-query.
|
||||
bool mIsRefValid{false}; // To distinguish between empty-ref and no-ref.
|
||||
// To distinguish between empty-query and no-query.
|
||||
bool mIsQueryValid{false};
|
||||
|
||||
public:
|
||||
class Mutator final : public nsIURIMutator,
|
||||
|
|
|
@ -253,11 +253,7 @@ nsresult ErrorAccordingToNSPR(PRErrorCode errorCode) {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
nsSocketInputStream::nsSocketInputStream(nsSocketTransport* trans)
|
||||
: mTransport(trans),
|
||||
mReaderRefCnt(0),
|
||||
mCondition(NS_OK),
|
||||
mCallbackFlags(0),
|
||||
mByteCount(0) {}
|
||||
: mTransport(trans) {}
|
||||
|
||||
// called on the socket transport thread...
|
||||
//
|
||||
|
@ -487,11 +483,7 @@ nsSocketInputStream::AsyncWait(nsIInputStreamCallback* callback, uint32_t flags,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
nsSocketOutputStream::nsSocketOutputStream(nsSocketTransport* trans)
|
||||
: mTransport(trans),
|
||||
mWriterRefCnt(0),
|
||||
mCondition(NS_OK),
|
||||
mCallbackFlags(0),
|
||||
mByteCount(0) {}
|
||||
: mTransport(trans) {}
|
||||
|
||||
// called on the socket transport thread...
|
||||
//
|
||||
|
@ -679,44 +671,10 @@ nsSocketOutputStream::AsyncWait(nsIOutputStreamCallback* callback,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
nsSocketTransport::nsSocketTransport()
|
||||
: mPort(0),
|
||||
mProxyPort(0),
|
||||
mOriginPort(0),
|
||||
mProxyTransparent(false),
|
||||
mProxyTransparentResolvesHost(false),
|
||||
mHttpsProxy(false),
|
||||
mConnectionFlags(0),
|
||||
mResetFamilyPreference(false),
|
||||
mTlsFlags(0),
|
||||
mReuseAddrPort(false),
|
||||
mState(STATE_CLOSED),
|
||||
mAttached(false),
|
||||
mInputClosed(true),
|
||||
mOutputClosed(true),
|
||||
mResolving(false),
|
||||
mEchConfigUsed(false),
|
||||
mResolvedByTRR(false),
|
||||
mNetAddrIsSet(false),
|
||||
mSelfAddrIsSet(false),
|
||||
mLock("nsSocketTransport.mLock"),
|
||||
mFD(this),
|
||||
mFDref(0),
|
||||
mFDconnected(false),
|
||||
: mFD(this),
|
||||
mSocketTransportService(gSocketTransportService),
|
||||
mInput(this),
|
||||
mOutput(this),
|
||||
mLingerPolarity(false),
|
||||
mLingerTimeout(0),
|
||||
mQoSBits(0x00),
|
||||
mKeepaliveEnabled(false),
|
||||
mKeepaliveIdleTimeS(-1),
|
||||
mKeepaliveRetryIntervalS(-1),
|
||||
mKeepaliveProbeCount(-1),
|
||||
mDoNotRetryToConnect(false) {
|
||||
this->mNetAddr.raw.family = 0;
|
||||
this->mNetAddr.inet = {};
|
||||
this->mSelfAddr.raw.family = 0;
|
||||
this->mSelfAddr.inet = {};
|
||||
mOutput(this) {
|
||||
SOCKET_LOG(("creating nsSocketTransport @%p\n", this));
|
||||
|
||||
mTimeouts[TIMEOUT_CONNECT] = UINT16_MAX; // no timeout
|
||||
|
@ -1986,9 +1944,12 @@ void nsSocketTransport::OnSocketEvent(uint32_t type, nsresult status,
|
|||
#if defined(XP_UNIX)
|
||||
if (mNetAddrIsSet && mNetAddr.raw.family == AF_LOCAL) {
|
||||
mCondition = InitiateSocket();
|
||||
} else
|
||||
} else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
mCondition = ResolveHost();
|
||||
}
|
||||
|
||||
} else {
|
||||
SOCKET_LOG((" ignoring redundant event\n"));
|
||||
|
|
|
@ -64,13 +64,13 @@ class nsSocketInputStream : public nsIAsyncInputStream {
|
|||
|
||||
private:
|
||||
nsSocketTransport* mTransport;
|
||||
ThreadSafeAutoRefCnt mReaderRefCnt;
|
||||
ThreadSafeAutoRefCnt mReaderRefCnt{0};
|
||||
|
||||
// access to these is protected by mTransport->mLock
|
||||
nsresult mCondition;
|
||||
nsresult mCondition{NS_OK};
|
||||
nsCOMPtr<nsIInputStreamCallback> mCallback;
|
||||
uint32_t mCallbackFlags;
|
||||
uint64_t mByteCount;
|
||||
uint32_t mCallbackFlags{0};
|
||||
uint64_t mByteCount{0};
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -97,13 +97,13 @@ class nsSocketOutputStream : public nsIAsyncOutputStream {
|
|||
uint32_t* countRead);
|
||||
|
||||
nsSocketTransport* mTransport;
|
||||
ThreadSafeAutoRefCnt mWriterRefCnt;
|
||||
ThreadSafeAutoRefCnt mWriterRefCnt{0};
|
||||
|
||||
// access to these is protected by mTransport->mLock
|
||||
nsresult mCondition;
|
||||
nsresult mCondition{NS_OK};
|
||||
nsCOMPtr<nsIOutputStreamCallback> mCallback;
|
||||
uint32_t mCallbackFlags;
|
||||
uint64_t mByteCount;
|
||||
uint32_t mCallbackFlags{0};
|
||||
uint64_t mByteCount{0};
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -275,19 +275,19 @@ class nsSocketTransport final : public nsASocketHandler,
|
|||
nsCString mHost;
|
||||
nsCString mProxyHost;
|
||||
nsCString mOriginHost;
|
||||
uint16_t mPort;
|
||||
uint16_t mPort{0};
|
||||
nsCOMPtr<nsIProxyInfo> mProxyInfo;
|
||||
uint16_t mProxyPort;
|
||||
uint16_t mOriginPort;
|
||||
bool mProxyTransparent;
|
||||
bool mProxyTransparentResolvesHost;
|
||||
bool mHttpsProxy;
|
||||
uint32_t mConnectionFlags;
|
||||
uint16_t mProxyPort{0};
|
||||
uint16_t mOriginPort{0};
|
||||
bool mProxyTransparent{false};
|
||||
bool mProxyTransparentResolvesHost{false};
|
||||
bool mHttpsProxy{false};
|
||||
uint32_t mConnectionFlags{0};
|
||||
// When we fail to connect using a prefered IP family, we tell the consumer to
|
||||
// reset the IP family preference on the connection entry.
|
||||
bool mResetFamilyPreference;
|
||||
uint32_t mTlsFlags;
|
||||
bool mReuseAddrPort;
|
||||
bool mResetFamilyPreference{false};
|
||||
uint32_t mTlsFlags{0};
|
||||
bool mReuseAddrPort{false};
|
||||
|
||||
// The origin attributes are used to create sockets. The first party domain
|
||||
// will eventually be used to isolate OCSP cache and is only non-empty when
|
||||
|
@ -309,29 +309,29 @@ class nsSocketTransport final : public nsASocketHandler,
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
// socket state vars:
|
||||
uint32_t mState; // STATE_??? flags
|
||||
bool mAttached;
|
||||
bool mInputClosed;
|
||||
bool mOutputClosed;
|
||||
uint32_t mState{STATE_CLOSED}; // STATE_??? flags
|
||||
bool mAttached{false};
|
||||
bool mInputClosed{true};
|
||||
bool mOutputClosed{true};
|
||||
|
||||
// this flag is used to determine if the results of a host lookup arrive
|
||||
// recursively or not. this flag is not protected by any lock.
|
||||
bool mResolving;
|
||||
bool mResolving{false};
|
||||
|
||||
nsCOMPtr<nsICancelable> mDNSRequest;
|
||||
nsCOMPtr<nsIDNSAddrRecord> mDNSRecord;
|
||||
|
||||
nsCString mEchConfig;
|
||||
bool mEchConfigUsed = false;
|
||||
bool mResolvedByTRR;
|
||||
bool mResolvedByTRR{false};
|
||||
|
||||
// mNetAddr/mSelfAddr is valid from GetPeerAddr()/GetSelfAddr() once we have
|
||||
// reached STATE_TRANSFERRING. It must not change after that.
|
||||
void SetSocketName(PRFileDesc* fd);
|
||||
NetAddr mNetAddr;
|
||||
NetAddr mSelfAddr; // getsockname()
|
||||
Atomic<bool, Relaxed> mNetAddrIsSet;
|
||||
Atomic<bool, Relaxed> mSelfAddrIsSet;
|
||||
Atomic<bool, Relaxed> mNetAddrIsSet{false};
|
||||
Atomic<bool, Relaxed> mSelfAddrIsSet{false};
|
||||
|
||||
UniquePtr<NetAddr> mBindAddr;
|
||||
|
||||
|
@ -363,10 +363,11 @@ class nsSocketTransport final : public nsASocketHandler,
|
|||
// socket input/output objects. these may be accessed on any thread with
|
||||
// the exception of some specific methods (XXX).
|
||||
|
||||
Mutex mLock; // protects members in this section.
|
||||
// protects members in this section.
|
||||
Mutex mLock{"nsSocketTransport.mLock"};
|
||||
LockedPRFileDesc mFD;
|
||||
nsrefcnt mFDref; // mFD is closed when mFDref goes to zero.
|
||||
bool mFDconnected; // mFD is available to consumer when TRUE.
|
||||
nsrefcnt mFDref{0}; // mFD is closed when mFDref goes to zero.
|
||||
bool mFDconnected{false}; // mFD is available to consumer when TRUE.
|
||||
|
||||
// A delete protector reference to gSocketTransportService held for lifetime
|
||||
// of 'this'. Sometimes used interchangably with gSocketTransportService due
|
||||
|
@ -387,11 +388,11 @@ class nsSocketTransport final : public nsASocketHandler,
|
|||
uint16_t mTimeouts[2]{0};
|
||||
|
||||
// linger options to use when closing
|
||||
bool mLingerPolarity;
|
||||
int16_t mLingerTimeout;
|
||||
bool mLingerPolarity{false};
|
||||
int16_t mLingerTimeout{0};
|
||||
|
||||
// QoS setting for socket
|
||||
uint8_t mQoSBits;
|
||||
uint8_t mQoSBits{0x00};
|
||||
|
||||
//
|
||||
// mFD access methods: called with mLock held.
|
||||
|
@ -448,14 +449,14 @@ class nsSocketTransport final : public nsASocketHandler,
|
|||
|
||||
// True if keepalive has been enabled by the socket owner. Note: Keepalive
|
||||
// must also be enabled globally for it to be enabled in TCP.
|
||||
bool mKeepaliveEnabled;
|
||||
bool mKeepaliveEnabled{false};
|
||||
|
||||
// Keepalive config (support varies by platform).
|
||||
int32_t mKeepaliveIdleTimeS;
|
||||
int32_t mKeepaliveRetryIntervalS;
|
||||
int32_t mKeepaliveProbeCount;
|
||||
int32_t mKeepaliveIdleTimeS{-1};
|
||||
int32_t mKeepaliveRetryIntervalS{-1};
|
||||
int32_t mKeepaliveProbeCount{-1};
|
||||
|
||||
bool mDoNotRetryToConnect;
|
||||
bool mDoNotRetryToConnect{false};
|
||||
|
||||
// Whether the port remapping has already been applied. We definitely want to
|
||||
// prevent duplicate calls in case of chaining remapping.
|
||||
|
|
|
@ -49,7 +49,6 @@ static Atomic<PRThread*, Relaxed> gSocketThread(nullptr);
|
|||
#define KEEPALIVE_RETRY_INTERVAL_PREF "network.tcp.keepalive.retry_interval"
|
||||
#define KEEPALIVE_PROBE_COUNT_PREF "network.tcp.keepalive.probe_count"
|
||||
#define SOCKET_LIMIT_TARGET 1000U
|
||||
#define SOCKET_LIMIT_MIN 50U
|
||||
#define MAX_TIME_BETWEEN_TWO_POLLS \
|
||||
"network.sts.max_time_for_events_between_two_polls"
|
||||
#define POLL_BUSY_WAIT_PERIOD "network.sts.poll_busy_wait_period"
|
||||
|
@ -119,38 +118,10 @@ void nsSocketTransportService::SocketContext::MaybeResetEpoch() {
|
|||
// ctor/dtor (called on the main/UI thread by the service manager)
|
||||
|
||||
nsSocketTransportService::nsSocketTransportService()
|
||||
: mRawThread(nullptr),
|
||||
mInitialized(false),
|
||||
mShuttingDown(false),
|
||||
mLock("nsSocketTransportService::mLock"),
|
||||
mOffline(false),
|
||||
mGoingOffline(false),
|
||||
mActiveListSize(SOCKET_LIMIT_MIN),
|
||||
mIdleListSize(SOCKET_LIMIT_MIN),
|
||||
mActiveCount(0),
|
||||
mIdleCount(0),
|
||||
mSentBytesCount(0),
|
||||
mReceivedBytesCount(0),
|
||||
mSendBufferSize(0),
|
||||
mKeepaliveIdleTimeS(600),
|
||||
mKeepaliveRetryIntervalS(1),
|
||||
mKeepaliveProbeCount(kDefaultTCPKeepCount),
|
||||
mKeepaliveEnabledPref(false),
|
||||
mPollableEventTimeout(TimeDuration::FromSeconds(6)),
|
||||
mServingPendingQueue(false),
|
||||
mMaxTimePerPollIter(100),
|
||||
: mPollableEventTimeout(TimeDuration::FromSeconds(6)),
|
||||
mMaxTimeForPrClosePref(PR_SecondsToInterval(5)),
|
||||
mLastNetworkLinkChangeTime(0),
|
||||
mNetworkLinkChangeBusyWaitPeriod(PR_SecondsToInterval(50)),
|
||||
mNetworkLinkChangeBusyWaitTimeout(PR_SecondsToInterval(7)),
|
||||
mSleepPhase(false),
|
||||
mProbedMaxCount(false)
|
||||
#if defined(XP_WIN)
|
||||
,
|
||||
mPolling(false)
|
||||
#endif
|
||||
,
|
||||
mNotTrustedMitmDetected(false) {
|
||||
mNetworkLinkChangeBusyWaitTimeout(PR_SecondsToInterval(7)) {
|
||||
NS_ASSERTION(NS_IsMainThread(), "wrong thread");
|
||||
|
||||
PR_CallOnce(&gMaxCountInitOnce, DiscoverMaxCount);
|
||||
|
|
|
@ -100,6 +100,8 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIDIRECTTASKDISPATCHER
|
||||
|
||||
static const uint32_t SOCKET_LIMIT_MIN = 50U;
|
||||
|
||||
nsSocketTransportService();
|
||||
|
||||
// Max Socket count may need to get initialized/used by nsHttpHandler
|
||||
|
@ -144,7 +146,7 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
// The value is guaranteed to be valid and not dangling while on the socket
|
||||
// thread as mThread is only ever reset after it's been shutdown.
|
||||
// This member should only ever be read on the socket thread.
|
||||
nsIThread* mRawThread;
|
||||
nsIThread* mRawThread{nullptr};
|
||||
|
||||
// Returns mThread in a thread-safe manner.
|
||||
already_AddRefed<nsIThread> GetThreadSafely();
|
||||
|
@ -155,10 +157,10 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
// initialization and shutdown (any thread)
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
Atomic<bool> mInitialized;
|
||||
Atomic<bool> mInitialized{false};
|
||||
// indicates whether we are currently in the process of shutting down
|
||||
Atomic<bool> mShuttingDown;
|
||||
Mutex mLock;
|
||||
Atomic<bool> mShuttingDown{false};
|
||||
Mutex mLock{"nsSocketTransportService::mLock"};
|
||||
// Variables in the next section protected by mLock
|
||||
|
||||
// mThread and mDirectTaskDispatcher are only ever modified on the main
|
||||
|
@ -170,8 +172,8 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
// to do do_QueryInterface whenever we need to access the interface.
|
||||
nsCOMPtr<nsIDirectTaskDispatcher> mDirectTaskDispatcher;
|
||||
UniquePtr<PollableEvent> mPollableEvent;
|
||||
bool mOffline;
|
||||
bool mGoingOffline;
|
||||
bool mOffline{false};
|
||||
bool mGoingOffline{false};
|
||||
|
||||
// Detaches all sockets.
|
||||
void Reset(bool aGuardLocals);
|
||||
|
@ -218,10 +220,10 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
SocketContext* mActiveList; /* mListSize entries */
|
||||
SocketContext* mIdleList; /* mListSize entries */
|
||||
|
||||
uint32_t mActiveListSize;
|
||||
uint32_t mIdleListSize;
|
||||
uint32_t mActiveCount;
|
||||
uint32_t mIdleCount;
|
||||
uint32_t mActiveListSize{SOCKET_LIMIT_MIN};
|
||||
uint32_t mIdleListSize{SOCKET_LIMIT_MIN};
|
||||
uint32_t mActiveCount{0};
|
||||
uint32_t mIdleCount{0};
|
||||
|
||||
nsresult DetachSocket(SocketContext*, SocketContext*);
|
||||
nsresult AddToIdleList(SocketContext*);
|
||||
|
@ -236,8 +238,8 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
void InitMaxCount();
|
||||
|
||||
// Total bytes number transfered through all the sockets except active ones
|
||||
uint64_t mSentBytesCount;
|
||||
uint64_t mReceivedBytesCount;
|
||||
uint64_t mSentBytesCount{0};
|
||||
uint64_t mReceivedBytesCount{0};
|
||||
//-------------------------------------------------------------------------
|
||||
// poll list (socket thread only)
|
||||
//
|
||||
|
@ -267,24 +269,24 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
nsresult UpdatePrefs();
|
||||
static void UpdatePrefs(const char* aPref, void* aSelf);
|
||||
void UpdateSendBufferPref();
|
||||
int32_t mSendBufferSize;
|
||||
int32_t mSendBufferSize{0};
|
||||
// Number of seconds of connection is idle before first keepalive ping.
|
||||
int32_t mKeepaliveIdleTimeS;
|
||||
int32_t mKeepaliveIdleTimeS{600};
|
||||
// Number of seconds between retries should keepalive pings fail.
|
||||
int32_t mKeepaliveRetryIntervalS;
|
||||
int32_t mKeepaliveRetryIntervalS{1};
|
||||
// Number of keepalive probes to send.
|
||||
int32_t mKeepaliveProbeCount;
|
||||
int32_t mKeepaliveProbeCount{kDefaultTCPKeepCount};
|
||||
// True if TCP keepalive is enabled globally.
|
||||
bool mKeepaliveEnabledPref;
|
||||
bool mKeepaliveEnabledPref{false};
|
||||
// Timeout of pollable event signalling.
|
||||
TimeDuration mPollableEventTimeout;
|
||||
|
||||
Atomic<bool> mServingPendingQueue;
|
||||
Atomic<int32_t, Relaxed> mMaxTimePerPollIter;
|
||||
Atomic<bool> mServingPendingQueue{false};
|
||||
Atomic<int32_t, Relaxed> mMaxTimePerPollIter{100};
|
||||
Atomic<PRIntervalTime, Relaxed> mMaxTimeForPrClosePref;
|
||||
// Timestamp of the last network link change event, tracked
|
||||
// also on child processes.
|
||||
Atomic<PRIntervalTime, Relaxed> mLastNetworkLinkChangeTime;
|
||||
Atomic<PRIntervalTime, Relaxed> mLastNetworkLinkChangeTime{0};
|
||||
// Preference for how long we do busy wait after network link
|
||||
// change has been detected.
|
||||
Atomic<PRIntervalTime, Relaxed> mNetworkLinkChangeBusyWaitPeriod;
|
||||
|
@ -294,7 +296,7 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
|
||||
// Between a computer going to sleep and waking up the PR_*** telemetry
|
||||
// will be corrupted - so do not record it.
|
||||
Atomic<bool, Relaxed> mSleepPhase;
|
||||
Atomic<bool, Relaxed> mSleepPhase{false};
|
||||
nsCOMPtr<nsITimer> mAfterWakeUpTimer;
|
||||
|
||||
// Lazily created array of forced port remappings. The tuple members meaning
|
||||
|
@ -317,7 +319,7 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
#if defined(XP_WIN)
|
||||
void ProbeMaxCount();
|
||||
#endif
|
||||
bool mProbedMaxCount;
|
||||
bool mProbedMaxCount{false};
|
||||
|
||||
void AnalyzeConnection(nsTArray<SocketInfo>* data, SocketContext* context,
|
||||
bool aActive);
|
||||
|
@ -329,7 +331,7 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
void MarkTheLastElementOfPendingQueue();
|
||||
|
||||
#if defined(XP_WIN)
|
||||
Atomic<bool> mPolling;
|
||||
Atomic<bool> mPolling{false};
|
||||
nsCOMPtr<nsITimer> mPollRepairTimer;
|
||||
void StartPollWatchdog();
|
||||
void DoPollRepair();
|
||||
|
@ -339,7 +341,7 @@ class nsSocketTransportService final : public nsPISocketTransportService,
|
|||
|
||||
void TryRepairPollableEvent();
|
||||
|
||||
bool mNotTrustedMitmDetected;
|
||||
bool mNotTrustedMitmDetected{false};
|
||||
|
||||
CopyableTArray<nsCOMPtr<nsISTSShutdownObserver>> mShutdownObservers;
|
||||
};
|
||||
|
|
|
@ -205,10 +205,7 @@ static LinkedList<nsStandardURL> gAllURLs;
|
|||
#endif
|
||||
|
||||
nsStandardURL::nsStandardURL(bool aSupportsFileURL, bool aTrackURL)
|
||||
: mDefaultPort(-1),
|
||||
mPort(-1),
|
||||
mDisplayHost(nullptr),
|
||||
mURLType(URLTYPE_STANDARD),
|
||||
: mURLType(URLTYPE_STANDARD),
|
||||
mSupportsFileURL(aSupportsFileURL),
|
||||
mCheckedIfHostA(false) {
|
||||
LOG(("Creating nsStandardURL @%p\n", this));
|
||||
|
|
|
@ -74,10 +74,10 @@ class nsStandardURL : public nsIFileURL,
|
|||
// location and length of an url segment relative to mSpec
|
||||
//
|
||||
struct URLSegment {
|
||||
uint32_t mPos;
|
||||
int32_t mLen;
|
||||
uint32_t mPos{0};
|
||||
int32_t mLen{-1};
|
||||
|
||||
URLSegment() : mPos(0), mLen(-1) {}
|
||||
URLSegment() = default;
|
||||
URLSegment(uint32_t pos, int32_t len) : mPos(pos), mLen(len) {}
|
||||
URLSegment(const URLSegment& aCopy) = default;
|
||||
void Reset() {
|
||||
|
@ -265,8 +265,8 @@ class nsStandardURL : public nsIFileURL,
|
|||
|
||||
// mSpec contains the normalized version of the URL spec (UTF-8 encoded).
|
||||
nsCString mSpec;
|
||||
int32_t mDefaultPort;
|
||||
int32_t mPort;
|
||||
int32_t mDefaultPort{-1};
|
||||
int32_t mPort{-1};
|
||||
|
||||
// url parts (relative to mSpec)
|
||||
URLSegment mScheme;
|
||||
|
@ -446,7 +446,7 @@ class nsStandardURL : public nsIFileURL,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
explicit TemplatedMutator() : mMarkedFileURL(false) {}
|
||||
explicit TemplatedMutator() = default;
|
||||
|
||||
private:
|
||||
virtual ~TemplatedMutator() = default;
|
||||
|
|
|
@ -41,18 +41,14 @@ class nsInputStreamTransport : public nsITransport,
|
|||
NS_DECL_NSIINPUTSTREAMCALLBACK
|
||||
|
||||
nsInputStreamTransport(nsIInputStream* source, bool closeWhenDone)
|
||||
: mMutex("nsInputStreamTransport::mMutex"),
|
||||
mSource(source),
|
||||
mOffset(0),
|
||||
mCloseWhenDone(closeWhenDone),
|
||||
mInProgress(false) {
|
||||
: mSource(source), mCloseWhenDone(closeWhenDone) {
|
||||
mAsyncSource = do_QueryInterface(mSource);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~nsInputStreamTransport() = default;
|
||||
|
||||
Mutex mMutex;
|
||||
Mutex mMutex{"nsInputStreamTransport::mMutex"};
|
||||
|
||||
// This value is protected by mutex.
|
||||
nsCOMPtr<nsIInputStreamCallback> mAsyncWaitCallback;
|
||||
|
@ -67,12 +63,12 @@ class nsInputStreamTransport : public nsITransport,
|
|||
// It can be null.
|
||||
nsCOMPtr<nsIAsyncInputStream> mAsyncSource;
|
||||
|
||||
int64_t mOffset;
|
||||
int64_t mOffset{0};
|
||||
const bool mCloseWhenDone;
|
||||
|
||||
// this variable serves as a lock to prevent the state of the transport
|
||||
// from being modified once the copy is in progress.
|
||||
bool mInProgress;
|
||||
bool mInProgress{false};
|
||||
};
|
||||
|
||||
NS_IMPL_ADDREF(nsInputStreamTransport);
|
||||
|
@ -248,9 +244,7 @@ nsInputStreamTransport::OnInputStreamReady(nsIAsyncInputStream* aStream) {
|
|||
|
||||
nsStreamTransportService::nsStreamTransportService()
|
||||
: mScheduledDelayedRunnables(
|
||||
"nsStreamTransportService.mScheduledDelayedRunnables"),
|
||||
mShutdownLock("nsStreamTransportService.mShutdownLock"),
|
||||
mIsShutdown(false) {}
|
||||
"nsStreamTransportService.mScheduledDelayedRunnables") {}
|
||||
|
||||
nsStreamTransportService::~nsStreamTransportService() {
|
||||
NS_ASSERTION(!mPool, "thread pool wasn't shutdown");
|
||||
|
|
|
@ -49,8 +49,8 @@ class nsStreamTransportService final : public nsIStreamTransportService,
|
|||
|
||||
DataMutex<nsTArray<RefPtr<DelayedRunnable>>> mScheduledDelayedRunnables;
|
||||
|
||||
mozilla::Mutex mShutdownLock;
|
||||
bool mIsShutdown;
|
||||
mozilla::Mutex mShutdownLock{"nsStreamTransportService.mShutdownLock"};
|
||||
bool mIsShutdown{false};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -25,7 +25,7 @@ class nsSyncStreamListener final : public nsISyncStreamListener,
|
|||
static already_AddRefed<nsISyncStreamListener> Create();
|
||||
|
||||
private:
|
||||
nsSyncStreamListener() : mStatus(NS_OK), mKeepWaiting(false), mDone(false) {}
|
||||
nsSyncStreamListener() = default;
|
||||
~nsSyncStreamListener() = default;
|
||||
|
||||
nsresult Init();
|
||||
|
@ -34,9 +34,9 @@ class nsSyncStreamListener final : public nsISyncStreamListener,
|
|||
|
||||
nsCOMPtr<nsIInputStream> mPipeIn;
|
||||
nsCOMPtr<nsIOutputStream> mPipeOut;
|
||||
nsresult mStatus;
|
||||
bool mKeepWaiting;
|
||||
bool mDone;
|
||||
nsresult mStatus{NS_OK};
|
||||
bool mKeepWaiting{false};
|
||||
bool mDone{false};
|
||||
};
|
||||
|
||||
#endif // nsSyncStreamListener_h__
|
||||
|
|
|
@ -221,15 +221,7 @@ FallibleTArray<uint8_t>& nsUDPMessage::GetDataAsTArray() { return mData; }
|
|||
// nsUDPSocket
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
nsUDPSocket::nsUDPSocket()
|
||||
: mLock("nsUDPSocket.mLock"),
|
||||
mFD(nullptr),
|
||||
mOriginAttributes(),
|
||||
mAttached(false),
|
||||
mByteReadCount(0),
|
||||
mByteWriteCount(0) {
|
||||
this->mAddr.inet = {};
|
||||
mAddr.raw.family = PR_AF_UNSPEC;
|
||||
nsUDPSocket::nsUDPSocket() {
|
||||
// we want to be able to access the STS directly, and it may not have been
|
||||
// constructed yet. the STS constructor sets gSocketTransportService.
|
||||
if (!gSocketTransportService) {
|
||||
|
|
|
@ -58,18 +58,18 @@ class nsUDPSocket final : public nsASocketHandler, public nsIUDPSocket {
|
|||
|
||||
// lock protects access to mListener;
|
||||
// so mListener is not cleared while being used/locked.
|
||||
Mutex mLock;
|
||||
PRFileDesc* mFD;
|
||||
Mutex mLock{"nsUDPSocket.mLock"};
|
||||
PRFileDesc* mFD{nullptr};
|
||||
NetAddr mAddr;
|
||||
OriginAttributes mOriginAttributes;
|
||||
nsCOMPtr<nsIUDPSocketListener> mListener;
|
||||
nsCOMPtr<nsIUDPSocketSyncListener> mSyncListener;
|
||||
nsCOMPtr<nsIEventTarget> mListenerTarget;
|
||||
bool mAttached;
|
||||
bool mAttached{false};
|
||||
RefPtr<nsSocketTransportService> mSts;
|
||||
|
||||
uint64_t mByteReadCount;
|
||||
uint64_t mByteWriteCount;
|
||||
uint64_t mByteReadCount{0};
|
||||
uint64_t mByteWriteCount{0};
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -32,11 +32,7 @@ class nsBlockOnBackgroundThreadEvent : public Runnable {
|
|||
nsDeleteDir* nsDeleteDir::gInstance = nullptr;
|
||||
|
||||
nsDeleteDir::nsDeleteDir()
|
||||
: mLock("nsDeleteDir.mLock"),
|
||||
mCondVar(mLock, "nsDeleteDir.mCondVar"),
|
||||
mNotified(false),
|
||||
mShutdownPending(false),
|
||||
mStopDeleting(false) {
|
||||
: mLock("nsDeleteDir.mLock"), mCondVar(mLock, "nsDeleteDir.mCondVar") {
|
||||
NS_ASSERTION(gInstance == nullptr, "multiple nsCacheService instances!");
|
||||
}
|
||||
|
||||
|
|
|
@ -69,11 +69,11 @@ class nsDeleteDir {
|
|||
static nsDeleteDir* gInstance;
|
||||
mozilla::Mutex mLock;
|
||||
mozilla::CondVar mCondVar;
|
||||
bool mNotified;
|
||||
bool mNotified{false};
|
||||
nsCOMArray<nsITimer> mTimers;
|
||||
nsCOMPtr<nsISerialEventTarget> mBackgroundET;
|
||||
bool mShutdownPending;
|
||||
bool mStopDeleting;
|
||||
bool mShutdownPending{false};
|
||||
bool mStopDeleting{false};
|
||||
};
|
||||
|
||||
#endif // nsDeleteDir_h__
|
||||
|
|
|
@ -44,8 +44,7 @@ NS_IMPL_ISUPPORTS(CacheEntryHandle, nsICacheEntry)
|
|||
|
||||
// CacheEntryHandle
|
||||
|
||||
CacheEntryHandle::CacheEntryHandle(CacheEntry* aEntry)
|
||||
: mEntry(aEntry), mClosed(false) {
|
||||
CacheEntryHandle::CacheEntryHandle(CacheEntry* aEntry) : mEntry(aEntry) {
|
||||
#ifdef DEBUG
|
||||
if (!mEntry->HandlesCount()) {
|
||||
// CacheEntry.mHandlesCount must go from zero to one only under
|
||||
|
@ -202,25 +201,16 @@ uint64_t CacheEntry::GetNextId() {
|
|||
CacheEntry::CacheEntry(const nsACString& aStorageID, const nsACString& aURI,
|
||||
const nsACString& aEnhanceID, bool aUseDisk,
|
||||
bool aSkipSizeCheck, bool aPin)
|
||||
: mFrecency(0),
|
||||
mSortingExpirationTime(uint32_t(-1)),
|
||||
mLock("CacheEntry"),
|
||||
mFileStatus(NS_ERROR_NOT_INITIALIZED),
|
||||
mURI(aURI),
|
||||
: mURI(aURI),
|
||||
mEnhanceID(aEnhanceID),
|
||||
mStorageID(aStorageID),
|
||||
mUseDisk(aUseDisk),
|
||||
mSkipSizeCheck(aSkipSizeCheck),
|
||||
mIsDoomed(false),
|
||||
mSecurityInfoLoaded(false),
|
||||
mPreventCallbacks(false),
|
||||
mHasData(false),
|
||||
mPinned(aPin),
|
||||
mPinningKnown(false),
|
||||
mState(NOTLOADED),
|
||||
mRegistration(NEVERREGISTERED),
|
||||
mWriter(nullptr),
|
||||
mUseCount(0),
|
||||
mCacheEntryId(GetNextId()) {
|
||||
LOG(("CacheEntry::CacheEntry [this=%p]", this));
|
||||
|
||||
|
|
|
@ -151,8 +151,9 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
const nsACString& aURISpec, nsACString& aResult);
|
||||
|
||||
// Accessed only on the service management thread
|
||||
double mFrecency;
|
||||
::mozilla::Atomic<uint32_t, ::mozilla::Relaxed> mSortingExpirationTime;
|
||||
double mFrecency{0};
|
||||
::mozilla::Atomic<uint32_t, ::mozilla::Relaxed> mSortingExpirationTime{
|
||||
uint32_t(-1)};
|
||||
|
||||
// Memory reporting
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
||||
|
@ -307,7 +308,7 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
bool aMemoryOnly, nsICacheEntryOpenCallback* aCallback);
|
||||
void TransferCallbacks(CacheEntry& aFromEntry);
|
||||
|
||||
mozilla::Mutex mLock;
|
||||
mozilla::Mutex mLock{"CacheEntry"};
|
||||
|
||||
// Reflects the number of existing handles for this entry
|
||||
::mozilla::ThreadSafeAutoRefCnt mHandlesCount;
|
||||
|
@ -320,7 +321,7 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
// Using ReleaseAcquire since we only control access to mFile with this.
|
||||
// When mFileStatus is read and found success it is ensured there is mFile and
|
||||
// that it is after a successful call to Init().
|
||||
::mozilla::Atomic<nsresult, ::mozilla::ReleaseAcquire> mFileStatus;
|
||||
Atomic<nsresult, ReleaseAcquire> mFileStatus{NS_ERROR_NOT_INITIALIZED};
|
||||
nsCString mURI;
|
||||
nsCString mEnhanceID;
|
||||
nsCString mStorageID;
|
||||
|
@ -334,7 +335,7 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
// Whether it should skip max size check.
|
||||
bool const mSkipSizeCheck;
|
||||
// Set when entry is doomed with AsyncDoom() or DoomAlreadyRemoved().
|
||||
bool mIsDoomed;
|
||||
bool mIsDoomed{false};
|
||||
|
||||
// Following flags are all synchronized with the cache entry lock.
|
||||
|
||||
|
@ -368,7 +369,7 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
};
|
||||
|
||||
// State of this entry.
|
||||
EState mState;
|
||||
EState mState{NOTLOADED};
|
||||
|
||||
enum ERegistration {
|
||||
NEVERREGISTERED = 0, // The entry has never been registered
|
||||
|
@ -378,7 +379,7 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
|
||||
// Accessed only on the management thread. Records the state of registration
|
||||
// this entry in the memory pool intermediate cache.
|
||||
ERegistration mRegistration;
|
||||
ERegistration mRegistration{NEVERREGISTERED};
|
||||
|
||||
// If a new (empty) entry is requested to open an input stream before
|
||||
// output stream has been opened, we must open output stream internally
|
||||
|
@ -389,7 +390,7 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
// Weak reference to the current writter. There can be more then one
|
||||
// writer at a time and OnHandleClosed() must be processed only for the
|
||||
// current one.
|
||||
CacheEntryHandle* mWriter;
|
||||
CacheEntryHandle* mWriter{nullptr};
|
||||
|
||||
// Background thread scheduled operation. Set (under the lock) one
|
||||
// of this flags to tell the background thread what to do.
|
||||
|
@ -400,7 +401,7 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
static uint32_t const CALLBACKS = 1 << 2;
|
||||
static uint32_t const UNREGISTER = 1 << 3;
|
||||
|
||||
Ops() : mFlags(0) {}
|
||||
Ops() = default;
|
||||
uint32_t Grab() {
|
||||
uint32_t flags = mFlags;
|
||||
mFlags = 0;
|
||||
|
@ -413,12 +414,12 @@ class CacheEntry final : public nsIRunnable, public CacheFileListener {
|
|||
}
|
||||
|
||||
private:
|
||||
uint32_t mFlags;
|
||||
uint32_t mFlags{0};
|
||||
} mBackgroundOperations;
|
||||
|
||||
nsCOMPtr<nsISupports> mSecurityInfo;
|
||||
mozilla::TimeStamp mLoadStart;
|
||||
uint32_t mUseCount;
|
||||
uint32_t mUseCount{0};
|
||||
|
||||
const uint64_t mCacheEntryId;
|
||||
};
|
||||
|
@ -547,7 +548,7 @@ class CacheEntryHandle final : public nsICacheEntry {
|
|||
|
||||
// This is |false| until Dismiss() was called and prevents OnHandleClosed
|
||||
// being called more than once.
|
||||
Atomic<bool, ReleaseAcquire> mClosed;
|
||||
Atomic<bool, ReleaseAcquire> mClosed{false};
|
||||
};
|
||||
|
||||
class CacheOutputCloseListener final : public Runnable {
|
||||
|
|
|
@ -160,27 +160,7 @@ NS_INTERFACE_MAP_BEGIN(CacheFile)
|
|||
mozilla::net::CacheFileChunkListener)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
CacheFile::CacheFile()
|
||||
: mLock("CacheFile.mLock"),
|
||||
mOpeningFile(false),
|
||||
mReady(false),
|
||||
mMemoryOnly(false),
|
||||
mSkipSizeCheck(false),
|
||||
mOpenAsMemoryOnly(false),
|
||||
mPinned(false),
|
||||
mPriority(false),
|
||||
mDataAccessed(false),
|
||||
mDataIsDirty(false),
|
||||
mWritingMetadata(false),
|
||||
mPreloadWithoutInputStreams(true),
|
||||
mPreloadChunkCount(0),
|
||||
mStatus(NS_OK),
|
||||
mDataSize(-1),
|
||||
mAltDataOffset(-1),
|
||||
mKill(false),
|
||||
mOutput(nullptr) {
|
||||
LOG(("CacheFile::CacheFile() [this=%p]", this));
|
||||
}
|
||||
CacheFile::CacheFile() { LOG(("CacheFile::CacheFile() [this=%p]", this)); }
|
||||
|
||||
CacheFile::~CacheFile() {
|
||||
LOG(("CacheFile::~CacheFile() [this=%p]", this));
|
||||
|
|
|
@ -189,26 +189,27 @@ class CacheFile final : public CacheFileChunkListener,
|
|||
|
||||
nsresult InitIndexEntry();
|
||||
|
||||
mozilla::Mutex mLock;
|
||||
bool mOpeningFile;
|
||||
bool mReady;
|
||||
bool mMemoryOnly;
|
||||
bool mSkipSizeCheck;
|
||||
bool mOpenAsMemoryOnly;
|
||||
bool mPinned;
|
||||
bool mPriority;
|
||||
bool mDataAccessed;
|
||||
bool mDataIsDirty;
|
||||
bool mWritingMetadata;
|
||||
bool mPreloadWithoutInputStreams;
|
||||
uint32_t mPreloadChunkCount;
|
||||
nsresult mStatus;
|
||||
int64_t mDataSize; // Size of the whole data including eventual
|
||||
// alternative data represenation.
|
||||
int64_t mAltDataOffset; // If there is alternative data present, it
|
||||
// contains size of the original data, i.e.
|
||||
// offset where alternative data starts.
|
||||
// Otherwise it is -1.
|
||||
mozilla::Mutex mLock{"CacheFile.mLock"};
|
||||
bool mOpeningFile{false};
|
||||
bool mReady{false};
|
||||
bool mMemoryOnly{false};
|
||||
bool mSkipSizeCheck{false};
|
||||
bool mOpenAsMemoryOnly{false};
|
||||
bool mPinned{false};
|
||||
bool mPriority{false};
|
||||
bool mDataAccessed{false};
|
||||
bool mDataIsDirty{false};
|
||||
bool mWritingMetadata{false};
|
||||
bool mPreloadWithoutInputStreams{true};
|
||||
uint32_t mPreloadChunkCount{0};
|
||||
nsresult mStatus{NS_OK};
|
||||
// Size of the whole data including eventual alternative data represenation.
|
||||
int64_t mDataSize{-1};
|
||||
|
||||
// If there is alternative data present, it contains size of the original
|
||||
// data, i.e. offset where alternative data starts. Otherwise it is -1.
|
||||
int64_t mAltDataOffset{-1};
|
||||
|
||||
nsCString mKey;
|
||||
nsCString mAltDataType; // The type of the saved alt-data. May be empty.
|
||||
|
||||
|
@ -216,7 +217,7 @@ class CacheFile final : public CacheFileChunkListener,
|
|||
RefPtr<CacheFileMetadata> mMetadata;
|
||||
nsCOMPtr<CacheFileListener> mListener;
|
||||
nsCOMPtr<CacheFileIOListener> mDoomAfterOpenListener;
|
||||
Atomic<bool, Relaxed> mKill;
|
||||
Atomic<bool, Relaxed> mKill{false};
|
||||
|
||||
nsRefPtrHashtable<nsUint32HashKey, CacheFileChunk> mChunks;
|
||||
nsClassHashtable<nsUint32HashKey, ChunkListeners> mChunkListeners;
|
||||
|
@ -231,7 +232,7 @@ class CacheFile final : public CacheFileChunkListener,
|
|||
nsTArray<RefPtr<CacheFileChunk>> mDiscardedChunks;
|
||||
|
||||
nsTArray<CacheFileInputStream*> mInputs;
|
||||
CacheFileOutputStream* mOutput;
|
||||
CacheFileOutputStream* mOutput{nullptr};
|
||||
|
||||
nsTArray<RefPtr<nsISupports>> mObjsToRelease;
|
||||
};
|
||||
|
|
|
@ -28,8 +28,7 @@ const uint32_t kContextEvictionPrefixLength =
|
|||
|
||||
bool CacheFileContextEvictor::sDiskAlreadySearched = false;
|
||||
|
||||
CacheFileContextEvictor::CacheFileContextEvictor()
|
||||
: mEvicting(false), mIndexIsUpToDate(false) {
|
||||
CacheFileContextEvictor::CacheFileContextEvictor() {
|
||||
LOG(("CacheFileContextEvictor::CacheFileContextEvictor() [this=%p]", this));
|
||||
}
|
||||
|
||||
|
|
|
@ -79,12 +79,12 @@ class CacheFileContextEvictor {
|
|||
void EvictEntries();
|
||||
|
||||
// Whether eviction is in progress
|
||||
bool mEvicting;
|
||||
bool mEvicting{false};
|
||||
// Whether index is up to date. We wait with eviction until the index finishes
|
||||
// update process when it is outdated. NOTE: We also stop eviction in progress
|
||||
// when the index is found outdated, the eviction is restarted again once the
|
||||
// update process finishes.
|
||||
bool mIndexIsUpToDate;
|
||||
bool mIndexIsUpToDate{false};
|
||||
// Whether we already tried to restore unfinished jobs from previous run after
|
||||
// startup.
|
||||
static bool sDiskAlreadySearched;
|
||||
|
|
|
@ -517,9 +517,7 @@ size_t CacheFileHandles::SizeOfExcludingThis(
|
|||
class ShutdownEvent : public Runnable {
|
||||
public:
|
||||
ShutdownEvent()
|
||||
: Runnable("net::ShutdownEvent"),
|
||||
mMonitor("ShutdownEvent.mMonitor"),
|
||||
mNotified(false) {}
|
||||
: Runnable("net::ShutdownEvent"), mMonitor("ShutdownEvent.mMonitor") {}
|
||||
|
||||
protected:
|
||||
~ShutdownEvent() = default;
|
||||
|
@ -565,7 +563,7 @@ class ShutdownEvent : public Runnable {
|
|||
|
||||
protected:
|
||||
mozilla::Monitor mMonitor;
|
||||
bool mNotified;
|
||||
bool mNotified{false};
|
||||
};
|
||||
|
||||
// Class responsible for reporting IO performance stats
|
||||
|
@ -1104,12 +1102,8 @@ StaticRefPtr<CacheFileIOManager> CacheFileIOManager::gInstance;
|
|||
NS_IMPL_ISUPPORTS(CacheFileIOManager, nsITimerCallback, nsINamed)
|
||||
|
||||
CacheFileIOManager::CacheFileIOManager()
|
||||
: mShuttingDown(false),
|
||||
mTreeCreated(false),
|
||||
mTreeCreationFailed(false),
|
||||
mOverLimitEvicting(false),
|
||||
mCacheSizeOnHardLimit(false),
|
||||
mRemovingTrashDirs(false) {
|
||||
|
||||
{
|
||||
LOG(("CacheFileIOManager::CacheFileIOManager [this=%p]", this));
|
||||
MOZ_ASSERT(!gInstance, "multiple CacheFileIOManager instances!");
|
||||
}
|
||||
|
|
|
@ -442,7 +442,7 @@ class CacheFileIOManager final : public nsITimerCallback, public nsINamed {
|
|||
TimeStamp mStartTime;
|
||||
// Set true on the IO thread, CLOSE level as part of the internal shutdown
|
||||
// procedure.
|
||||
bool mShuttingDown;
|
||||
bool mShuttingDown{false};
|
||||
RefPtr<CacheIOThread> mIOThread;
|
||||
nsCOMPtr<nsIFile> mCacheDirectory;
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
|
@ -452,19 +452,19 @@ class CacheFileIOManager final : public nsITimerCallback, public nsINamed {
|
|||
// w/o the profile name in the path. Here it is stored.
|
||||
nsCOMPtr<nsIFile> mCacheProfilelessDirectory;
|
||||
#endif
|
||||
bool mTreeCreated;
|
||||
bool mTreeCreationFailed;
|
||||
bool mTreeCreated{false};
|
||||
bool mTreeCreationFailed{false};
|
||||
CacheFileHandles mHandles;
|
||||
nsTArray<CacheFileHandle*> mHandlesByLastUsed;
|
||||
nsTArray<CacheFileHandle*> mSpecialHandles;
|
||||
nsTArray<RefPtr<CacheFile> > mScheduledMetadataWrites;
|
||||
nsCOMPtr<nsITimer> mMetadataWritesTimer;
|
||||
bool mOverLimitEvicting;
|
||||
bool mOverLimitEvicting{false};
|
||||
// When overlimit eviction is too slow and cache size reaches 105% of the
|
||||
// limit, this flag is set and no other content is cached to prevent
|
||||
// uncontrolled cache growing.
|
||||
bool mCacheSizeOnHardLimit;
|
||||
bool mRemovingTrashDirs;
|
||||
bool mCacheSizeOnHardLimit{false};
|
||||
bool mRemovingTrashDirs{false};
|
||||
nsCOMPtr<nsITimer> mTrashTimer;
|
||||
nsCOMPtr<nsIFile> mTrashDir;
|
||||
nsCOMPtr<nsIDirectoryEnumerator> mTrashDirEnumerator;
|
||||
|
|
|
@ -42,14 +42,7 @@ CacheFileMetadata::CacheFileMetadata(CacheFileHandle* aHandle,
|
|||
const nsACString& aKey)
|
||||
: CacheMemoryConsumer(NORMAL),
|
||||
mHandle(aHandle),
|
||||
mHashArray(nullptr),
|
||||
mHashArraySize(0),
|
||||
mHashCount(0),
|
||||
mOffset(-1),
|
||||
mBuf(nullptr),
|
||||
mBufSize(0),
|
||||
mWriteBuf(nullptr),
|
||||
mElementsSize(0),
|
||||
mIsDirty(false),
|
||||
mAnonymous(false),
|
||||
mAllocExactSize(false),
|
||||
|
@ -70,15 +63,6 @@ CacheFileMetadata::CacheFileMetadata(CacheFileHandle* aHandle,
|
|||
CacheFileMetadata::CacheFileMetadata(bool aMemoryOnly, bool aPinned,
|
||||
const nsACString& aKey)
|
||||
: CacheMemoryConsumer(aMemoryOnly ? MEMORY_ONLY : NORMAL),
|
||||
mHandle(nullptr),
|
||||
mHashArray(nullptr),
|
||||
mHashArraySize(0),
|
||||
mHashCount(0),
|
||||
mOffset(0),
|
||||
mBuf(nullptr),
|
||||
mBufSize(0),
|
||||
mWriteBuf(nullptr),
|
||||
mElementsSize(0),
|
||||
mIsDirty(true),
|
||||
mAnonymous(false),
|
||||
mAllocExactSize(false),
|
||||
|
@ -102,15 +86,6 @@ CacheFileMetadata::CacheFileMetadata(bool aMemoryOnly, bool aPinned,
|
|||
|
||||
CacheFileMetadata::CacheFileMetadata()
|
||||
: CacheMemoryConsumer(DONT_REPORT /* This is a helper class */),
|
||||
mHandle(nullptr),
|
||||
mHashArray(nullptr),
|
||||
mHashArraySize(0),
|
||||
mHashCount(0),
|
||||
mOffset(0),
|
||||
mBuf(nullptr),
|
||||
mBufSize(0),
|
||||
mWriteBuf(nullptr),
|
||||
mElementsSize(0),
|
||||
mIsDirty(false),
|
||||
mAnonymous(false),
|
||||
mAllocExactSize(false),
|
||||
|
|
|
@ -212,16 +212,16 @@ class CacheFileMetadata final : public CacheFileIOListener,
|
|||
|
||||
RefPtr<CacheFileHandle> mHandle;
|
||||
nsCString mKey;
|
||||
CacheHash::Hash16_t* mHashArray;
|
||||
uint32_t mHashArraySize;
|
||||
uint32_t mHashCount;
|
||||
int64_t mOffset;
|
||||
char* mBuf; // used for parsing, then points
|
||||
// to elements
|
||||
uint32_t mBufSize;
|
||||
char* mWriteBuf;
|
||||
CacheHash::Hash16_t* mHashArray{nullptr};
|
||||
uint32_t mHashArraySize{0};
|
||||
uint32_t mHashCount{0};
|
||||
int64_t mOffset{0};
|
||||
// used for parsing, then points to elements
|
||||
char* mBuf{nullptr};
|
||||
uint32_t mBufSize{0};
|
||||
char* mWriteBuf{nullptr};
|
||||
CacheFileMetadataHeader mMetaHdr{0};
|
||||
uint32_t mElementsSize;
|
||||
uint32_t mElementsSize{0};
|
||||
bool mIsDirty : 1;
|
||||
bool mAnonymous : 1;
|
||||
bool mAllocExactSize : 1;
|
||||
|
|
|
@ -124,15 +124,7 @@ CacheHash::Hash16_t CacheHash::Hash16(const char* aData, uint32_t aSize,
|
|||
|
||||
NS_IMPL_ISUPPORTS0(CacheHash)
|
||||
|
||||
CacheHash::CacheHash(uint32_t aInitval)
|
||||
: mA(0x9e3779b9),
|
||||
mB(0x9e3779b9),
|
||||
mC(aInitval),
|
||||
mPos(0),
|
||||
mBuf(0),
|
||||
mBufPos(0),
|
||||
mLength(0),
|
||||
mFinalized(false) {}
|
||||
CacheHash::CacheHash(uint32_t aInitval) : mC(aInitval) {}
|
||||
|
||||
void CacheHash::Feed(uint32_t aVal, uint8_t aLen) {
|
||||
switch (mPos) {
|
||||
|
|
|
@ -49,12 +49,14 @@ class CacheHash : public nsISupports {
|
|||
|
||||
void Feed(uint32_t aVal, uint8_t aLen = 4);
|
||||
|
||||
uint32_t mA, mB, mC;
|
||||
uint8_t mPos;
|
||||
uint32_t mBuf;
|
||||
uint8_t mBufPos;
|
||||
uint32_t mLength;
|
||||
bool mFinalized;
|
||||
static const uint32_t kGoldenRation = 0x9e3779b9;
|
||||
|
||||
uint32_t mA{kGoldenRation}, mB{kGoldenRation}, mC;
|
||||
uint8_t mPos{0};
|
||||
uint32_t mBuf{0};
|
||||
uint8_t mBufPos{0};
|
||||
uint32_t mLength{0};
|
||||
bool mFinalized{false};
|
||||
};
|
||||
|
||||
using OriginAttrsHash = uint64_t;
|
||||
|
|
|
@ -206,22 +206,7 @@ CacheIOThread* CacheIOThread::sSelf = nullptr;
|
|||
|
||||
NS_IMPL_ISUPPORTS(CacheIOThread, nsIThreadObserver)
|
||||
|
||||
CacheIOThread::CacheIOThread()
|
||||
: mMonitor("CacheIOThread"),
|
||||
mThread(nullptr),
|
||||
mXPCOMThread(nullptr),
|
||||
mLowestLevelWaiting(LAST_LEVEL),
|
||||
mCurrentlyExecutingLevel(0),
|
||||
mHasXPCOMEvents(false),
|
||||
mRerunCurrentEvent(false),
|
||||
mShutdown(false),
|
||||
mIOCancelableEvents(0),
|
||||
mEventCounter(0)
|
||||
#ifdef DEBUG
|
||||
,
|
||||
mInsideLoop(true)
|
||||
#endif
|
||||
{
|
||||
CacheIOThread::CacheIOThread() {
|
||||
for (auto& item : mQueueLength) {
|
||||
item = 0;
|
||||
}
|
||||
|
|
|
@ -111,12 +111,12 @@ class CacheIOThread final : public nsIThreadObserver {
|
|||
|
||||
static CacheIOThread* sSelf;
|
||||
|
||||
mozilla::Monitor mMonitor;
|
||||
PRThread* mThread;
|
||||
mozilla::Monitor mMonitor{"CacheIOThread"};
|
||||
PRThread* mThread{nullptr};
|
||||
UniquePtr<detail::BlockingIOWatcher> mBlockingIOWatcher;
|
||||
Atomic<nsIThread*> mXPCOMThread;
|
||||
Atomic<uint32_t, Relaxed> mLowestLevelWaiting;
|
||||
uint32_t mCurrentlyExecutingLevel;
|
||||
Atomic<nsIThread*> mXPCOMThread{nullptr};
|
||||
Atomic<uint32_t, Relaxed> mLowestLevelWaiting{LAST_LEVEL};
|
||||
uint32_t mCurrentlyExecutingLevel{0};
|
||||
|
||||
// Keeps the length of the each event queue, since LoopOneLevel moves all
|
||||
// events into a local array.
|
||||
|
@ -124,20 +124,20 @@ class CacheIOThread final : public nsIThreadObserver {
|
|||
|
||||
EventQueue mEventQueue[LAST_LEVEL];
|
||||
// Raised when nsIEventTarget.Dispatch() is called on this thread
|
||||
Atomic<bool, Relaxed> mHasXPCOMEvents;
|
||||
Atomic<bool, Relaxed> mHasXPCOMEvents{false};
|
||||
// See YieldAndRerun() above
|
||||
bool mRerunCurrentEvent;
|
||||
bool mRerunCurrentEvent{false};
|
||||
// Signal to process all pending events and then shutdown
|
||||
// Synchronized by mMonitor
|
||||
bool mShutdown;
|
||||
bool mShutdown{false};
|
||||
// If > 0 there is currently an I/O operation on the thread that
|
||||
// can be canceled when after shutdown, see the Shutdown() method
|
||||
// for usage. Made a counter to allow nesting of the Cancelable class.
|
||||
Atomic<uint32_t, Relaxed> mIOCancelableEvents;
|
||||
Atomic<uint32_t, Relaxed> mIOCancelableEvents{0};
|
||||
// Event counter that increases with every event processed.
|
||||
Atomic<uint32_t, Relaxed> mEventCounter;
|
||||
Atomic<uint32_t, Relaxed> mEventCounter{0};
|
||||
#ifdef DEBUG
|
||||
bool mInsideLoop;
|
||||
bool mInsideLoop{true};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -249,23 +249,8 @@ NS_INTERFACE_MAP_BEGIN(CacheIndex)
|
|||
NS_INTERFACE_MAP_END
|
||||
|
||||
CacheIndex::CacheIndex()
|
||||
: mState(INITIAL),
|
||||
mShuttingDown(false),
|
||||
mIndexNeedsUpdate(false),
|
||||
mRemovingAll(false),
|
||||
mIndexOnDiskIsValid(false),
|
||||
mDontMarkIndexClean(false),
|
||||
mIndexTimeStamp(0),
|
||||
mUpdateEventPending(false),
|
||||
mSkipEntries(0),
|
||||
mProcessEntries(0),
|
||||
mRWBuf(nullptr),
|
||||
mRWBufSize(0),
|
||||
mRWBufPos(0),
|
||||
mRWPending(false),
|
||||
mJournalReadSuccessfully(false),
|
||||
mAsyncGetDiskConsumptionBlocked(false),
|
||||
mTotalBytesWritten(0) {
|
||||
|
||||
{
|
||||
sLock.AssertCurrentThreadOwns();
|
||||
LOG(("CacheIndex::CacheIndex [this=%p]", this));
|
||||
MOZ_ASSERT(!gInstance, "multiple CacheIndex instances!");
|
||||
|
|
|
@ -75,11 +75,11 @@ static_assert(sizeof(CacheIndexHeader::mVersion) +
|
|||
#pragma pack(push, 1)
|
||||
struct CacheIndexRecord {
|
||||
SHA1Sum::Hash mHash{};
|
||||
uint32_t mFrecency;
|
||||
OriginAttrsHash mOriginAttrsHash;
|
||||
uint16_t mOnStartTime;
|
||||
uint16_t mOnStopTime;
|
||||
uint8_t mContentType;
|
||||
uint32_t mFrecency{0};
|
||||
OriginAttrsHash mOriginAttrsHash{0};
|
||||
uint16_t mOnStartTime{kIndexTimeNotAvailable};
|
||||
uint16_t mOnStopTime{kIndexTimeNotAvailable};
|
||||
uint8_t mContentType{nsICacheEntry::CONTENT_TYPE_UNKNOWN};
|
||||
|
||||
/*
|
||||
* 1000 0000 0000 0000 0000 0000 0000 0000 : initialized
|
||||
|
@ -92,15 +92,9 @@ struct CacheIndexRecord {
|
|||
* 0000 0001 0000 0000 0000 0000 0000 0000 : reserved
|
||||
* 0000 0000 1111 1111 1111 1111 1111 1111 : file size (in kB)
|
||||
*/
|
||||
uint32_t mFlags;
|
||||
uint32_t mFlags{0};
|
||||
|
||||
CacheIndexRecord()
|
||||
: mFrecency(0),
|
||||
mOriginAttrsHash(0),
|
||||
mOnStartTime(kIndexTimeNotAvailable),
|
||||
mOnStopTime(kIndexTimeNotAvailable),
|
||||
mContentType(nsICacheEntry::CONTENT_TYPE_UNKNOWN),
|
||||
mFlags(0) {}
|
||||
CacheIndexRecord() = default;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
@ -491,20 +485,7 @@ class CacheIndexEntryUpdate : public CacheIndexEntry {
|
|||
|
||||
class CacheIndexStats {
|
||||
public:
|
||||
CacheIndexStats()
|
||||
: mCount(0),
|
||||
mNotInitialized(0),
|
||||
mRemoved(0),
|
||||
mDirty(0),
|
||||
mFresh(0),
|
||||
mEmpty(0),
|
||||
mSize(0)
|
||||
#ifdef DEBUG
|
||||
,
|
||||
mStateLogged(false),
|
||||
mDisableLogging(false)
|
||||
#endif
|
||||
{
|
||||
CacheIndexStats() {
|
||||
for (uint32_t i = 0; i < nsICacheEntry::CONTENT_TYPE_LAST; ++i) {
|
||||
mCountByType[i] = 0;
|
||||
mSizeByType[i] = 0;
|
||||
|
@ -689,14 +670,14 @@ class CacheIndexStats {
|
|||
}
|
||||
|
||||
private:
|
||||
uint32_t mCount;
|
||||
uint32_t mCount{0};
|
||||
uint32_t mCountByType[nsICacheEntry::CONTENT_TYPE_LAST]{0};
|
||||
uint32_t mNotInitialized;
|
||||
uint32_t mRemoved;
|
||||
uint32_t mDirty;
|
||||
uint32_t mFresh;
|
||||
uint32_t mEmpty;
|
||||
uint32_t mSize;
|
||||
uint32_t mNotInitialized{0};
|
||||
uint32_t mRemoved{0};
|
||||
uint32_t mDirty{0};
|
||||
uint32_t mFresh{0};
|
||||
uint32_t mEmpty{0};
|
||||
uint32_t mSize{0};
|
||||
uint32_t mSizeByType[nsICacheEntry::CONTENT_TYPE_LAST]{0};
|
||||
#ifdef DEBUG
|
||||
// We completely remove the data about an entry from the stats in
|
||||
|
@ -704,10 +685,10 @@ class CacheIndexStats {
|
|||
// deleted or created and the data is again put into the stats and this flag
|
||||
// set to false. Statistics must not be read during this time since the
|
||||
// information is not correct.
|
||||
bool mStateLogged;
|
||||
bool mStateLogged{false};
|
||||
|
||||
// Disables logging in this instance of CacheIndexStats
|
||||
bool mDisableLogging;
|
||||
bool mDisableLogging{false};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -1066,35 +1047,35 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
|
|||
|
||||
nsCOMPtr<nsIFile> mCacheDirectory;
|
||||
|
||||
EState mState;
|
||||
EState mState{INITIAL};
|
||||
// Timestamp of time when the index was initialized. We use it to delay
|
||||
// initial update or build of index.
|
||||
TimeStamp mStartTime;
|
||||
// Set to true in PreShutdown(), it is checked on variaous places to prevent
|
||||
// starting any process (write, update, etc.) during shutdown.
|
||||
bool mShuttingDown;
|
||||
bool mShuttingDown{false};
|
||||
// When set to true, update process should start as soon as possible. This
|
||||
// flag is set whenever we find some inconsistency which would be fixed by
|
||||
// update process. The flag is checked always when switching to READY state.
|
||||
// To make sure we start the update process as soon as possible, methods that
|
||||
// set this flag should also call StartUpdatingIndexIfNeeded() to cover the
|
||||
// case when we are currently in READY state.
|
||||
bool mIndexNeedsUpdate;
|
||||
bool mIndexNeedsUpdate{false};
|
||||
// Set at the beginning of RemoveAll() which clears the whole index. When
|
||||
// removing all entries we must stop any pending reading, writing, updating or
|
||||
// building operation. This flag is checked at various places and it prevents
|
||||
// we won't start another operation (e.g. canceling reading of the index would
|
||||
// normally start update or build process)
|
||||
bool mRemovingAll;
|
||||
bool mRemovingAll{false};
|
||||
// Whether the index file on disk exists and is valid.
|
||||
bool mIndexOnDiskIsValid;
|
||||
bool mIndexOnDiskIsValid{false};
|
||||
// When something goes wrong during updating or building process, we don't
|
||||
// mark index clean (and also don't write journal) to ensure that update or
|
||||
// build will be initiated on the next start.
|
||||
bool mDontMarkIndexClean;
|
||||
bool mDontMarkIndexClean{false};
|
||||
// Timestamp value from index file. It is used during update process to skip
|
||||
// entries that were last modified before this timestamp.
|
||||
uint32_t mIndexTimeStamp;
|
||||
uint32_t mIndexTimeStamp{0};
|
||||
// Timestamp of last time the index was dumped to disk.
|
||||
// NOTE: The index might not be necessarily dumped at this time. The value
|
||||
// is used to schedule next dump of the index.
|
||||
|
@ -1103,28 +1084,28 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
|
|||
// Timer of delayed update/build.
|
||||
nsCOMPtr<nsITimer> mUpdateTimer;
|
||||
// True when build or update event is posted
|
||||
bool mUpdateEventPending;
|
||||
bool mUpdateEventPending{false};
|
||||
|
||||
// Helper members used when reading/writing index from/to disk.
|
||||
// Contains number of entries that should be skipped:
|
||||
// - in hashtable when writing index because they were already written
|
||||
// - in index file when reading index because they were already read
|
||||
uint32_t mSkipEntries;
|
||||
uint32_t mSkipEntries{0};
|
||||
// Number of entries that should be written to disk. This is number of entries
|
||||
// in hashtable that are initialized and are not marked as removed when
|
||||
// writing begins.
|
||||
uint32_t mProcessEntries;
|
||||
char* mRWBuf;
|
||||
uint32_t mRWBufSize;
|
||||
uint32_t mRWBufPos;
|
||||
uint32_t mProcessEntries{0};
|
||||
char* mRWBuf{nullptr};
|
||||
uint32_t mRWBufSize{0};
|
||||
uint32_t mRWBufPos{0};
|
||||
RefPtr<CacheHash> mRWHash;
|
||||
|
||||
// True if read or write operation is pending. It is used to ensure that
|
||||
// mRWBuf is not freed until OnDataRead or OnDataWritten is called.
|
||||
bool mRWPending;
|
||||
bool mRWPending{false};
|
||||
|
||||
// Reading of journal succeeded if true.
|
||||
bool mJournalReadSuccessfully;
|
||||
bool mJournalReadSuccessfully{false};
|
||||
|
||||
// Handle used for writing and reading index file.
|
||||
RefPtr<CacheFileHandle> mIndexHandle;
|
||||
|
@ -1197,7 +1178,7 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
|
|||
public:
|
||||
Iterator Iter() { return Iterator(&mRecs); }
|
||||
|
||||
FrecencyArray() : mUnsortedElements(0), mRemovedElements(0) {}
|
||||
FrecencyArray() = default;
|
||||
|
||||
// Methods used by CacheIndexEntryAutoManage to keep the array up to date.
|
||||
void AppendRecord(CacheIndexRecordWrapper* aRecord);
|
||||
|
@ -1213,12 +1194,12 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
|
|||
friend class CacheIndex;
|
||||
|
||||
nsTArray<RefPtr<CacheIndexRecordWrapper>> mRecs;
|
||||
uint32_t mUnsortedElements;
|
||||
uint32_t mUnsortedElements{0};
|
||||
// Instead of removing elements from the array immediately, we null them out
|
||||
// and the iterator skips them when accessing the array. The null pointers
|
||||
// are placed at the end during sorting and we strip them out all at once.
|
||||
// This saves moving a lot of memory in nsTArray::RemoveElementsAt.
|
||||
uint32_t mRemovedElements;
|
||||
uint32_t mRemovedElements{0};
|
||||
};
|
||||
|
||||
FrecencyArray mFrecencyArray;
|
||||
|
@ -1228,7 +1209,7 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
|
|||
// This flag is true iff we are between CacheStorageService:Clear() and
|
||||
// processing all contexts to be evicted. It will make UI to show
|
||||
// "calculating" instead of any intermediate cache size.
|
||||
bool mAsyncGetDiskConsumptionBlocked;
|
||||
bool mAsyncGetDiskConsumptionBlocked{false};
|
||||
|
||||
class DiskConsumptionObserver : public Runnable {
|
||||
public:
|
||||
|
@ -1280,7 +1261,7 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
|
|||
nsTArray<RefPtr<DiskConsumptionObserver>> mDiskConsumptionObservers;
|
||||
|
||||
// Number of bytes written to the cache since the last telemetry report
|
||||
uint64_t mTotalBytesWritten;
|
||||
uint64_t mTotalBytesWritten{0};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -397,8 +397,7 @@ class CacheStorageService final : public nsICacheStorageService,
|
|||
public:
|
||||
IOThreadSuspender()
|
||||
: Runnable("net::CacheStorageService::IOThreadSuspender"),
|
||||
mMon("IOThreadSuspender"),
|
||||
mSignaled(false) {}
|
||||
mMon("IOThreadSuspender") {}
|
||||
void Notify();
|
||||
|
||||
private:
|
||||
|
@ -406,7 +405,7 @@ class CacheStorageService final : public nsICacheStorageService,
|
|||
NS_IMETHOD Run() override;
|
||||
|
||||
Monitor mMon;
|
||||
bool mSignaled;
|
||||
bool mSignaled{false};
|
||||
};
|
||||
|
||||
RefPtr<IOThreadSuspender> mActiveIOSuspender;
|
||||
|
|
|
@ -108,16 +108,6 @@ size_t CookieEntry::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const {
|
|||
|
||||
NS_IMPL_ISUPPORTS(CookieStorage, nsIObserver, nsISupportsWeakReference)
|
||||
|
||||
CookieStorage::CookieStorage()
|
||||
: mCookieCount(0),
|
||||
mCookieOldestTime(INT64_MAX),
|
||||
mMaxNumberOfCookies(kMaxNumberOfCookies),
|
||||
mMaxCookiesPerHost(kMaxCookiesPerHost),
|
||||
mCookieQuotaPerHost(kCookieQuotaPerHost),
|
||||
mCookiePurgeAge(kCookiePurgeAge) {}
|
||||
|
||||
CookieStorage::~CookieStorage() = default;
|
||||
|
||||
void CookieStorage::Init() {
|
||||
// init our pref and observer
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "nsTHashtable.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include <functional>
|
||||
#include "CookieCommons.h"
|
||||
|
||||
class nsIArray;
|
||||
class nsICookie;
|
||||
|
@ -127,8 +128,8 @@ class CookieStorage : public nsIObserver, public nsSupportsWeakReference {
|
|||
virtual void Close() = 0;
|
||||
|
||||
protected:
|
||||
CookieStorage();
|
||||
virtual ~CookieStorage();
|
||||
CookieStorage() = default;
|
||||
virtual ~CookieStorage() = default;
|
||||
|
||||
void Init();
|
||||
|
||||
|
@ -163,7 +164,7 @@ class CookieStorage : public nsIObserver, public nsSupportsWeakReference {
|
|||
|
||||
nsTHashtable<CookieEntry> mHostTable;
|
||||
|
||||
uint32_t mCookieCount;
|
||||
uint32_t mCookieCount{0};
|
||||
|
||||
private:
|
||||
void PrefChanged(nsIPrefBranch* aPrefBranch);
|
||||
|
@ -187,12 +188,12 @@ class CookieStorage : public nsIObserver, public nsSupportsWeakReference {
|
|||
uint16_t aMaxNumberOfCookies,
|
||||
int64_t aCookiePurgeAge) = 0;
|
||||
|
||||
int64_t mCookieOldestTime;
|
||||
int64_t mCookieOldestTime{INT64_MAX};
|
||||
|
||||
uint16_t mMaxNumberOfCookies;
|
||||
uint16_t mMaxCookiesPerHost;
|
||||
uint16_t mCookieQuotaPerHost;
|
||||
int64_t mCookiePurgeAge;
|
||||
uint16_t mMaxNumberOfCookies{kMaxNumberOfCookies};
|
||||
uint16_t mMaxCookiesPerHost{kMaxCookiesPerHost};
|
||||
uint16_t mCookieQuotaPerHost{kCookieQuotaPerHost};
|
||||
int64_t mCookiePurgeAge{kCookiePurgeAge};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -81,10 +81,7 @@ TRR::TRR(AHostResolver* aResolver, nsHostRecord* aRec, nsCString& aHost,
|
|||
|
||||
// used on push
|
||||
TRR::TRR(AHostResolver* aResolver, bool aPB)
|
||||
: mozilla::Runnable("TRR"),
|
||||
mHostResolver(aResolver),
|
||||
mType(TRRTYPE_A),
|
||||
mPB(aPB) {
|
||||
: mozilla::Runnable("TRR"), mHostResolver(aResolver), mPB(aPB) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess() || XRE_IsSocketProcess(),
|
||||
"TRR must be in parent or socket process");
|
||||
}
|
||||
|
|
|
@ -50,9 +50,6 @@ InputChannelThrottleQueueParent::Release(void) {
|
|||
return count;
|
||||
}
|
||||
|
||||
InputChannelThrottleQueueParent::InputChannelThrottleQueueParent()
|
||||
: mBytesProcessed(0), mMeanBytesPerSecond(0), mMaxBytesPerSecond(0) {}
|
||||
|
||||
mozilla::ipc::IPCResult InputChannelThrottleQueueParent::RecvRecordRead(
|
||||
const uint32_t& aBytesRead) {
|
||||
mBytesProcessed += aBytesRead;
|
||||
|
|
|
@ -30,16 +30,16 @@ class InputChannelThrottleQueueParent final
|
|||
|
||||
friend class PInputChannelThrottleQueueParent;
|
||||
|
||||
explicit InputChannelThrottleQueueParent();
|
||||
explicit InputChannelThrottleQueueParent() = default;
|
||||
mozilla::ipc::IPCResult RecvRecordRead(const uint32_t& aBytesRead);
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override {}
|
||||
|
||||
private:
|
||||
virtual ~InputChannelThrottleQueueParent() = default;
|
||||
|
||||
uint64_t mBytesProcessed;
|
||||
uint32_t mMeanBytesPerSecond;
|
||||
uint32_t mMaxBytesPerSecond;
|
||||
uint64_t mBytesProcessed{0};
|
||||
uint32_t mMeanBytesPerSecond{0};
|
||||
uint32_t mMaxBytesPerSecond{0};
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(InputChannelThrottleQueueParent,
|
||||
|
|
|
@ -72,8 +72,7 @@ using namespace ipc;
|
|||
|
||||
SocketProcessChild* sSocketProcessChild;
|
||||
|
||||
SocketProcessChild::SocketProcessChild()
|
||||
: mShuttingDown(false), mMutex("SocketProcessChild::mMutex") {
|
||||
SocketProcessChild::SocketProcessChild() {
|
||||
LOG(("CONSTRUCT SocketProcessChild::SocketProcessChild\n"));
|
||||
nsDebugImpl::SetMultiprocessMode("Socket");
|
||||
|
||||
|
|
|
@ -155,9 +155,9 @@ class SocketProcessChild final
|
|||
RefPtr<ChildProfilerController> mProfilerController;
|
||||
#endif
|
||||
|
||||
bool mShuttingDown;
|
||||
bool mShuttingDown{false};
|
||||
// Protect the table below.
|
||||
Mutex mMutex;
|
||||
Mutex mMutex{"SocketProcessChild::mMutex"};
|
||||
nsTHashMap<uint64_t, RefPtr<BackgroundDataBridgeParent>>
|
||||
mBackgroundDataBridgeMap;
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@ class nsAboutCacheEntry final : public nsIAboutModule {
|
|||
NS_FORWARD_SAFE_NSICHANNEL(mChannel)
|
||||
NS_FORWARD_SAFE_NSIREQUEST(mChannel)
|
||||
|
||||
Channel() : mBuffer(nullptr), mWaitingForData(false), mHexDumpState(0) {}
|
||||
Channel() = default;
|
||||
|
||||
private:
|
||||
virtual ~Channel() = default;
|
||||
|
@ -66,10 +66,10 @@ class nsAboutCacheEntry final : public nsIAboutModule {
|
|||
nsCOMPtr<nsILoadContextInfo> mLoadInfo;
|
||||
nsCOMPtr<nsIURI> mCacheURI;
|
||||
|
||||
nsCString* mBuffer;
|
||||
nsCString* mBuffer{nullptr};
|
||||
nsCOMPtr<nsIAsyncOutputStream> mOutputStream;
|
||||
bool mWaitingForData;
|
||||
uint32_t mHexDumpState;
|
||||
bool mWaitingForData{false};
|
||||
uint32_t mHexDumpState{0};
|
||||
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
};
|
||||
|
|
|
@ -31,13 +31,7 @@ namespace mozilla {
|
|||
namespace net {
|
||||
|
||||
GIOChannelChild::GIOChannelChild(nsIURI* aUri)
|
||||
: mIPCOpen(false),
|
||||
mEventQ(new ChannelEventQueue(static_cast<nsIChildChannel*>(this))),
|
||||
mCanceled(false),
|
||||
mSuspendCount(0),
|
||||
mIsPending(false),
|
||||
mStartPos(0),
|
||||
mSuspendSent(false) {
|
||||
: mEventQ(new ChannelEventQueue(static_cast<nsIChildChannel*>(this))) {
|
||||
SetURI(aUri);
|
||||
// We could support thread retargeting, but as long as we're being driven by
|
||||
// IPDL on the main thread it doesn't buy us anything.
|
||||
|
|
|
@ -86,19 +86,20 @@ class GIOChannelChild final : public PGIOChannelChild,
|
|||
private:
|
||||
nsCOMPtr<nsIInputStream> mUploadStream;
|
||||
|
||||
bool mIPCOpen;
|
||||
bool mIPCOpen = false;
|
||||
const RefPtr<ChannelEventQueue> mEventQ;
|
||||
|
||||
bool mCanceled = false;
|
||||
uint32_t mSuspendCount;
|
||||
uint32_t mSuspendCount = 0;
|
||||
;
|
||||
bool mIsPending = false;
|
||||
|
||||
uint64_t mStartPos;
|
||||
uint64_t mStartPos = 0;
|
||||
nsCString mEntityID;
|
||||
|
||||
// Set if SendSuspend is called. Determines if SendResume is needed when
|
||||
// diverting callbacks to parent.
|
||||
bool mSuspendSent;
|
||||
bool mSuspendSent = false;
|
||||
};
|
||||
|
||||
inline bool GIOChannelChild::IsSuspended() const { return mSuspendCount != 0; }
|
||||
|
|
|
@ -346,16 +346,7 @@ ExtensionProtocolHandler::GetSingleton() {
|
|||
}
|
||||
|
||||
ExtensionProtocolHandler::ExtensionProtocolHandler()
|
||||
: SubstitutingProtocolHandler(EXTENSION_SCHEME)
|
||||
#if !defined(XP_WIN)
|
||||
# if defined(XP_MACOSX)
|
||||
,
|
||||
mAlreadyCheckedDevRepo(false)
|
||||
# endif /* XP_MACOSX */
|
||||
,
|
||||
mAlreadyCheckedAppDir(false)
|
||||
#endif /* ! XP_WIN */
|
||||
{
|
||||
: SubstitutingProtocolHandler(EXTENSION_SCHEME) {
|
||||
// Note, extensions.webextensions.protocol.remote=false is for
|
||||
// debugging purposes only. With process-level sandboxing, child
|
||||
// processes (specifically content and extension processes), will
|
||||
|
|
|
@ -189,7 +189,7 @@ class ExtensionProtocolHandler final
|
|||
|
||||
// Set to true once we've already tried to load the dev repo path,
|
||||
// allowing for lazy initialization of |mDevRepo|.
|
||||
bool mAlreadyCheckedDevRepo;
|
||||
bool mAlreadyCheckedDevRepo{false};
|
||||
#endif /* XP_MACOSX */
|
||||
|
||||
#if !defined(XP_WIN)
|
||||
|
@ -214,7 +214,7 @@ class ExtensionProtocolHandler final
|
|||
|
||||
// Set to true once we've already read the AppDir, allowing for lazy
|
||||
// initialization of |mAppDir|.
|
||||
bool mAlreadyCheckedAppDir;
|
||||
bool mAlreadyCheckedAppDir{false};
|
||||
#endif /* !defined(XP_WIN) */
|
||||
|
||||
// Used for opening JAR files off the main thread when we just need to
|
||||
|
|
|
@ -49,8 +49,7 @@ class nsViewSourceChannel final : public nsIViewSourceChannel,
|
|||
NS_FORWARD_SAFE_NSIHTTPCHANNELINTERNAL(mHttpChannelInternal)
|
||||
|
||||
// nsViewSourceChannel methods:
|
||||
nsViewSourceChannel()
|
||||
: mIsDocument(false), mOpened(false), mIsSrcdocChannel(false) {}
|
||||
nsViewSourceChannel() = default;
|
||||
|
||||
[[nodiscard]] nsresult Init(nsIURI* uri, nsILoadInfo* aLoadInfo);
|
||||
|
||||
|
@ -91,9 +90,9 @@ class nsViewSourceChannel final : public nsIViewSourceChannel,
|
|||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
nsCString mContentType;
|
||||
bool mIsDocument; // keeps track of the LOAD_DOCUMENT_URI flag
|
||||
bool mOpened;
|
||||
bool mIsSrcdocChannel;
|
||||
bool mIsDocument{false}; // keeps track of the LOAD_DOCUMENT_URI flag
|
||||
bool mOpened{false};
|
||||
bool mIsSrcdocChannel{false};
|
||||
};
|
||||
|
||||
#endif /* nsViewSourceChannel_h___ */
|
||||
|
|
|
@ -68,14 +68,11 @@ WebSocketFrame::GetPayload(nsACString& aValue) {
|
|||
}
|
||||
|
||||
WebSocketFrameData::WebSocketFrameData()
|
||||
: mTimeStamp(0),
|
||||
mFinBit(false),
|
||||
: mFinBit(false),
|
||||
mRsvBit1(false),
|
||||
mRsvBit2(false),
|
||||
mRsvBit3(false),
|
||||
mMaskBit(false),
|
||||
mOpCode(0),
|
||||
mMask(0) {
|
||||
mMaskBit(false) {
|
||||
MOZ_COUNT_CTOR(WebSocketFrameData);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,16 +44,16 @@ class WebSocketFrameData final {
|
|||
void WriteIPCParams(IPC::Message* aMessage) const;
|
||||
bool ReadIPCParams(const IPC::Message* aMessage, PickleIterator* aIter);
|
||||
|
||||
DOMHighResTimeStamp mTimeStamp;
|
||||
DOMHighResTimeStamp mTimeStamp{0};
|
||||
|
||||
bool mFinBit : 1;
|
||||
bool mRsvBit1 : 1;
|
||||
bool mRsvBit2 : 1;
|
||||
bool mRsvBit3 : 1;
|
||||
bool mMaskBit : 1;
|
||||
uint8_t mOpCode;
|
||||
uint8_t mOpCode{0};
|
||||
|
||||
uint32_t mMask;
|
||||
uint32_t mMask{0};
|
||||
|
||||
nsCString mPayload;
|
||||
};
|
||||
|
|
|
@ -188,61 +188,31 @@ class nsSOCKSSocketInfo : public nsISOCKSSocketInfo, public nsIDNSListener {
|
|||
}
|
||||
|
||||
private:
|
||||
State mState;
|
||||
uint8_t* mData;
|
||||
uint8_t* mDataIoPtr;
|
||||
uint32_t mDataLength;
|
||||
uint32_t mReadOffset;
|
||||
uint32_t mAmountToRead;
|
||||
State mState{SOCKS_INITIAL};
|
||||
uint8_t* mData{nullptr};
|
||||
uint8_t* mDataIoPtr{nullptr};
|
||||
uint32_t mDataLength{0};
|
||||
uint32_t mReadOffset{0};
|
||||
uint32_t mAmountToRead{0};
|
||||
nsCOMPtr<nsIDNSRecord> mDnsRec;
|
||||
nsCOMPtr<nsICancelable> mLookup;
|
||||
nsresult mLookupStatus;
|
||||
PRFileDesc* mFD;
|
||||
nsresult mLookupStatus{NS_ERROR_NOT_INITIALIZED};
|
||||
PRFileDesc* mFD{nullptr};
|
||||
|
||||
nsCString mDestinationHost;
|
||||
nsCOMPtr<nsIProxyInfo> mProxy;
|
||||
int32_t mVersion; // SOCKS version 4 or 5
|
||||
int32_t mDestinationFamily;
|
||||
uint32_t mFlags;
|
||||
uint32_t mTlsFlags;
|
||||
int32_t mVersion{-1}; // SOCKS version 4 or 5
|
||||
int32_t mDestinationFamily{AF_INET};
|
||||
uint32_t mFlags{0};
|
||||
uint32_t mTlsFlags{0};
|
||||
NetAddr mInternalProxyAddr;
|
||||
NetAddr mExternalProxyAddr;
|
||||
NetAddr mDestinationAddr;
|
||||
PRIntervalTime mTimeout;
|
||||
PRIntervalTime mTimeout{PR_INTERVAL_NO_TIMEOUT};
|
||||
nsCString mProxyUsername; // Cache, from mProxy
|
||||
};
|
||||
|
||||
nsSOCKSSocketInfo::nsSOCKSSocketInfo()
|
||||
: mState(SOCKS_INITIAL),
|
||||
mDataIoPtr(nullptr),
|
||||
mDataLength(0),
|
||||
mReadOffset(0),
|
||||
mAmountToRead(0),
|
||||
mLookupStatus(NS_ERROR_NOT_INITIALIZED),
|
||||
mFD(nullptr),
|
||||
mVersion(-1),
|
||||
mDestinationFamily(AF_INET),
|
||||
mFlags(0),
|
||||
mTlsFlags(0),
|
||||
mTimeout(PR_INTERVAL_NO_TIMEOUT) {
|
||||
this->mInternalProxyAddr.inet.family = 0;
|
||||
this->mInternalProxyAddr.inet6.family = 0;
|
||||
this->mInternalProxyAddr.inet6.port = 0;
|
||||
this->mInternalProxyAddr.inet6.flowinfo = 0;
|
||||
this->mInternalProxyAddr.inet6.scope_id = 0;
|
||||
this->mInternalProxyAddr.local.family = 0;
|
||||
this->mExternalProxyAddr.inet.family = 0;
|
||||
this->mExternalProxyAddr.inet6.family = 0;
|
||||
this->mExternalProxyAddr.inet6.port = 0;
|
||||
this->mExternalProxyAddr.inet6.flowinfo = 0;
|
||||
this->mExternalProxyAddr.inet6.scope_id = 0;
|
||||
this->mExternalProxyAddr.local.family = 0;
|
||||
this->mDestinationAddr.inet.family = 0;
|
||||
this->mDestinationAddr.inet6.family = 0;
|
||||
this->mDestinationAddr.inet6.port = 0;
|
||||
this->mDestinationAddr.inet6.flowinfo = 0;
|
||||
this->mDestinationAddr.inet6.scope_id = 0;
|
||||
this->mDestinationAddr.local.family = 0;
|
||||
nsSOCKSSocketInfo::nsSOCKSSocketInfo() {
|
||||
mData = new uint8_t[BUFFER_SIZE];
|
||||
|
||||
mInternalProxyAddr.raw.family = AF_INET;
|
||||
|
@ -290,7 +260,7 @@ nsSOCKSSocketInfo::nsSOCKSSocketInfo()
|
|||
template <size_t Size>
|
||||
class Buffer {
|
||||
public:
|
||||
Buffer() : mBuf(nullptr), mLength(0) {}
|
||||
Buffer() = default;
|
||||
|
||||
explicit Buffer(uint8_t* aBuf, size_t aLength = 0)
|
||||
: mBuf(aBuf), mLength(aLength) {}
|
||||
|
@ -364,8 +334,8 @@ class Buffer {
|
|||
return result;
|
||||
}
|
||||
|
||||
uint8_t* mBuf;
|
||||
size_t mLength;
|
||||
uint8_t* mBuf{nullptr};
|
||||
size_t mLength{0};
|
||||
};
|
||||
|
||||
void nsSOCKSSocketInfo::Init(int32_t version, int32_t family,
|
||||
|
@ -803,11 +773,10 @@ PRStatus nsSOCKSSocketInfo::ReadV5AuthResponse() {
|
|||
if (!mProxyUsername.IsEmpty() && authMethod == 0x02) { // username/pw
|
||||
LOGDEBUG(("socks5: auth method accepted by server"));
|
||||
return WriteV5UsernameRequest();
|
||||
} else { // 0xFF signals error
|
||||
LOGERROR(("socks5: server did not accept our authentication method"));
|
||||
HandshakeFinished(PR_CONNECT_REFUSED_ERROR);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
} // 0xFF signals error
|
||||
LOGERROR(("socks5: server did not accept our authentication method"));
|
||||
HandshakeFinished(PR_CONNECT_REFUSED_ERROR);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PRStatus nsSOCKSSocketInfo::WriteV5UsernameRequest() {
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
|
||||
NS_IMPL_ISUPPORTS(nsDirIndex, nsIDirIndex)
|
||||
|
||||
nsDirIndex::nsDirIndex()
|
||||
: mType(TYPE_UNKNOWN), mSize(UINT64_MAX), mLastModified(-1LL) {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirIndex::GetType(uint32_t* aType) {
|
||||
NS_ENSURE_ARG_POINTER(aType);
|
||||
|
|
|
@ -15,18 +15,18 @@ class nsDirIndex final : public nsIDirIndex {
|
|||
~nsDirIndex() = default;
|
||||
|
||||
public:
|
||||
nsDirIndex();
|
||||
nsDirIndex() = default;
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDIRINDEX
|
||||
|
||||
protected:
|
||||
uint32_t mType;
|
||||
uint32_t mType{TYPE_UNKNOWN};
|
||||
nsCString mContentType;
|
||||
nsCString mLocation;
|
||||
nsString mDescription;
|
||||
int64_t mSize;
|
||||
PRTime mLastModified;
|
||||
int64_t mSize{INT64_MAX};
|
||||
PRTime mLastModified{-1LL};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче