Bug 1448125 - Move calls to ContentParent::Init into LaunchSubprocess; r?jld
Every LaunchSubprocess caller immediatelly calls Init afterwards
MozReview-Commit-ID: LATClQzWfyg
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -604,17 +604,16 @@ ContentParent::PreallocateProcess()
NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE));
PreallocatedProcessManager::AddBlocker(process);
if (!process->LaunchSubprocess(PROCESS_PRIORITY_PREALLOC)) {
return nullptr;
}
- process->Init();
return process.forget();
}
/*static*/ void
ContentParent::StartUp()
{
// We could launch sub processes from content process
// FIXME Bug 1023701 - Stop using ContentParent static methods in
@@ -831,18 +830,16 @@ ContentParent::GetNewOrUsedBrowserProces
// Until the new process is ready let's not allow to start up any preallocated processes.
PreallocatedProcessManager::AddBlocker(p);
if (!p->LaunchSubprocess(aPriority)) {
return nullptr;
}
- p->Init();
-
contentParents.AppendElement(p);
p->mActivateTS = TimeStamp::Now();
return p.forget();
}
/*static*/ already_AddRefed<ContentParent>
ContentParent::GetNewOrUsedJSPluginProcess(uint32_t aPluginID,
const hal::ProcessPriority& aPriority)
@@ -860,18 +857,16 @@ ContentParent::GetNewOrUsedJSPluginProce
}
p = new ContentParent(aPluginID);
if (!p->LaunchSubprocess(aPriority)) {
return nullptr;
}
- p->Init();
-
sJSPluginContentParents->Put(aPluginID, p);
return p.forget();
}
/*static*/ ProcessPriority
ContentParent::GetInitialProcessPriority(Element* aFrameElement)
{
@@ -2086,16 +2081,18 @@ ContentParent::LaunchSubprocess(ProcessP
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
nsAutoString cpId;
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-initializing", cpId.get());
}
+ Init();
+
return true;
}
ContentParent::ContentParent(ContentParent* aOpener,
const nsAString& aRemoteType,
int32_t aJSPluginID)
: nsIContentParent()
, mSubprocess(nullptr)
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -745,17 +745,17 @@ private:
ContentParent(ContentParent* aOpener,
const nsAString& aRemoteType,
int32_t aPluginID);
// Launch the subprocess and associated initialization.
// Returns false if the process fails to start.
bool LaunchSubprocess(hal::ProcessPriority aInitialPriority = hal::PROCESS_PRIORITY_FOREGROUND);
- // Common initialization after sub process launch or adoption.
+ // Common initialization after sub process launch.
void InitInternal(ProcessPriority aPriority);
virtual ~ContentParent();
void Init();
// Some information could be sent to content very early, it
// should be send from this function. This function should only be