Commit 89d93df2 authored by Xi Han's avatar Xi Han Committed by Commit Bot

Move the TaskRunner for process launching to ChildProcessLauncherHelper.

ServiceManager may need to launch child processes before a BrowserMainLoop
has been created, and therefore before any BrowserThreads exists. We
therefore replace the BrowserThread::PROCESS_LAUNCHER with a global
TaskScheduler sequence, created on-demand when the ServiceManager or
ChildProcessLauncherHelper first need it.

Under Windows we must use a single-thread TaskRunner, while on other
platforms we are able to use a normal TaskScheduler sequence. File
crbug.com/820200 to track that.

Bug: 815225
Change-Id: Ia0f46461fb9cc92fddacf81ee96b764de8477d11
Reviewed-on: https://chromium-review.googlesource.com/941264
Commit-Queue: Xi Han <hanxi@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542212}
parent d2aa77c3
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/task_scheduler/post_task.h" #include "base/task_scheduler/post_task.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h" #include "content/public/browser/child_process_data.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h" #include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
...@@ -106,7 +107,7 @@ AwBrowserTerminator::~AwBrowserTerminator() {} ...@@ -106,7 +107,7 @@ AwBrowserTerminator::~AwBrowserTerminator() {}
void AwBrowserTerminator::OnChildStart( void AwBrowserTerminator::OnChildStart(
int process_host_id, int process_host_id,
content::PosixFileDescriptorInfo* mappings) { content::PosixFileDescriptorInfo* mappings) {
DCHECK_CURRENTLY_ON(content::BrowserThread::PROCESS_LAUNCHER); DCHECK(content::CurrentlyOnProcessLauncherTaskRunner());
base::AutoLock auto_lock(process_host_id_to_pipe_lock_); base::AutoLock auto_lock(process_host_id_to_pipe_lock_);
DCHECK(!ContainsKey(process_host_id_to_pipe_, process_host_id)); DCHECK(!ContainsKey(process_host_id_to_pipe_, process_host_id));
......
...@@ -50,12 +50,6 @@ NOINLINE void ThreadUnresponsive_UI() { ...@@ -50,12 +50,6 @@ NOINLINE void ThreadUnresponsive_UI() {
ReportThreadHang(); ReportThreadHang();
} }
NOINLINE void ThreadUnresponsive_PROCESS_LAUNCHER() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
ReportThreadHang();
}
NOINLINE void ThreadUnresponsive_IO() { NOINLINE void ThreadUnresponsive_IO() {
volatile int inhibit_comdat = __LINE__; volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat); ALLOW_UNUSED_LOCAL(inhibit_comdat);
...@@ -67,8 +61,6 @@ NOINLINE void CrashBecauseThreadWasUnresponsive( ...@@ -67,8 +61,6 @@ NOINLINE void CrashBecauseThreadWasUnresponsive(
switch (thread_id) { switch (thread_id) {
case content::BrowserThread::UI: case content::BrowserThread::UI:
return ThreadUnresponsive_UI(); return ThreadUnresponsive_UI();
case content::BrowserThread::PROCESS_LAUNCHER:
return ThreadUnresponsive_PROCESS_LAUNCHER();
case content::BrowserThread::IO: case content::BrowserThread::IO:
return ThreadUnresponsive_IO(); return ThreadUnresponsive_IO();
case content::BrowserThread::ID_COUNT: case content::BrowserThread::ID_COUNT:
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
...@@ -130,9 +131,8 @@ class ChromeRenderProcessHostTest : public ExtensionBrowserTest { ...@@ -130,9 +131,8 @@ class ChromeRenderProcessHostTest : public ExtensionBrowserTest {
// Ensures that the backgrounding / foregrounding gets a chance to run. // Ensures that the backgrounding / foregrounding gets a chance to run.
void WaitForLauncherThread() { void WaitForLauncherThread() {
base::RunLoop run_loop; base::RunLoop run_loop;
content::BrowserThread::PostTaskAndReply( content::GetProcessLauncherTaskRunner()->PostTaskAndReply(
content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, base::DoNothing(), FROM_HERE, base::DoNothing(), run_loop.QuitWhenIdleClosure());
run_loop.QuitWhenIdleClosure());
run_loop.Run(); run_loop.Run();
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "chrome/browser/upgrade_detector.h" #include "chrome/browser/upgrade_detector.h"
#include "chrome/common/service_process_util.h" #include "chrome/common/service_process_util.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "mojo/edk/embedder/embedder.h" #include "mojo/edk/embedder/embedder.h"
#include "mojo/edk/embedder/named_platform_handle.h" #include "mojo/edk/embedder/named_platform_handle.h"
#include "mojo/edk/embedder/named_platform_handle_utils.h" #include "mojo/edk/embedder/named_platform_handle_utils.h"
...@@ -338,8 +339,8 @@ ServiceProcessControl::Launcher::Launcher( ...@@ -338,8 +339,8 @@ ServiceProcessControl::Launcher::Launcher(
void ServiceProcessControl::Launcher::Run(const base::Closure& task) { void ServiceProcessControl::Launcher::Run(const base::Closure& task) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
notify_task_ = task; notify_task_ = task;
BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE, content::GetProcessLauncherTaskRunner()->PostTask(
base::Bind(&Launcher::DoRun, this)); FROM_HERE, base::BindOnce(&Launcher::DoRun, this));
} }
ServiceProcessControl::Launcher::~Launcher() { ServiceProcessControl::Launcher::~Launcher() {
......
...@@ -374,21 +374,6 @@ void OnStoppedStartupTracing(const base::FilePath& trace_file) { ...@@ -374,21 +374,6 @@ void OnStoppedStartupTracing(const base::FilePath& trace_file) {
MSVC_DISABLE_OPTIMIZE() MSVC_DISABLE_OPTIMIZE()
MSVC_PUSH_DISABLE_WARNING(4748) MSVC_PUSH_DISABLE_WARNING(4748)
#if defined(OS_ANDROID)
NOINLINE void ResetThread_PROCESS_LAUNCHER(
std::unique_ptr<BrowserProcessSubThread> thread) {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
thread.reset();
}
#else // defined(OS_ANDROID)
NOINLINE void ResetThread_PROCESS_LAUNCHER() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::PROCESS_LAUNCHER);
}
#endif // defined(OS_ANDROID)
NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) { NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) {
volatile int inhibit_comdat = __LINE__; volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat); ALLOW_UNUSED_LOCAL(inhibit_comdat);
...@@ -1022,37 +1007,6 @@ int BrowserMainLoop::CreateThreads() { ...@@ -1022,37 +1007,6 @@ int BrowserMainLoop::CreateThreads() {
*task_scheduler_init_params.get()); *task_scheduler_init_params.get());
} }
TRACE_EVENT_BEGIN1("startup", "BrowserMainLoop::CreateThreads:start",
"Thread", "BrowserThread::PROCESS_LAUNCHER");
#if defined(OS_ANDROID)
// Android specializes Launcher thread so it is accessible in java.
// Note Android never does clean shutdown, so shutdown use-after-free
// concerns are not a problem in practice.
base::MessageLoop* message_loop = android::LauncherThread::GetMessageLoop();
DCHECK(message_loop);
// This BrowserThread will use this message loop instead of creating a new
// thread. Note that means this/ thread will not be joined on shutdown, and
// may cause use-after-free if anything tries to access objects deleted by
// AtExitManager, such as non-leaky LazyInstance.
process_launcher_thread_.reset(new BrowserProcessSubThread(
BrowserThread::PROCESS_LAUNCHER, message_loop));
#else // defined(OS_ANDROID)
// This thread ID will be backed by a SingleThreadTaskRunner using
// |task_traits|.
// TODO(gab): WithBaseSyncPrimitives() is likely not required here.
base::TaskTraits task_traits = {base::MayBlock(),
base::WithBaseSyncPrimitives(),
base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN};
scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner =
base::CreateSingleThreadTaskRunnerWithTraits(
task_traits, base::SingleThreadTaskRunnerThreadMode::DEDICATED);
DCHECK(redirection_task_runner);
BrowserThreadImpl::RedirectThreadIDToTaskRunner(
BrowserThread::PROCESS_LAUNCHER, std::move(redirection_task_runner));
#endif // defined(OS_ANDROID)
// |io_thread_| is created by |PostMainMessageLoopStart()|, but its // |io_thread_| is created by |PostMainMessageLoopStart()|, but its
// full initialization is deferred until this point because it requires // full initialization is deferred until this point because it requires
// several dependencies we don't want to depend on so early in startup. // several dependencies we don't want to depend on so early in startup.
...@@ -1205,39 +1159,9 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { ...@@ -1205,39 +1159,9 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
{ {
base::ThreadRestrictions::ScopedAllowWait allow_wait_for_join; base::ThreadRestrictions::ScopedAllowWait allow_wait_for_join;
{
// Must be size_t so we can subtract from it. TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread");
for (size_t thread_id = BrowserThread::ID_COUNT - 1; ResetThread_IO(std::move(io_thread_));
thread_id >= (BrowserThread::UI + 1); --thread_id) {
// Find the thread object we want to stop. Looping over all valid
// BrowserThread IDs and DCHECKing on a missing case in the switch
// statement helps avoid a mismatch between this code and the
// BrowserThread::ID enumeration.
//
// The destruction order is the reverse order of occurrence in the
// BrowserThread::ID list. The rationale for the order is that he
// PROCESS_LAUNCHER thread must be stopped after IO in case the IO thread
// posted a task to terminate a process on the process launcher thread.
switch (thread_id) {
case BrowserThread::PROCESS_LAUNCHER: {
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread");
#if defined(OS_ANDROID)
ResetThread_PROCESS_LAUNCHER(std::move(process_launcher_thread_));
#else // defined(OS_ANDROID)
ResetThread_PROCESS_LAUNCHER();
#endif // defined(OS_ANDROID)
break;
}
case BrowserThread::IO: {
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread");
ResetThread_IO(std::move(io_thread_));
break;
}
case BrowserThread::UI:
case BrowserThread::ID_COUNT:
NOTREACHED();
break;
}
} }
{ {
......
...@@ -339,11 +339,7 @@ class CONTENT_EXPORT BrowserMainLoop { ...@@ -339,11 +339,7 @@ class CONTENT_EXPORT BrowserMainLoop {
// Only the IO thread is a real thread by default, other BrowserThreads are // Only the IO thread is a real thread by default, other BrowserThreads are
// redirected to TaskScheduler under the hood. // redirected to TaskScheduler under the hood.
std::unique_ptr<BrowserProcessSubThread> io_thread_; std::unique_ptr<BrowserProcessSubThread> io_thread_;
#if defined(OS_ANDROID) #if defined(OS_WIN)
// On Android, the PROCESS_LAUNCHER thread is handled by Java,
// |process_launcher_thread_| is merely a proxy to the real message loop.
std::unique_ptr<BrowserProcessSubThread> process_launcher_thread_;
#elif defined(OS_WIN)
// TaskScheduler doesn't support async I/O on Windows as CACHE thread is // TaskScheduler doesn't support async I/O on Windows as CACHE thread is
// the only user and this use case is going away in // the only user and this use case is going away in
// https://codereview.chromium.org/2216583003/. // https://codereview.chromium.org/2216583003/.
......
...@@ -32,7 +32,6 @@ namespace { ...@@ -32,7 +32,6 @@ namespace {
// Friendly names for the well-known threads. // Friendly names for the well-known threads.
static const char* const g_browser_thread_names[BrowserThread::ID_COUNT] = { static const char* const g_browser_thread_names[BrowserThread::ID_COUNT] = {
"", // UI (name assembled in browser_main.cc). "", // UI (name assembled in browser_main.cc).
"Chrome_ProcessLauncherThread", // PROCESS_LAUNCHER
"Chrome_IOThread", // IO "Chrome_IOThread", // IO
}; };
...@@ -202,12 +201,6 @@ void BrowserThreadImpl::Init() { ...@@ -202,12 +201,6 @@ void BrowserThreadImpl::Init() {
DCHECK(globals.task_runners[identifier_]->RunsTasksInCurrentSequence()); DCHECK(globals.task_runners[identifier_]->RunsTasksInCurrentSequence());
} }
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
if (identifier_ == BrowserThread::PROCESS_LAUNCHER) {
// Nesting and task observers are not allowed on redirected threads.
base::RunLoop::DisallowNestingOnCurrentThread();
message_loop()->DisallowTaskObservers();
}
} }
// We disable optimizations for this block of functions so the compiler doesn't // We disable optimizations for this block of functions so the compiler doesn't
...@@ -221,13 +214,6 @@ NOINLINE void BrowserThreadImpl::UIThreadRun(base::RunLoop* run_loop) { ...@@ -221,13 +214,6 @@ NOINLINE void BrowserThreadImpl::UIThreadRun(base::RunLoop* run_loop) {
CHECK_GT(line_number, 0); CHECK_GT(line_number, 0);
} }
NOINLINE void BrowserThreadImpl::ProcessLauncherThreadRun(
base::RunLoop* run_loop) {
volatile int line_number = __LINE__;
Thread::Run(run_loop);
CHECK_GT(line_number, 0);
}
NOINLINE void BrowserThreadImpl::IOThreadRun(base::RunLoop* run_loop) { NOINLINE void BrowserThreadImpl::IOThreadRun(base::RunLoop* run_loop) {
volatile int line_number = __LINE__; volatile int line_number = __LINE__;
Thread::Run(run_loop); Thread::Run(run_loop);
...@@ -254,8 +240,6 @@ void BrowserThreadImpl::Run(base::RunLoop* run_loop) { ...@@ -254,8 +240,6 @@ void BrowserThreadImpl::Run(base::RunLoop* run_loop) {
switch (identifier_) { switch (identifier_) {
case BrowserThread::UI: case BrowserThread::UI:
return UIThreadRun(run_loop); return UIThreadRun(run_loop);
case BrowserThread::PROCESS_LAUNCHER:
return ProcessLauncherThreadRun(run_loop);
case BrowserThread::IO: case BrowserThread::IO:
return IOThreadRun(run_loop); return IOThreadRun(run_loop);
case BrowserThread::ID_COUNT: case BrowserThread::ID_COUNT:
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/process/launch.h" #include "base/process/launch.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/common/result_codes.h" #include "content/public/common/result_codes.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h" #include "content/public/common/sandboxed_process_launcher_delegate.h"
...@@ -62,8 +63,8 @@ void ChildProcessLauncher::SetProcessPriority( ...@@ -62,8 +63,8 @@ void ChildProcessLauncher::SetProcessPriority(
const ChildProcessLauncherPriority& priority) { const ChildProcessLauncherPriority& priority) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
base::Process to_pass = process_.process.Duplicate(); base::Process to_pass = process_.process.Duplicate();
BrowserThread::PostTask( GetProcessLauncherTaskRunner()->PostTask(
BrowserThread::PROCESS_LAUNCHER, FROM_HERE, FROM_HERE,
base::BindOnce( base::BindOnce(
&ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread, &ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread,
helper_, std::move(to_pass), priority)); helper_, std::move(to_pass), priority));
......
...@@ -6,18 +6,28 @@ ...@@ -6,18 +6,28 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/single_thread_task_runner.h"
#include "base/task_scheduler/post_task.h"
#include "base/task_scheduler/single_thread_task_runner_thread_mode.h"
#include "base/task_scheduler/task_traits.h"
#include "content/browser/child_process_launcher.h" #include "content/browser/child_process_launcher.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h" #include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "mojo/edk/embedder/platform_channel_pair.h" #include "mojo/edk/embedder/platform_channel_pair.h"
#if defined(OS_ANDROID)
#include "content/browser/android/launcher_thread.h"
#endif
namespace content { namespace content {
namespace internal { namespace internal {
namespace { namespace {
void RecordHistogramsOnLauncherThread(base::TimeDelta launch_time) { void RecordHistogramsOnLauncherThread(base::TimeDelta launch_time) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
// Log the launch time, separating out the first one (which will likely be // Log the launch time, separating out the first one (which will likely be
// slower due to the rest of the browser initializing at the same time). // slower due to the rest of the browser initializing at the same time).
static bool done_first_launch = false; static bool done_first_launch = false;
...@@ -85,14 +95,14 @@ void ChildProcessLauncherHelper::StartLaunchOnClientThread() { ...@@ -85,14 +95,14 @@ void ChildProcessLauncherHelper::StartLaunchOnClientThread() {
mojo_client_handle_ = channel_pair.PassClientHandle(); mojo_client_handle_ = channel_pair.PassClientHandle();
} }
BrowserThread::PostTask( GetProcessLauncherTaskRunner()->PostTask(
BrowserThread::PROCESS_LAUNCHER, FROM_HERE, FROM_HERE,
base::BindOnce(&ChildProcessLauncherHelper::LaunchOnLauncherThread, base::BindOnce(&ChildProcessLauncherHelper::LaunchOnLauncherThread,
this)); this));
} }
void ChildProcessLauncherHelper::LaunchOnLauncherThread() { void ChildProcessLauncherHelper::LaunchOnLauncherThread() {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
begin_launch_time_ = base::TimeTicks::Now(); begin_launch_time_ = base::TimeTicks::Now();
...@@ -167,18 +177,52 @@ std::string ChildProcessLauncherHelper::GetProcessType() { ...@@ -167,18 +177,52 @@ std::string ChildProcessLauncherHelper::GetProcessType() {
// static // static
void ChildProcessLauncherHelper::ForceNormalProcessTerminationAsync( void ChildProcessLauncherHelper::ForceNormalProcessTerminationAsync(
ChildProcessLauncherHelper::Process process) { ChildProcessLauncherHelper::Process process) {
if (BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)) { if (CurrentlyOnProcessLauncherTaskRunner()) {
ForceNormalProcessTerminationSync(std::move(process)); ForceNormalProcessTerminationSync(std::move(process));
return; return;
} }
// On Posix, EnsureProcessTerminated can lead to 2 seconds of sleep! // On Posix, EnsureProcessTerminated can lead to 2 seconds of sleep!
// So don't do this on the UI/IO threads. // So don't do this on the UI/IO threads.
BrowserThread::PostTask( GetProcessLauncherTaskRunner()->PostTask(
BrowserThread::PROCESS_LAUNCHER, FROM_HERE, FROM_HERE,
base::BindOnce( base::BindOnce(
&ChildProcessLauncherHelper::ForceNormalProcessTerminationSync, &ChildProcessLauncherHelper::ForceNormalProcessTerminationSync,
std::move(process))); std::move(process)));
} }
} // namespace internal } // namespace internal
// static
base::SingleThreadTaskRunner* GetProcessLauncherTaskRunner() {
#if defined(OS_ANDROID)
// Android specializes Launcher thread so it is accessible in java.
// Note Android never does clean shutdown, so shutdown use-after-free
// concerns are not a problem in practice.
// This process launcher thread will use the Java-side process-launching
// thread, instead of creating its own separate thread on C++ side. Note
// that means this thread will not be joined on shutdown, and may cause
// use-after-free if anything tries to access objects deleted by
// AtExitManager, such as non-leaky LazyInstance.
static base::NoDestructor<scoped_refptr<base::SingleThreadTaskRunner>>
launcher_task_runner(
android::LauncherThread::GetMessageLoop()->task_runner());
#else // defined(OS_ANDROID)
constexpr base::TaskTraits task_traits = {
base::MayBlock(), base::WithBaseSyncPrimitives(),
base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN};
// TODO(wez): Investigates whether we could use SequencedTaskRunner on
// platforms other than Windows. http://crbug.com/820200.
static base::NoDestructor<scoped_refptr<base::SingleThreadTaskRunner>>
launcher_task_runner(base::CreateSingleThreadTaskRunnerWithTraits(
task_traits, base::SingleThreadTaskRunnerThreadMode::DEDICATED));
#endif // defined(OS_ANDROID)
return (*launcher_task_runner).get();
}
// static
bool CurrentlyOnProcessLauncherTaskRunner() {
return GetProcessLauncherTaskRunner()->RunsTasksInCurrentSequence();
}
} // namespace content } // namespace content
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "content/browser/posix_file_descriptor_info_impl.h" #include "content/browser/posix_file_descriptor_info_impl.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/common/content_descriptors.h" #include "content/public/common/content_descriptors.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
...@@ -32,7 +33,7 @@ namespace { ...@@ -32,7 +33,7 @@ namespace {
// Stops a child process based on the handle returned from StartChildProcess. // Stops a child process based on the handle returned from StartChildProcess.
void StopChildProcess(base::ProcessHandle handle) { void StopChildProcess(base::ProcessHandle handle) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
JNIEnv* env = AttachCurrentThread(); JNIEnv* env = AttachCurrentThread();
DCHECK(env); DCHECK(env);
Java_ChildProcessLauncherHelper_stop(env, static_cast<jint>(handle)); Java_ChildProcessLauncherHelper_stop(env, static_cast<jint>(handle));
...@@ -64,7 +65,7 @@ ChildProcessLauncherHelper::PrepareMojoPipeHandlesOnClientThread() { ...@@ -64,7 +65,7 @@ ChildProcessLauncherHelper::PrepareMojoPipeHandlesOnClientThread() {
std::unique_ptr<PosixFileDescriptorInfo> std::unique_ptr<PosixFileDescriptorInfo>
ChildProcessLauncherHelper::GetFilesToMap() { ChildProcessLauncherHelper::GetFilesToMap() {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
// Android WebView runs in single process, ensure that we never get here when // Android WebView runs in single process, ensure that we never get here when
// running in single process mode. // running in single process mode.
...@@ -162,15 +163,15 @@ base::TerminationStatus ChildProcessLauncherHelper::GetTerminationStatus( ...@@ -162,15 +163,15 @@ base::TerminationStatus ChildProcessLauncherHelper::GetTerminationStatus(
// static // static
bool ChildProcessLauncherHelper::TerminateProcess(const base::Process& process, bool ChildProcessLauncherHelper::TerminateProcess(const base::Process& process,
int exit_code) { int exit_code) {
BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE, GetProcessLauncherTaskRunner()->PostTask(
base::Bind(&StopChildProcess, process.Handle())); FROM_HERE, base::BindOnce(&StopChildProcess, process.Handle()));
return true; return true;
} }
// static // static
void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync(
ChildProcessLauncherHelper::Process process) { ChildProcessLauncherHelper::Process process) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
VLOG(1) << "ChromeProcess: Stopping process with handle " VLOG(1) << "ChromeProcess: Stopping process with handle "
<< process.process.Handle(); << process.process.Handle();
StopChildProcess(process.process.Handle()); StopChildProcess(process.process.Handle());
...@@ -211,7 +212,7 @@ void ChildProcessLauncherHelper::OnChildProcessStarted( ...@@ -211,7 +212,7 @@ void ChildProcessLauncherHelper::OnChildProcessStarted(
JNIEnv*, JNIEnv*,
const base::android::JavaParamRef<jobject>& obj, const base::android::JavaParamRef<jobject>& obj,
jint handle) { jint handle) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
scoped_refptr<ChildProcessLauncherHelper> ref(this); scoped_refptr<ChildProcessLauncherHelper> ref(this);
Release(); // Balances with LaunchProcessOnLauncherThread. Release(); // Balances with LaunchProcessOnLauncherThread.
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/process/launch.h" #include "base/process/launch.h"
#include "content/browser/child_process_launcher.h" #include "content/browser/child_process_launcher.h"
#include "content/common/sandbox_policy_fuchsia.h" #include "content/common/sandbox_policy_fuchsia.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h" #include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "mojo/edk/embedder/platform_channel_pair.h" #include "mojo/edk/embedder/platform_channel_pair.h"
...@@ -17,7 +18,7 @@ namespace internal { ...@@ -17,7 +18,7 @@ namespace internal {
void ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread( void ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread(
base::Process process, base::Process process,
const ChildProcessLauncherPriority& priority) { const ChildProcessLauncherPriority& priority) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
// TODO(fuchsia): Implement this. (crbug.com/707031) // TODO(fuchsia): Implement this. (crbug.com/707031)
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
...@@ -64,14 +65,14 @@ ChildProcessLauncherHelper::PrepareMojoPipeHandlesOnClientThread() { ...@@ -64,14 +65,14 @@ ChildProcessLauncherHelper::PrepareMojoPipeHandlesOnClientThread() {
std::unique_ptr<FileMappedForLaunch> std::unique_ptr<FileMappedForLaunch>
ChildProcessLauncherHelper::GetFilesToMap() { ChildProcessLauncherHelper::GetFilesToMap() {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
return std::unique_ptr<FileMappedForLaunch>(); return std::unique_ptr<FileMappedForLaunch>();
} }
bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread( bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
const PosixFileDescriptorInfo& files_to_register, const PosixFileDescriptorInfo& files_to_register,
base::LaunchOptions* options) { base::LaunchOptions* options) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
mojo::edk::PlatformChannelPair::PrepareToPassHandleToChildProcess( mojo::edk::PlatformChannelPair::PrepareToPassHandleToChildProcess(
mojo_client_handle(), command_line(), &options->handles_to_transfer); mojo_client_handle(), command_line(), &options->handles_to_transfer);
...@@ -87,7 +88,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( ...@@ -87,7 +88,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread(
std::unique_ptr<FileMappedForLaunch> files_to_register, std::unique_ptr<FileMappedForLaunch> files_to_register,
bool* is_synchronous_launch, bool* is_synchronous_launch,
int* launch_result) { int* launch_result) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
DCHECK(mojo_client_handle().is_valid()); DCHECK(mojo_client_handle().is_valid());
// TODO(750938): Implement sandboxed/isolated subprocess launching. // TODO(750938): Implement sandboxed/isolated subprocess launching.
...@@ -99,7 +100,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( ...@@ -99,7 +100,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread(
void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread( void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread(
const ChildProcessLauncherHelper::Process& process, const ChildProcessLauncherHelper::Process& process,
const base::LaunchOptions& options) { const base::LaunchOptions& options) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
if (process.process.IsValid()) { if (process.process.IsValid()) {
// |mojo_client_handle_| has already been transferred to the child process // |mojo_client_handle_| has already been transferred to the child process
...@@ -112,7 +113,7 @@ void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread( ...@@ -112,7 +113,7 @@ void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread(
// static // static
void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync(
ChildProcessLauncherHelper::Process process) { ChildProcessLauncherHelper::Process process) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
process.process.Terminate(RESULT_CODE_NORMAL_EXIT, true); process.process.Terminate(RESULT_CODE_NORMAL_EXIT, true);
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "content/browser/sandbox_host_linux.h" #include "content/browser/sandbox_host_linux.h"
#include "content/browser/zygote_host/zygote_communication_linux.h" #include "content/browser/zygote_host/zygote_communication_linux.h"
#include "content/browser/zygote_host/zygote_host_impl_linux.h" #include "content/browser/zygote_host/zygote_host_impl_linux.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
#include "content/public/common/common_sandbox_support_linux.h" #include "content/public/common/common_sandbox_support_linux.h"
#include "content/public/common/content_client.h" #include "content/public/common/content_client.h"
...@@ -36,7 +37,7 @@ void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() { ...@@ -36,7 +37,7 @@ void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {
std::unique_ptr<FileMappedForLaunch> std::unique_ptr<FileMappedForLaunch>
ChildProcessLauncherHelper::GetFilesToMap() { ChildProcessLauncherHelper::GetFilesToMap() {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
return CreateDefaultPosixFilesToMap(child_process_id(), mojo_client_handle(), return CreateDefaultPosixFilesToMap(child_process_id(), mojo_client_handle(),
true /* include_service_required_files */, true /* include_service_required_files */,
GetProcessType(), command_line()); GetProcessType(), command_line());
...@@ -154,7 +155,7 @@ void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( ...@@ -154,7 +155,7 @@ void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync(
void ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread( void ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread(
base::Process process, base::Process process,
const ChildProcessLauncherPriority& priority) { const ChildProcessLauncherPriority& priority) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
if (process.CanBackgroundProcesses()) if (process.CanBackgroundProcesses())
process.SetProcessBackgrounded(priority.background); process.SetProcessBackgrounded(priority.background);
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "content/browser/mach_broker_mac.h" #include "content/browser/mach_broker_mac.h"
#include "content/browser/sandbox_parameters_mac.h" #include "content/browser/sandbox_parameters_mac.h"
#include "content/grit/content_resources.h" #include "content/grit/content_resources.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_features.h" #include "content/public/common/content_features.h"
#include "content/public/common/content_paths.h" #include "content/public/common/content_paths.h"
...@@ -47,7 +48,7 @@ void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() { ...@@ -47,7 +48,7 @@ void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {
std::unique_ptr<PosixFileDescriptorInfo> std::unique_ptr<PosixFileDescriptorInfo>
ChildProcessLauncherHelper::GetFilesToMap() { ChildProcessLauncherHelper::GetFilesToMap() {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
return CreateDefaultPosixFilesToMap( return CreateDefaultPosixFilesToMap(
child_process_id(), mojo_client_handle(), child_process_id(), mojo_client_handle(),
false /* include_service_required_files */, GetProcessType(), false /* include_service_required_files */, GetProcessType(),
...@@ -242,7 +243,7 @@ bool ChildProcessLauncherHelper::TerminateProcess(const base::Process& process, ...@@ -242,7 +243,7 @@ bool ChildProcessLauncherHelper::TerminateProcess(const base::Process& process,
// static // static
void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync(
ChildProcessLauncherHelper::Process process) { ChildProcessLauncherHelper::Process process) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
// Client has gone away, so just kill the process. Using exit code 0 means // Client has gone away, so just kill the process. Using exit code 0 means
// that UMA won't treat this as a crash. // that UMA won't treat this as a crash.
process.process.Terminate(RESULT_CODE_NORMAL_EXIT, false); process.process.Terminate(RESULT_CODE_NORMAL_EXIT, false);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/win/win_util.h" #include "base/win/win_util.h"
#include "content/browser/child_process_launcher.h" #include "content/browser/child_process_launcher.h"
#include "content/browser/child_process_launcher_helper.h" #include "content/browser/child_process_launcher_helper.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/common/result_codes.h" #include "content/public/common/result_codes.h"
#include "content/public/common/sandbox_init.h" #include "content/public/common/sandbox_init.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h" #include "content/public/common/sandboxed_process_launcher_delegate.h"
...@@ -46,7 +47,7 @@ ChildProcessLauncherHelper::GetFilesToMap() { ...@@ -46,7 +47,7 @@ ChildProcessLauncherHelper::GetFilesToMap() {
bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread( bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
const FileMappedForLaunch& files_to_register, const FileMappedForLaunch& files_to_register,
base::LaunchOptions* options) { base::LaunchOptions* options) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
return true; return true;
} }
...@@ -56,7 +57,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( ...@@ -56,7 +57,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread(
std::unique_ptr<FileMappedForLaunch> files_to_register, std::unique_ptr<FileMappedForLaunch> files_to_register,
bool* is_synchronous_launch, bool* is_synchronous_launch,
int* launch_result) { int* launch_result) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
*is_synchronous_launch = true; *is_synchronous_launch = true;
if (delegate_->ShouldLaunchElevated()) { if (delegate_->ShouldLaunchElevated()) {
// When establishing a Mojo connection, the pipe path has already been added // When establishing a Mojo connection, the pipe path has already been added
...@@ -85,7 +86,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( ...@@ -85,7 +86,7 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread(
void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread( void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread(
const ChildProcessLauncherHelper::Process& process, const ChildProcessLauncherHelper::Process& process,
const base::LaunchOptions& options) { const base::LaunchOptions& options) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
} }
base::TerminationStatus ChildProcessLauncherHelper::GetTerminationStatus( base::TerminationStatus ChildProcessLauncherHelper::GetTerminationStatus(
...@@ -103,7 +104,7 @@ bool ChildProcessLauncherHelper::TerminateProcess(const base::Process& process, ...@@ -103,7 +104,7 @@ bool ChildProcessLauncherHelper::TerminateProcess(const base::Process& process,
void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync(
ChildProcessLauncherHelper::Process process) { ChildProcessLauncherHelper::Process process) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
// Client has gone away, so just kill the process. Using exit code 0 means // Client has gone away, so just kill the process. Using exit code 0 means
// that UMA won't treat this as a crash. // that UMA won't treat this as a crash.
process.process.Terminate(RESULT_CODE_NORMAL_EXIT, false); process.process.Terminate(RESULT_CODE_NORMAL_EXIT, false);
...@@ -112,7 +113,7 @@ void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( ...@@ -112,7 +113,7 @@ void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync(
void ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread( void ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread(
base::Process process, base::Process process,
const ChildProcessLauncherPriority& priority) { const ChildProcessLauncherPriority& priority) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); DCHECK(CurrentlyOnProcessLauncherTaskRunner());
if (process.CanBackgroundProcesses()) if (process.CanBackgroundProcesses())
process.SetProcessBackgrounded(priority.background); process.SetProcessBackgrounded(priority.background);
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/public/browser/child_process_launcher_utils.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_process_host_observer.h" #include "content/public/browser/render_process_host_observer.h"
...@@ -356,8 +357,8 @@ IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, SpareRendererOnProcessReuse) { ...@@ -356,8 +357,8 @@ IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, SpareRendererOnProcessReuse) {
base::WaitableEvent launcher_thread_done( base::WaitableEvent launcher_thread_done(
base::WaitableEvent::ResetPolicy::MANUAL, base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED); base::WaitableEvent::InitialState::NOT_SIGNALED);
BrowserThread::PostTask( GetProcessLauncherTaskRunner()->PostTask(
BrowserThread::PROCESS_LAUNCHER, FROM_HERE, FROM_HERE,
base::BindOnce([](base::WaitableEvent* done) { done->Signal(); }, base::BindOnce([](base::WaitableEvent* done) { done->Signal(); },
base::Unretained(&launcher_thread_done))); base::Unretained(&launcher_thread_done)));
ASSERT_TRUE(launcher_thread_done.TimedWait(TestTimeouts::action_timeout())); ASSERT_TRUE(launcher_thread_done.TimedWait(TestTimeouts::action_timeout()));
......
...@@ -12,7 +12,7 @@ import org.chromium.base.VisibleForTesting; ...@@ -12,7 +12,7 @@ import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.JNINamespace;
/** This is BrowserThread::PROCESS_LAUNCHER. It is available before native library is loaded. */ /** This is the process launcher thread. It is available before native library is loaded. */
@JNINamespace("content::android") @JNINamespace("content::android")
public final class LauncherThread { public final class LauncherThread {
private static final JavaHandlerThread sThread = private static final JavaHandlerThread sThread =
......
...@@ -84,6 +84,7 @@ jumbo_source_set("browser_sources") { ...@@ -84,6 +84,7 @@ jumbo_source_set("browser_sources") {
"cdm_registry.h", "cdm_registry.h",
"certificate_request_result_type.h", "certificate_request_result_type.h",
"child_process_data.h", "child_process_data.h",
"child_process_launcher_utils.h",
"child_process_security_policy.h", "child_process_security_policy.h",
"client_certificate_delegate.h", "client_certificate_delegate.h",
"color_chooser.h", "color_chooser.h",
......
...@@ -67,9 +67,6 @@ class CONTENT_EXPORT BrowserThread { ...@@ -67,9 +67,6 @@ class CONTENT_EXPORT BrowserThread {
// The main thread in the browser. // The main thread in the browser.
UI, UI,
// Used to launch and terminate Chrome processes.
PROCESS_LAUNCHER,
// This is the thread that processes non-blocking IO, i.e. IPC and network. // This is the thread that processes non-blocking IO, i.e. IPC and network.
// Blocking IO should happen in TaskScheduler. // Blocking IO should happen in TaskScheduler.
IO, IO,
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_LAUNCHER_UTILS_H_
#define CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_LAUNCHER_UTILS_H_
#include "content/common/content_export.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace content {
// The caller must take a reference to the returned TaskRunner pointer if it
// wants to use the pointer directly.
CONTENT_EXPORT base::SingleThreadTaskRunner* GetProcessLauncherTaskRunner();
CONTENT_EXPORT bool CurrentlyOnProcessLauncherTaskRunner();
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_CHILD_PROCESS_LAUNCHER_UTILES_H_
...@@ -39,8 +39,6 @@ TestBrowserThreadBundle::~TestBrowserThreadBundle() { ...@@ -39,8 +39,6 @@ TestBrowserThreadBundle::~TestBrowserThreadBundle() {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
io_thread_->Stop(); io_thread_->Stop();
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
process_launcher_thread_->Stop();
base::RunLoop().RunUntilIdle();
ui_thread_->Stop(); ui_thread_->Stop();
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
...@@ -116,9 +114,6 @@ void TestBrowserThreadBundle::Init() { ...@@ -116,9 +114,6 @@ void TestBrowserThreadBundle::Init() {
void TestBrowserThreadBundle::CreateBrowserThreads() { void TestBrowserThreadBundle::CreateBrowserThreads() {
CHECK(!threads_created_); CHECK(!threads_created_);
process_launcher_thread_ = std::make_unique<TestBrowserThread>(
BrowserThread::PROCESS_LAUNCHER, base::MessageLoop::current());
if (options_ & REAL_IO_THREAD) { if (options_ & REAL_IO_THREAD) {
io_thread_ = std::make_unique<TestBrowserThread>(BrowserThread::IO); io_thread_ = std::make_unique<TestBrowserThread>(BrowserThread::IO);
io_thread_->StartIOThread(); io_thread_->StartIOThread();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment