Bug 782006: Prefetch the "built-in" stylesheet cache in content processes. r=roc
authorChris Jones <jones.chris.g@gmail.com>
Wed, 15 Aug 2012 18:46:03 -0700
changeset 102503 31c4f7ab45b77d575f463684705fedce03eb79e5
parent 102502 b6967661b5887032309c8feab8fa0a0967c37954
child 102504 66f381b9547e43b0d6af8f327227948b21bb6709
push id23288
push useremorley@mozilla.com
push dateThu, 16 Aug 2012 13:14:48 +0000
treeherdermozilla-central@3940df6f9356 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs782006
milestone17.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 782006: Prefetch the "built-in" stylesheet cache in content processes. r=roc
dom/ipc/ContentChild.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -43,16 +43,17 @@
 #include "nsServiceManagerUtils.h"
 #include "nsXULAppAPI.h"
 #include "nsWeakReference.h"
 #include "nsIScriptError.h"
 #include "nsIConsoleService.h"
 #include "nsJSEnvironment.h"
 #include "SandboxHal.h"
 #include "nsDebugImpl.h"
+#include "nsLayoutStylesheetCache.h"
 
 #include "History.h"
 #include "nsDocShellCID.h"
 #include "nsNetUtil.h"
 
 #include "base/message_loop.h"
 #include "base/process_util.h"
 #include "base/task.h"
@@ -903,21 +904,30 @@ ContentChild::RecvGarbageCollect()
 bool
 ContentChild::RecvCycleCollect()
 {
     nsJSContext::GarbageCollectNow(js::gcreason::DOM_IPC);
     nsJSContext::CycleCollectNow();
     return true;
 }
 
+static void
+PreloadSlowThings()
+{
+    // This fetches and creates all the built-in stylesheets.
+    nsLayoutStylesheetCache::UserContentSheet();
+}
+
 bool
 ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID)
 {
     mAppInfo.version.Assign(version);
     mAppInfo.buildID.Assign(buildID);
+
+    PreloadSlowThings();
     return true;
 }
 
 bool
 ContentChild::RecvSetID(const PRUint64 &id)
 {
     if (mID != PRUint64(-1)) {
         NS_WARNING("Setting content child's ID twice?");