зеркало из https://github.com/mozilla/gecko-dev.git
Bug 936964 (part 1) - Make StartupCache ref-counted. r=aklotz.
--HG-- extra : rebase_source : 8693264a4347938dde6532730a5bc730384edf51
This commit is contained in:
Родитель
19f2e8fdea
Коммит
7b367571d4
|
@ -110,7 +110,6 @@ StartupCache::GetSingleton()
|
|||
void
|
||||
StartupCache::DeleteSingleton()
|
||||
{
|
||||
delete StartupCache::gStartupCache;
|
||||
StartupCache::gStartupCache = nullptr;
|
||||
}
|
||||
|
||||
|
@ -122,17 +121,18 @@ StartupCache::InitSingleton()
|
|||
|
||||
rv = StartupCache::gStartupCache->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete StartupCache::gStartupCache;
|
||||
StartupCache::gStartupCache = nullptr;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
StartupCache* StartupCache::gStartupCache;
|
||||
StaticRefPtr<StartupCache> StartupCache::gStartupCache;
|
||||
bool StartupCache::gShutdownInitiated;
|
||||
bool StartupCache::gIgnoreDiskCache;
|
||||
enum StartupCache::TelemetrifyAge StartupCache::gPostFlushAgeAction = StartupCache::IGNORE_AGE;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(StartupCache, nsISupports)
|
||||
|
||||
StartupCache::StartupCache()
|
||||
: mArchive(nullptr), mStartupWriteInitiated(false), mWriteThread(nullptr)
|
||||
{ }
|
||||
|
@ -156,7 +156,6 @@ StartupCache::~StartupCache()
|
|||
WriteToDisk();
|
||||
}
|
||||
|
||||
gStartupCache = nullptr;
|
||||
NS_UnregisterMemoryReporter(mMappingReporter);
|
||||
NS_UnregisterMemoryReporter(mDataReporter);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsIFile.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
|
||||
class nsIMemoryReporter;
|
||||
|
||||
|
@ -67,6 +68,7 @@ class nsIMemoryReporter;
|
|||
*/
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace scache {
|
||||
|
||||
struct CacheEntry
|
||||
|
@ -96,13 +98,14 @@ class StartupCacheListener MOZ_FINAL : public nsIObserver
|
|||
NS_DECL_NSIOBSERVER
|
||||
};
|
||||
|
||||
class StartupCache
|
||||
class StartupCache : public nsISupports
|
||||
{
|
||||
|
||||
friend class StartupCacheListener;
|
||||
friend class StartupCacheWrapper;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// StartupCache methods. See above comments for a more detailed description.
|
||||
|
||||
|
@ -136,7 +139,7 @@ public:
|
|||
|
||||
private:
|
||||
StartupCache();
|
||||
~StartupCache();
|
||||
virtual ~StartupCache();
|
||||
|
||||
enum TelemetrifyAge {
|
||||
IGNORE_AGE = 0,
|
||||
|
@ -169,7 +172,7 @@ private:
|
|||
|
||||
bool mStartupWriteInitiated;
|
||||
|
||||
static StartupCache *gStartupCache;
|
||||
static StaticRefPtr<StartupCache> gStartupCache;
|
||||
static bool gShutdownInitiated;
|
||||
static bool gIgnoreDiskCache;
|
||||
PRThread *mWriteThread;
|
||||
|
|
Загрузка…
Ссылка в новой задаче