Bug 1438945 - Part 12: Spawning a new process if needed. r=asuth

--HG--
extra : rebase_source : 76cfdb0b7798d73d755183f8c431d631f67b9fac
This commit is contained in:
Andrea Marchesini 2018-11-19 15:18:33 -08:00
parent e9bd43a3d1
commit b08cb98eb5

View File

@ -6,6 +6,7 @@
#include "RemoteWorkerManager.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/RemoteWorkerParent.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/ipc/PBackgroundParent.h"
@ -195,7 +196,19 @@ 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