Bug 1446900: Place bug 1348361 (async content process launching) behind an ifdef and disable it to avoid numerous top crashers. r=jld

This commit is contained in:
Stephen A Pohl 2018-05-11 20:00:40 -04:00
parent 35a055854c
commit 4ecf5cdf16
2 changed files with 26 additions and 3 deletions

View File

@ -1519,6 +1519,10 @@ ContentParent::OnChannelConnected(int32_t pid)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
#ifndef ASYNC_CONTENTPROC_LAUNCH
SetOtherProcessId(pid);
#endif
#if defined(ANDROID) || defined(LINUX) #if defined(ANDROID) || defined(LINUX)
// Check nice preference // Check nice preference
int32_t nice = Preferences::GetInt("dom.ipc.content.nice", 0); int32_t nice = Preferences::GetInt("dom.ipc.content.nice", 0);
@ -1543,7 +1547,7 @@ ContentParent::OnChannelConnected(int32_t pid)
} }
#endif #endif
#ifdef MOZ_CODE_COVERAGE #if defined(MOZ_CODE_COVERAGE) && defined(ASYNC_CONTENTPROC_LAUNCH)
Unused << SendShareCodeCoverageMutex( Unused << SendShareCodeCoverageMutex(
CodeCoverageHandler::Get()->GetMutexHandle(pid)); CodeCoverageHandler::Get()->GetMutexHandle(pid));
#endif #endif
@ -2059,13 +2063,27 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
extraArgs.push_back(parentBuildID.get()); extraArgs.push_back(parentBuildID.get());
SetOtherProcessId(kInvalidProcessId, ProcessIdState::ePending); SetOtherProcessId(kInvalidProcessId, ProcessIdState::ePending);
#ifdef ASYNC_CONTENTPROC_LAUNCH
if (!mSubprocess->Launch(extraArgs)) { if (!mSubprocess->Launch(extraArgs)) {
#else
if (!mSubprocess->LaunchAndWaitForProcessHandle(extraArgs)) {
#endif
NS_ERROR("failed to launch child in the parent"); NS_ERROR("failed to launch child in the parent");
MarkAsDead(); MarkAsDead();
return false; return false;
} }
#ifdef ASYNC_CONTENTPROC_LAUNCH
OpenWithAsyncPid(mSubprocess->GetChannel()); OpenWithAsyncPid(mSubprocess->GetChannel());
#else
base::ProcessId procId =
base::GetProcId(mSubprocess->GetChildProcessHandle());
Open(mSubprocess->GetChannel(), procId);
#ifdef MOZ_CODE_COVERAGE
Unused << SendShareCodeCoverageMutex(
CodeCoverageHandler::Get()->GetMutexHandle(procId));
#endif
#endif // ASYNC_CONTENTPROC_LAUNCH
InitInternal(aInitialPriority); InitInternal(aInitialPriority);
@ -2076,8 +2094,9 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
// Set a reply timeout for CPOWs. // Set a reply timeout for CPOWs.
SetReplyTimeoutMs(Preferences::GetInt("dom.ipc.cpow.timeout", 0)); SetReplyTimeoutMs(Preferences::GetInt("dom.ipc.cpow.timeout", 0));
// TODO: If OtherPid() is not called between mSubprocess->Launch() and this, // TODO: In ASYNC_CONTENTPROC_LAUNCH, if OtherPid() is not called between
// then we're not really measuring how long it took to spawn the process. // mSubprocess->Launch() and this, then we're not really measuring how long it
// took to spawn the process.
Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS, Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS,
static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS) static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS)
.ToMilliseconds())); .ToMilliseconds()));

View File

@ -555,13 +555,17 @@ GeckoChildProcessHost::RunPerformAsyncLaunch(std::vector<std::string> aExtraOpts
MonitorAutoLock lock(mMonitor); MonitorAutoLock lock(mMonitor);
mProcessState = PROCESS_ERROR; mProcessState = PROCESS_ERROR;
lock.Notify(); lock.Notify();
#ifdef ASYNC_CONTENTPROC_LAUNCH
OnProcessLaunchError(); OnProcessLaunchError();
#endif
CHROMIUM_LOG(ERROR) << "Failed to launch " << CHROMIUM_LOG(ERROR) << "Failed to launch " <<
XRE_ChildProcessTypeToString(mProcessType) << " subprocess"; XRE_ChildProcessTypeToString(mProcessType) << " subprocess";
Telemetry::Accumulate(Telemetry::SUBPROCESS_LAUNCH_FAILURE, Telemetry::Accumulate(Telemetry::SUBPROCESS_LAUNCH_FAILURE,
nsDependentCString(XRE_ChildProcessTypeToString(mProcessType))); nsDependentCString(XRE_ChildProcessTypeToString(mProcessType)));
#ifdef ASYNC_CONTENTPROC_LAUNCH
} else { } else {
OnProcessHandleReady(mChildProcessHandle); OnProcessHandleReady(mChildProcessHandle);
#endif
} }
return ok; return ok;
} }