Backed out changeset 756a66aa8ee7 (bug 1033618) for bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 09 Jul 2014 11:49:37 -0400
changeset 207772 394b7c158cf0ccb5cd21b0607a8fde0656e90010
parent 207771 818553f6e2dd0b2451cd159024ce4afc96f93835
child 207773 4cf4838bd5e1907e15e4354da76a94aca3604c17
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1033618
milestone32.0a2
backs out756a66aa8ee75cfd15607119185161b793a0a6fc
Backed out changeset 756a66aa8ee7 (bug 1033618) for bustage.
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -866,25 +866,28 @@ ContentParent::CreateBrowserOrApp(const 
         // Check that the process is still alive and set its priority.
         // Hopefully the process won't die after this point, if this call
         // succeeds.
         if (!p->SetPriorityAndCheckIsAlive(initialPriority)) {
             p = nullptr;
         }
     }
 
-    bool reused = !!p;
-    bool tookPreallocated = false;
     if (!p) {
         p = MaybeTakePreallocatedAppProcess(manifestURL,
                                             initialPriority);
-        tookPreallocated = !!p;
-        if (!tookPreallocated) {
-            // XXXkhuey Nuwa wants the frame loader to try again later, but the
-            // frame loader is really not set up to do that ...
+        if (!p) {
+#ifdef MOZ_NUWA_PROCESS
+            if (Preferences::GetBool("dom.ipc.processPrelaunch.enabled",
+                                     false)) {
+                // Returning nullptr from here so the frame loader will retry
+                // later when we have a spare process.
+                return nullptr;
+            }
+#endif
             NS_WARNING("Unable to use pre-allocated app process");
             p = new ContentParent(ownApp,
                                   /* isForBrowserElement = */ false,
                                   /* isForPreallocated = */ false,
                                   initialPriority);
             p->Init();
         }
         sAppContentParents->Put(manifestURL, p);
@@ -897,39 +900,16 @@ ContentParent::CreateBrowserOrApp(const 
     PBrowserParent* browser = p->SendPBrowserConstructor(
         // DeallocPBrowserParent() releases this ref.
         nsRefPtr<TabParent>(tp).forget().take(),
         aContext.AsIPCTabContext(),
         chromeFlags,
         p->ChildID(),
         p->IsForApp(),
         p->IsForBrowser());
-    if (!browser) {
-        // We failed to actually start the PBrowser.  This can happen if the
-        // other process has already died.
-        if (!reused) {
-            // Don't leave a broken ContentParent in the hashtable.
-            p->KillHard();
-            sAppContentParents->Remove(manifestURL);
-            p = nullptr;
-        }
-
-        // If we took the preallocated process and it was already dead, try
-        // again with a non-preallocated process.  We can be sure this won't
-        // loop forever, because the next time through there will be no
-        // preallocated process to take.
-        if (tookPreallocated) {
-          return ContentParent::CreateBrowserOrApp(aContext,
-                                                   aFrameElement,
-                                                   aOpenerContentParent);
-        }
-
-        // Otherwise just give up.
-        return nullptr;
-    }
 
     p->MaybeTakeCPUWakeLock(aFrameElement);
 
     return static_cast<TabParent*>(browser);
 }
 
 void
 ContentParent::GetAll(nsTArray<ContentParent*>& aArray)