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 125655 19bf13eb533bd62df5463e778e4e63728e07a98a
parent 125654 1a490822a502d23a750b9bfd648435de624129a2
child 125656 2e0f54b2bbc45e3493ff8a4492d45940fe20e714
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [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