Rollup of bug 819000: Preload about:blank. r=cjones, r=jlebar
authorVivien Nicolas <21@vingtetun.org> and Chris Jones <jones.chris.g@gmail.com>
Thu, 24 Jan 2013 10:39:18 -0800
changeset 130674 d1a412685273ca75bda5cd174161b11b7fd82e5c
parent 130673 14e3c735b37399dc3c31f2d1ad26e85c86252896
child 130675 3399392cc8374f4ccf17cf753e9843360af0f92b
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones, jlebar
bugs819000
milestone21.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
Rollup of bug 819000: Preload about:blank. r=cjones, r=jlebar Includes the following patches Bug 819000: Bail out of PresShell::Paint if not active. r=roc Bug 819000: Make sure preloaded docshells are reset to active. r=jlebar Bug 819000: Preload about:blank. r=cjones a=cjones
b2g/app/b2g.js
dom/browser-element/BrowserElementChild.js
dom/ipc/ContentChild.cpp
dom/ipc/preload.js
layout/base/nsPresShell.cpp
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -569,17 +569,17 @@ pref("hal.processPriorityManager.gonk.ma
 pref("hal.processPriorityManager.gonk.foregroundNice", 0);
 pref("hal.processPriorityManager.gonk.backgroundNice", 10);
 
 #ifndef DEBUG
 // Enable pre-launching content processes for improved startup time
 // (hiding latency).
 pref("dom.ipc.processPrelaunch.enabled", true);
 // Wait this long before pre-launching a new subprocess.
-pref("dom.ipc.processPrelaunch.delayMs", 1000);
+pref("dom.ipc.processPrelaunch.delayMs", 5000);
 #endif
 
 // Ignore the "dialog=1" feature in window.open.
 pref("dom.disable_window_open_dialog_feature", true);
 
 // Screen reader support
 pref("accessibility.accessfu.activate", 2);
 
--- a/dom/browser-element/BrowserElementChild.js
+++ b/dom/browser-element/BrowserElementChild.js
@@ -75,16 +75,21 @@ function BrowserElementChild() {
 
 BrowserElementChild.prototype = {
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
                                          Ci.nsISupportsWeakReference]),
 
   _init: function() {
     debug("Starting up.");
+
+    // NB: this must happen before we process any messages from
+    // mozbrowser API clients.
+    docShell.isActive = true;
+
     sendAsyncMsg("hello");
 
     // Set the docshell's name according to our <iframe>'s name attribute.
     docShell.QueryInterface(Ci.nsIDocShellTreeItem).name =
       sendSyncMsg('get-name')[0];
 
     docShell.setFullscreenAllowed(sendSyncMsg('get-fullscreen-allowed')[0]);
 
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1121,18 +1121,25 @@ PreloadSlowThings()
     TabChild::PreloadSlowThings();
 }
 
 bool
 ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID)
 {
     mAppInfo.version.Assign(version);
     mAppInfo.buildID.Assign(buildID);
-
-    PreloadSlowThings();
+    // If we're part of the mozbrowser machinery, go ahead and start
+    // preloading things.  We can only do this for mozbrowser because
+    // PreloadSlowThings() may set the docshell of the first TabChild
+    // inactive, and we can only safely restore it to active from
+    // BrowserElementChild.js.
+    if ((mIsForApp || mIsForBrowser) &&
+        Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) {
+        PreloadSlowThings();
+    }
     return true;
 }
 
 bool
 ContentChild::RecvLastPrivateDocShellDestroyed()
 {
     nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
     obs->NotifyObservers(nullptr, "last-pb-context-exited", nullptr);
--- a/dom/ipc/preload.js
+++ b/dom/ipc/preload.js
@@ -64,9 +64,16 @@
   Cc["@mozilla.org/permissionmanager;1"].getService(Ci["nsIPermissionManager"]);
   Cc["@mozilla.org/preferences-service;1"].getService(Ci["nsIPrefBranch"]);
   Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci["nsIScriptSecurityManager"]);
   Cc["@mozilla.org/storage/service;1"].getService(Ci["mozIStorageService"]);
   Cc["@mozilla.org/system-info;1"].getService(Ci["nsIPropertyBag2"]);
   Cc["@mozilla.org/thread-manager;1"].getService(Ci["nsIThreadManager"]);
   Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci["nsIAppStartup"]);
   Cc["@mozilla.org/uriloader;1"].getService(Ci["nsIURILoader"]);
+
+  docShell.isActive = false;
+  docShell.QueryInterface(Ci.nsIWebNavigation)
+          .loadURI("about:blank",
+                   Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
+                   null, null, null);
+
 })();
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -5288,16 +5288,20 @@ void
 PresShell::Paint(nsView*        aViewToPaint,
                  const nsRegion& aDirtyRegion,
                  uint32_t        aFlags)
 {
   SAMPLE_LABEL("Paint", "PresShell::Paint");
   NS_ASSERTION(!mIsDestroying, "painting a destroyed PresShell");
   NS_ASSERTION(aViewToPaint, "null view");
 
+  if (!mIsActive) {
+    return;
+  }
+
   nsAutoNotifyDidPaint notifyDidPaint(this, aFlags);
 
   nsPresContext* presContext = GetPresContext();
   AUTO_LAYOUT_PHASE_ENTRY_POINT(presContext, Paint);
 
   nsIFrame* frame = aViewToPaint->GetFrame();
 
   bool isRetainingManager;