Index: content/browser/browser_main_loop.cc |
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
index ba276a6acc07aa22fcc09a95cd89497fa8814223..45be56d34c7236fa281f7e71f91d79201c904a63 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" |
@@ -986,7 +987,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(); |
@@ -1003,6 +1004,7 @@ int BrowserMainLoop::CreateThreads() { |
// updated away from its default. |
gab
2017/03/29 17:19:53
Document |message_loop| here.
boliu
2017/03/29 18:02:39
Done.
|
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). |
@@ -1067,6 +1069,10 @@ int BrowserMainLoop::CreateThreads() { |
TRACE_EVENT_BEGIN1("startup", |
"BrowserMainLoop::CreateThreads:start", |
"Thread", "BrowserThread::PROCESS_LAUNCHER"); |
+#if defined(OS_ANDROID) |
+ redirect_nonUInonIO_browser_threads = false; |
gab
2017/03/29 17:19:53
That's a large hammer since this bool is set outsi
boliu
2017/03/29 18:02:39
Oh good catch! Added a bool in the loop instead
|
+ message_loop = android::LauncherThread::GetMessageLoop(); |
+#endif |
if (redirect_nonUInonIO_browser_threads) { |
non_ui_non_io_task_runner_traits |
.WithPriority(base::TaskPriority::USER_BLOCKING) |
@@ -1121,7 +1127,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)); |
gab
2017/03/29 17:19:53
This will alter shutdown behavior of PROCESS_LAUNC
boliu
2017/03/29 18:02:39
Noted. Thankfully, android never does clean shutdo
|
if (!(*thread_to_start)->StartWithOptions(options)) |
LOG(FATAL) << "Failed to start the browser thread: id == " << id; |
} else { |