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

Unified Diff: chrome/browser/renderer_host/browser_render_process_host.cc

Issue 5513001: Add a base class for objects that want to filter messages on the UI thread. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix possible race condition Created 10 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: chrome/browser/renderer_host/browser_render_process_host.cc
===================================================================
--- chrome/browser/renderer_host/browser_render_process_host.cc (revision 67520)
+++ chrome/browser/renderer_host/browser_render_process_host.cc (working copy)
@@ -297,18 +297,6 @@
// run the IPC channel on the shared IO thread.
base::Thread* io_thread = g_browser_process->io_thread();
- // Construct the AudioRendererHost with the IO thread.
- audio_renderer_host_ = new AudioRendererHost();
-
- scoped_refptr<ResourceMessageFilter> resource_message_filter(
- new ResourceMessageFilter(g_browser_process->resource_dispatcher_host(),
- id(),
- audio_renderer_host_.get(),
- PluginService::GetInstance(),
- g_browser_process->print_job_manager(),
- profile(),
- widget_helper_));
-
CommandLine::StringType renderer_prefix;
#if defined(OS_POSIX)
// A command prefix is something prepended to the command line of the spawned
@@ -330,7 +318,6 @@
ChildProcessInfo::GenerateRandomChannelID(this);
channel_.reset(
new IPC::SyncChannel(channel_id, IPC::Channel::MODE_SERVER, this,
- resource_message_filter,
io_thread->message_loop(), true,
g_browser_process->shutdown_event()));
// As a preventive mesure, we DCHECK if someone sends a synchronous message
@@ -338,9 +325,7 @@
// be doing.
channel_->set_sync_messages_with_no_timeout_allowed(false);
- scoped_refptr<PepperFileMessageFilter> pepper_file_message_filter(
- new PepperFileMessageFilter(id(), profile()));
- channel_->AddFilter(pepper_file_message_filter);
+ CreateMessageFilters();
if (run_renderer_in_process()) {
// Crank up a thread and run the initialization there. With the way that
@@ -392,6 +377,25 @@
return true;
}
+void BrowserRenderProcessHost::CreateMessageFilters() {
+ // Construct the AudioRendererHost with the IO thread.
+ audio_renderer_host_ = new AudioRendererHost();
+
+ scoped_refptr<ResourceMessageFilter> resource_message_filter(
+ new ResourceMessageFilter(g_browser_process->resource_dispatcher_host(),
+ id(),
+ audio_renderer_host_.get(),
+ PluginService::GetInstance(),
+ g_browser_process->print_job_manager(),
+ profile(),
+ widget_helper_));
+ channel_->AddFilter(resource_message_filter);
+
+ scoped_refptr<PepperFileMessageFilter> pepper_file_message_filter(
+ new PepperFileMessageFilter(id(), profile()));
+ channel_->AddFilter(pepper_file_message_filter);
+}
+
int BrowserRenderProcessHost::GetNextRoutingID() {
return widget_helper_->GetNextRoutingID();
}

Powered by Google App Engine
This is Rietveld 408576698