Bug 1438945 - Part 12: Spawning a new process if needed. r=asuth
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 19 Nov 2018 15:18:33 -0800
changeset 503574 6f7cba5101c17b5f2ffea4501bebc9ae0dc873b4
parent 503573 2a1a9e2c2010d94954a3d346a30c9690551a7bcf
child 503575 93c96481ec70d75496045840d5c42c90ee8ec761
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1438945
milestone65.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 1438945 - Part 12: Spawning a new process if needed. r=asuth
dom/workers/remoteworkers/RemoteWorkerManager.cpp
--- a/dom/workers/remoteworkers/RemoteWorkerManager.cpp
+++ b/dom/workers/remoteworkers/RemoteWorkerManager.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "RemoteWorkerManager.h"
 
+#include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/RemoteWorkerParent.h"
 #include "mozilla/ipc/BackgroundParent.h"
 #include "mozilla/ipc/PBackgroundParent.h"
 #include "RemoteWorkerServiceParent.h"
 
 namespace mozilla {
 
 using namespace ipc;
@@ -190,13 +191,25 @@ RemoteWorkerManager::SelectTargetActor(c
 }
 
 void
 RemoteWorkerManager::LaunchNewContentProcess()
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(XRE_IsParentProcess());
 
-  // TODO: exec a new process
+  // This runnable will spawn a new process if it doesn't exist yet.
+  nsCOMPtr<nsIRunnable> r =
+    NS_NewRunnableFunction("LaunchNewContentProcess", [] () {
+      RefPtr<ContentParent> unused =
+        ContentParent::GetNewOrUsedBrowserProcess(
+          nullptr,
+          NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE));
+    }
+  );
+
+  nsCOMPtr<nsIEventTarget> target =
+    SystemGroup::EventTargetFor(TaskCategory::Other);
+  target->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
 }
 
 } // dom namespace
 } // mozilla namespace