Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1469)

Unified Diff: content/browser/browser_main_loop.cc

Issue 8890018: Update Java Bridge to use its own thread in the browser process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 1e0808c6cf2e4dd96051644d77b0044c23c6b02e..290cca61b0c248c2f1ec1ebc4ec7ab56930286b9 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -343,6 +343,11 @@ void BrowserMainLoop::RunMainMessageLoopParts(
thread_to_start = &cache_thread_;
options = &io_message_loop_options;
break;
+ case BrowserThread::JAVA_BRIDGE:
+#if defined(ENABLE_JAVA_BRIDGE)
+ thread_to_start = &java_bridge_thread_;
+#endif
+ break;
case BrowserThread::IO:
thread_to_start = &io_thread_;
options = &io_message_loop_options;
@@ -371,8 +376,6 @@ void BrowserMainLoop::RunMainMessageLoopParts(
} else if (thread_to_start) {
(*thread_to_start).reset(new BrowserProcessSubThread(id));
(*thread_to_start)->StartWithOptions(*options);
- } else {
- NOTREACHED();
}
if (parts_.get())
@@ -429,6 +432,12 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
//
// - (Not sure why the WEB_SOCKET_PROXY thread is stopped first.)
//
+ // - The JAVA_BRIDGE thread receives messages from the UI thread, and posts
+ // messages to and receives messages from the IO thread. Of the
+ // interactions with the IO thread, receiving messages is more common, so
+ // make sure this thread outlives the IO thread to take advantage of the
+ // optimization in BrowserThread.
+ //
// - The IO thread is the only user of the CACHE thread.
//
// - The PROCESS_LAUNCHER thread must be stopped after IO in case
@@ -463,6 +472,11 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
case BrowserThread::CACHE:
thread_to_stop = &cache_thread_;
break;
+ case BrowserThread::JAVA_BRIDGE:
+#if defined(ENABLE_JAVA_BRIDGE)
+ thread_to_stop = &java_bridge_thread_;
+#endif
+ break;
case BrowserThread::IO:
thread_to_stop = &io_thread_;
break;
@@ -487,8 +501,6 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
webkit_thread_.reset();
} else if (thread_to_stop) {
thread_to_stop->reset();
- } else {
- NOTREACHED();
}
if (parts_.get())

Powered by Google App Engine
This is Rietveld 408576698