Loading startupcache/StartupCache.cpp +4 −17 Original line number Diff line number Diff line Loading @@ -197,6 +197,7 @@ nsresult StartupCache::FullyInitSingleton() { StaticRefPtr<StartupCache> StartupCache::gStartupCache; ProcessType sProcessType; bool StartupCache::gShutdownInitiated; bool StartupCache::gIgnoreDiskCache; bool StartupCache::gFoundDiskCacheOnInit; Loading @@ -206,7 +207,6 @@ StartupCache::StartupCache() : mLock("StartupCache::mLock"), mDirty(false), mWrittenOnce(false), mStartupFinished(false), mCurTableReferenced(false), mLoaded(false), mFullyInitialized(false), Loading Loading @@ -822,10 +822,6 @@ Result<Ok, nsresult> StartupCache::DecompressEntry(StartupCacheEntry& aEntry) { bool StartupCache::HasEntry(const char* id) { AUTO_PROFILER_LABEL("StartupCache::HasEntry", OTHER); if (mStartupFinished) { return false; } MutexAutoLock lock(mLock); MOZ_ASSERT( Loading @@ -841,12 +837,6 @@ nsresult StartupCache::GetBuffer(const char* id, const char** outbuf, auto telemetry = MakeScopeExit([&label] { Telemetry::AccumulateCategorical(label); }); // Exit here, ensuring we collect a cache miss for telemetry, but before we // lock. No need to potentially hang waiting on the write thread. if (mStartupFinished) { return NS_ERROR_NOT_AVAILABLE; } MutexAutoLock lock(mLock); if (!mLoaded) { return NS_ERROR_NOT_AVAILABLE; Loading Loading @@ -915,7 +905,7 @@ nsresult StartupCache::GetBuffer(const char* id, const char** outbuf, // Client gives ownership of inbuf. nsresult StartupCache::PutBuffer(const char* id, UniquePtr<char[]>&& inbuf, uint32_t len, bool isFromChildProcess) { if (mStartupFinished) { if (StartupCache::gShutdownInitiated) { return NS_ERROR_NOT_AVAILABLE; } Loading Loading @@ -1249,6 +1239,7 @@ void StartupCache::MaybeInitShutdownWrite() { if (mWriteTimer) { mWriteTimer->Cancel(); } gShutdownInitiated = true; MaybeWriteOffMainThread(); } Loading Loading @@ -1357,11 +1348,6 @@ void StartupCache::MaybeWriteOffMainThread() { return; } // If we're scheduling the cache to be written, then whether it's because // we're shutting down, or because our write timer has finished, it's safe // to say that we shouldn't think of ourselves as "starting up" anymore. mStartupFinished = true; if (mWrittenOnce) { return; } Loading Loading @@ -1396,6 +1382,7 @@ nsresult StartupCacheListener::Observe(nsISupports* subject, const char* topic, if (strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { // Do not leave the thread running past xpcom shutdown sc->WaitOnPrefetchThread(); StartupCache::gShutdownInitiated = true; // Note that we don't do anything special for the background write // task; we expect the threadpool to finish running any tasks already // posted to it prior to shutdown. FastShutdown will call Loading startupcache/StartupCache.h +1 −1 Original line number Diff line number Diff line Loading @@ -438,7 +438,6 @@ class StartupCache : public nsIMemoryReporter { Atomic<bool> mDirty; Atomic<bool> mWrittenOnce; Atomic<bool> mStartupFinished; bool mCurTableReferenced; bool mLoaded; bool mFullyInitialized; Loading @@ -448,6 +447,7 @@ class StartupCache : public nsIMemoryReporter { size_t mCacheEntriesBaseOffset; static StaticRefPtr<StartupCache> gStartupCache; static bool gShutdownInitiated; static bool gIgnoreDiskCache; static bool gFoundDiskCacheOnInit; Loading Loading
startupcache/StartupCache.cpp +4 −17 Original line number Diff line number Diff line Loading @@ -197,6 +197,7 @@ nsresult StartupCache::FullyInitSingleton() { StaticRefPtr<StartupCache> StartupCache::gStartupCache; ProcessType sProcessType; bool StartupCache::gShutdownInitiated; bool StartupCache::gIgnoreDiskCache; bool StartupCache::gFoundDiskCacheOnInit; Loading @@ -206,7 +207,6 @@ StartupCache::StartupCache() : mLock("StartupCache::mLock"), mDirty(false), mWrittenOnce(false), mStartupFinished(false), mCurTableReferenced(false), mLoaded(false), mFullyInitialized(false), Loading Loading @@ -822,10 +822,6 @@ Result<Ok, nsresult> StartupCache::DecompressEntry(StartupCacheEntry& aEntry) { bool StartupCache::HasEntry(const char* id) { AUTO_PROFILER_LABEL("StartupCache::HasEntry", OTHER); if (mStartupFinished) { return false; } MutexAutoLock lock(mLock); MOZ_ASSERT( Loading @@ -841,12 +837,6 @@ nsresult StartupCache::GetBuffer(const char* id, const char** outbuf, auto telemetry = MakeScopeExit([&label] { Telemetry::AccumulateCategorical(label); }); // Exit here, ensuring we collect a cache miss for telemetry, but before we // lock. No need to potentially hang waiting on the write thread. if (mStartupFinished) { return NS_ERROR_NOT_AVAILABLE; } MutexAutoLock lock(mLock); if (!mLoaded) { return NS_ERROR_NOT_AVAILABLE; Loading Loading @@ -915,7 +905,7 @@ nsresult StartupCache::GetBuffer(const char* id, const char** outbuf, // Client gives ownership of inbuf. nsresult StartupCache::PutBuffer(const char* id, UniquePtr<char[]>&& inbuf, uint32_t len, bool isFromChildProcess) { if (mStartupFinished) { if (StartupCache::gShutdownInitiated) { return NS_ERROR_NOT_AVAILABLE; } Loading Loading @@ -1249,6 +1239,7 @@ void StartupCache::MaybeInitShutdownWrite() { if (mWriteTimer) { mWriteTimer->Cancel(); } gShutdownInitiated = true; MaybeWriteOffMainThread(); } Loading Loading @@ -1357,11 +1348,6 @@ void StartupCache::MaybeWriteOffMainThread() { return; } // If we're scheduling the cache to be written, then whether it's because // we're shutting down, or because our write timer has finished, it's safe // to say that we shouldn't think of ourselves as "starting up" anymore. mStartupFinished = true; if (mWrittenOnce) { return; } Loading Loading @@ -1396,6 +1382,7 @@ nsresult StartupCacheListener::Observe(nsISupports* subject, const char* topic, if (strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { // Do not leave the thread running past xpcom shutdown sc->WaitOnPrefetchThread(); StartupCache::gShutdownInitiated = true; // Note that we don't do anything special for the background write // task; we expect the threadpool to finish running any tasks already // posted to it prior to shutdown. FastShutdown will call Loading
startupcache/StartupCache.h +1 −1 Original line number Diff line number Diff line Loading @@ -438,7 +438,6 @@ class StartupCache : public nsIMemoryReporter { Atomic<bool> mDirty; Atomic<bool> mWrittenOnce; Atomic<bool> mStartupFinished; bool mCurTableReferenced; bool mLoaded; bool mFullyInitialized; Loading @@ -448,6 +447,7 @@ class StartupCache : public nsIMemoryReporter { size_t mCacheEntriesBaseOffset; static StaticRefPtr<StartupCache> gStartupCache; static bool gShutdownInitiated; static bool gIgnoreDiskCache; static bool gFoundDiskCacheOnInit; Loading