summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 00:25:06 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 00:25:06 +0000
commitf784592cd075d7866c74e410833768c8b6f9b622 (patch)
tree8512d6dc402faef8df803c7ff07ba5b77eecda3f /chrome/browser
parenta63f220009f90657fc1070d4a9bde26726deb6b4 (diff)
downloadchromium_src-f784592cd075d7866c74e410833768c8b6f9b622.zip
chromium_src-f784592cd075d7866c74e410833768c8b6f9b622.tar.gz
chromium_src-f784592cd075d7866c74e410833768c8b6f9b622.tar.bz2
Switch the first thread in a child process to be the main thread, and make theIO thread be the second thread. The change is needed for plugins on mac.
Review URL: http://codereview.chromium.org/155944 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 2370fd3..07f202a 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -54,6 +54,7 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/result_codes.h"
#include "chrome/renderer/render_process.h"
+#include "chrome/renderer/render_thread.h"
#include "chrome/installer/util/google_update_settings.h"
#include "grit/generated_resources.h"
@@ -92,7 +93,8 @@ class RendererMainThread : public base::Thread {
CoInitialize(NULL);
#endif
- render_process_ = new RenderProcess(channel_id_);
+ render_process_ = new RenderProcess();
+ render_process_->set_main_thread(new RenderThread(channel_id_));
// It's a little lame to manually set this flag. But the single process
// RendererThread will receive the WM_QUIT. We don't need to assert on
// this thread, so just force the flag manually.
@@ -411,18 +413,14 @@ bool BrowserRenderProcessHost::Init() {
if (run_renderer_in_process()) {
// Crank up a thread and run the initialization there. With the way that
// messages flow between the browser and renderer, this thread is required
- // to prevent a deadlock in single-process mode. When using multiple
- // processes, the primordial thread in the renderer process has a message
- // loop which is used for sending messages asynchronously to the io thread
- // in the browser process. If we don't create this thread, then the
- // RenderThread is both responsible for rendering and also for
- // communicating IO. This can lead to deadlocks where the RenderThread is
- // waiting for the IO to complete, while the browsermain is trying to pass
- // an event to the RenderThread.
+ // to prevent a deadlock in single-process mode. Since the primordial
+ // thread in the renderer process runs the WebKit code and can sometimes
+ // blocking calls to the UI thread (i.e. this thread), they need to run on
+ // separate threads.
in_process_renderer_.reset(new RendererMainThread(channel_id));
base::Thread::Options options;
- options.message_loop_type = MessageLoop::TYPE_IO;
+ options.message_loop_type = MessageLoop::TYPE_UI;
in_process_renderer_->StartWithOptions(options);
} else {
base::ProcessHandle process = 0;