Index: content/browser/browser_main_loop.cc |
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
index eaacefc4b0fb3b15af05d0b013750dceb3f1b319..53d4813ac46f9a32b78a358132e507b9936dfb8d 100644 |
--- a/content/browser/browser_main_loop.cc |
+++ b/content/browser/browser_main_loop.cc |
@@ -123,6 +123,7 @@ |
#include "base/android/jni_android.h" |
#include "components/tracing/common/graphics_memory_dump_provider_android.h" |
#include "content/browser/android/browser_startup_controller.h" |
+#include "content/browser/android/launcher_thread.h" |
#include "content/browser/android/scoped_surface_request_manager.h" |
#include "content/browser/android/tracing_controller_android.h" |
#include "content/browser/media/android/browser_media_player_manager.h" |
@@ -1007,7 +1008,7 @@ int BrowserMainLoop::CreateThreads() { |
base::Thread::Options ui_message_loop_options; |
ui_message_loop_options.message_loop_type = base::MessageLoop::TYPE_UI; |
- const bool redirect_nonUInonIO_browser_threads = |
+ bool redirect_nonUInonIO_browser_threads = |
GetContentClient() |
->browser() |
->RedirectNonUINonIOBrowserThreadsToTaskScheduler(); |
@@ -1024,6 +1025,7 @@ int BrowserMainLoop::CreateThreads() { |
// updated away from its default. |
std::unique_ptr<BrowserProcessSubThread>* thread_to_start = nullptr; |
base::Thread::Options options; |
+ base::MessageLoop* message_loop = nullptr; |
// Otherwise this thread ID will be backed by a SingleThreadTaskRunner using |
// |non_ui_non_io_task_runner_traits| (which can be augmented below). |
@@ -1088,6 +1090,10 @@ int BrowserMainLoop::CreateThreads() { |
TRACE_EVENT_BEGIN1("startup", |
"BrowserMainLoop::CreateThreads:start", |
"Thread", "BrowserThread::PROCESS_LAUNCHER"); |
+#if defined(OS_ANDROID) |
+ redirect_nonUInonIO_browser_threads = false; |
+ message_loop = android::LauncherThread::GetLauncherMessageLoop(); |
agrieve
2017/03/28 19:59:32
nit: might be nicer to drop the double "Launcher":
boliu
2017/03/28 23:30:52
Done.
|
+#endif |
if (redirect_nonUInonIO_browser_threads) { |
non_ui_non_io_task_runner_traits |
.WithPriority(base::TaskPriority::USER_BLOCKING) |
@@ -1142,7 +1148,9 @@ int BrowserMainLoop::CreateThreads() { |
BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
if (thread_to_start) { |
- (*thread_to_start).reset(new BrowserProcessSubThread(id)); |
+ (*thread_to_start) |
+ .reset(message_loop ? new BrowserProcessSubThread(id, message_loop) |
+ : new BrowserProcessSubThread(id)); |
if (!(*thread_to_start)->StartWithOptions(options)) |
LOG(FATAL) << "Failed to start the browser thread: id == " << id; |
} else { |