Bug 816656 - Don't write the startup cache on shutdown. r=mwu
authorBenoit Girard <b56girard@gmail.com>
Wed, 05 Dec 2012 14:09:30 -0500
changeset 116553 19bf13eb533b
parent 116552 1a490822a502
child 116554 2e0f54b2bbc4
push id24058
push useremorley@mozilla.com
push dateThu, 20 Dec 2012 21:06:10 +0000
treeherdermozilla-central@868b21bed3eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu
bugs816656
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 816656 - Don't write the startup cache on shutdown. r=mwu
startupcache/StartupCache.cpp
--- a/startupcache/StartupCache.cpp
+++ b/startupcache/StartupCache.cpp
@@ -134,17 +134,25 @@ StartupCache::~StartupCache()
   if (mTimer) {
     mTimer->Cancel();
   }
 
   // Generally, the in-memory table should be empty here,
   // but an early shutdown means either mTimer didn't run 
   // or the write thread is still running.
   WaitOnWriteThread();
-  WriteToDisk();
+
+  // If we shutdown quickly timer wont have fired. Instead of writing
+  // it on the main thread and block the shutdown we simply wont update
+  // the startup cache. Always do this if the file doesn't exist since
+  // we use it part of the packge step.
+  if (!mArchive) {
+    WriteToDisk();
+  }
+
   gStartupCache = nullptr;
   (void)::NS_UnregisterMemoryReporter(mMappingMemoryReporter);
   (void)::NS_UnregisterMemoryReporter(mDataMemoryReporter);
   mMappingMemoryReporter = nullptr;
   mDataMemoryReporter = nullptr;
 }
 
 nsresult