Bug 711297 - add recordAgesAlways method to nsIStartupCache; r=mwu

This commit is contained in:
Nathan Froyd
2012-02-22 14:07:18 -05:00
parent b78702f85e
commit 1aa812be76
3 changed files with 24 additions and 3 deletions

View File

@@ -154,6 +154,7 @@ StartupCache::InitSingleton()
StartupCache* StartupCache::gStartupCache;
bool StartupCache::gShutdownInitiated;
enum StartupCache::TelemetrifyAge StartupCache::gPostFlushAgeAction = StartupCache::IGNORE_AGE;
StartupCache::StartupCache()
: mArchive(NULL), mStartupWriteInitiated(false), mWriteThread(NULL),
@@ -494,7 +495,7 @@ StartupCache::WriteToDisk()
zipW->Close();
// Our reader's view of the archive is outdated now, reload it.
LoadArchive(IGNORE_AGE);
LoadArchive(gPostFlushAgeAction);
return;
}
@@ -506,7 +507,7 @@ StartupCache::InvalidateCache()
mTable.Clear();
mArchive = NULL;
mFile->Remove(false);
LoadArchive(IGNORE_AGE);
LoadArchive(gPostFlushAgeAction);
}
/*
@@ -602,6 +603,13 @@ StartupCache::ResetStartupWriteTimer()
return NS_OK;
}
nsresult
StartupCache::RecordAgesAlways()
{
gPostFlushAgeAction = RECORD_AGE;
return NS_OK;
}
// StartupCacheDebugOutputStream implementation
#ifdef DEBUG
NS_IMPL_ISUPPORTS3(StartupCacheDebugOutputStream, nsIObjectOutputStream,
@@ -781,5 +789,11 @@ StartupCacheWrapper::GetObserver(nsIObserver** obv) {
return NS_OK;
}
nsresult
StartupCacheWrapper::RecordAgesAlways() {
StartupCache *sc = StartupCache::GetSingleton();
return sc ? sc->RecordAgesAlways() : NS_ERROR_NOT_INITIALIZED;
}
} // namespace scache
} // namespace mozilla