summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/threading/thread.h2
-rw-r--r--chrome/browser/automation/automation_provider.cc3
-rw-r--r--chrome/browser/service/service_process_control.cc11
-rw-r--r--chrome/renderer/devtools_agent_filter.h1
-rw-r--r--chrome/service/service_ipc_server.cc2
-rw-r--r--chrome/test/automation/automation_proxy.cc2
-rw-r--r--content/browser/DEPS2
-rw-r--r--content/browser/gpu_process_host_ui_shim.cc3
-rw-r--r--content/browser/renderer_host/browser_render_process_host.cc12
-rw-r--r--content/common/child_process.h3
-rw-r--r--content/common/child_thread.cc2
-rw-r--r--content/common/gpu/gpu_channel.cc2
-rw-r--r--content/common/gpu/gpu_channel.h5
-rw-r--r--content/common/gpu/gpu_channel_manager.cc2
-rw-r--r--content/common/gpu/gpu_channel_manager.h5
-rw-r--r--content/common/pepper_plugin_registry.cc4
-rw-r--r--content/common/pepper_plugin_registry.h2
-rw-r--r--content/gpu/gpu_child_thread.cc2
-rw-r--r--content/plugin/plugin_channel.cc7
-rw-r--r--content/plugin/plugin_channel.h7
-rw-r--r--content/plugin/plugin_channel_base.cc4
-rw-r--r--content/plugin/plugin_channel_base.h10
-rw-r--r--content/plugin/plugin_thread.cc2
-rw-r--r--content/ppapi_plugin/ppapi_thread.cc4
-rw-r--r--content/ppapi_plugin/ppapi_thread.h2
-rw-r--r--content/renderer/audio_input_message_filter.h2
-rw-r--r--content/renderer/audio_message_filter.h2
-rw-r--r--content/renderer/gpu_channel_host.cc2
-rw-r--r--content/renderer/plugin_channel_host.cc5
-rw-r--r--content/renderer/plugin_channel_host.h6
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc2
-rw-r--r--ipc/ipc_channel_proxy.cc15
-rw-r--r--ipc/ipc_channel_proxy.h27
-rw-r--r--ipc/ipc_sync_channel.cc13
-rw-r--r--ipc/ipc_sync_channel.h4
-rw-r--r--ipc/ipc_sync_channel_unittest.cc4
-rw-r--r--ipc/ipc_tests.cc2
-rw-r--r--ppapi/proxy/dispatcher.cc2
-rw-r--r--ppapi/proxy/dispatcher.h2
-rw-r--r--ppapi/proxy/ppb_flash_file_proxy.cc15
-rw-r--r--ppapi/proxy/proxy_channel.h5
41 files changed, 110 insertions, 99 deletions
diff --git a/base/threading/thread.h b/base/threading/thread.h
index 034cb7d..9a181c0 100644
--- a/base/threading/thread.h
+++ b/base/threading/thread.h
@@ -112,7 +112,7 @@ class BASE_API Thread : PlatformThread::Delegate {
// this will return NULL. Callers can hold on to this even after the thread
// is gone.
// TODO(sanjeevr): Look into merging MessageLoop and MessageLoopProxy.
- scoped_refptr<MessageLoopProxy> message_loop_proxy() {
+ scoped_refptr<MessageLoopProxy> message_loop_proxy() const {
return message_loop_proxy_;
}
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 4770701..5a86ca7 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -55,7 +55,6 @@
#include "chrome/browser/extensions/extension_tabs_module.h"
#include "chrome/browser/extensions/extension_toolbar_model.h"
#include "chrome/browser/extensions/user_script_master.h"
-#include "chrome/browser/io_thread.h"
#include "chrome/browser/net/url_request_mock_util.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -166,7 +165,7 @@ bool AutomationProvider::InitializeChannel(const std::string& channel_id) {
use_named_interface ? IPC::Channel::MODE_NAMED_SERVER
: IPC::Channel::MODE_CLIENT,
this,
- g_browser_process->io_thread()->message_loop(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
true, g_browser_process->shutdown_event()));
channel_->AddFilter(automation_resource_message_filter_);
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc
index 6bcbabb..135d832 100644
--- a/chrome/browser/service/service_process_control.cc
+++ b/chrome/browser/service/service_process_control.cc
@@ -11,7 +11,6 @@
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/io_thread.h"
#include "chrome/browser/upgrade_detector.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/service_messages.h"
@@ -43,15 +42,13 @@ void ServiceProcessControl::ConnectInternal() {
// Actually going to connect.
VLOG(1) << "Connecting to Service Process IPC Server";
- // Run the IPC channel on the shared IO thread.
- base::Thread* io_thread = g_browser_process->io_thread();
// TODO(hclam): Handle error connecting to channel.
const IPC::ChannelHandle channel_id = GetServiceProcessChannel();
- channel_.reset(
- new IPC::SyncChannel(channel_id, IPC::Channel::MODE_NAMED_CLIENT, this,
- io_thread->message_loop(), true,
- g_browser_process->shutdown_event()));
+ channel_.reset(new IPC::SyncChannel(
+ channel_id, IPC::Channel::MODE_NAMED_CLIENT, this,
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), true,
+ g_browser_process->shutdown_event()));
}
void ServiceProcessControl::RunConnectDoneTasks() {
diff --git a/chrome/renderer/devtools_agent_filter.h b/chrome/renderer/devtools_agent_filter.h
index a02443a..efe6280 100644
--- a/chrome/renderer/devtools_agent_filter.h
+++ b/chrome/renderer/devtools_agent_filter.h
@@ -10,6 +10,7 @@
#include "ipc/ipc_channel_proxy.h"
+class MessageLoop;
struct DevToolsMessageData;
// DevToolsAgentFilter is registered as an IPC filter in order to be able to
diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc
index 267a1a6..ffab169 100644
--- a/chrome/service/service_ipc_server.cc
+++ b/chrome/service/service_ipc_server.cc
@@ -27,7 +27,7 @@ void ServiceIPCServer::CreateChannel() {
channel_.reset(NULL); // Tear down the existing channel, if any.
channel_.reset(new IPC::SyncChannel(channel_handle_,
IPC::Channel::MODE_NAMED_SERVER, this,
- g_service_process->io_thread()->message_loop(), true,
+ g_service_process->io_thread()->message_loop_proxy(), true,
g_service_process->shutdown_event()));
DCHECK(sync_message_filter_.get());
channel_->AddFilter(sync_message_filter_.get());
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index f6edd40..dc00fbe 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -157,7 +157,7 @@ void AutomationProxy::InitializeChannel(const std::string& channel_id,
use_named_interface ? IPC::Channel::MODE_NAMED_CLIENT
: IPC::Channel::MODE_SERVER,
this, // we are the listener
- thread_->message_loop(),
+ thread_->message_loop_proxy(),
true,
shutdown_event_.get()));
channel_->AddFilter(new AutomationMessageFilter(this));
diff --git a/content/browser/DEPS b/content/browser/DEPS
index d5c8522..1098153 100644
--- a/content/browser/DEPS
+++ b/content/browser/DEPS
@@ -57,8 +57,6 @@ include_rules = [
"+chrome/browser/history/history.h",
"+chrome/browser/history/history_types.h",
- "+chrome/browser/io_thread.h",
-
"+chrome/browser/load_from_memory_cache_details.h",
"+chrome/browser/load_notification_details.h",
diff --git a/content/browser/gpu_process_host_ui_shim.cc b/content/browser/gpu_process_host_ui_shim.cc
index 73a9531..d553e78 100644
--- a/content/browser/gpu_process_host_ui_shim.cc
+++ b/content/browser/gpu_process_host_ui_shim.cc
@@ -8,7 +8,6 @@
#include "base/id_map.h"
#include "base/process_util.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/io_thread.h"
#include "content/browser/browser_thread.h"
#include "content/browser/gpu_data_manager.h"
#include "content/browser/gpu_process_host.h"
@@ -117,7 +116,7 @@ GpuProcessHostUIShim::GpuProcessHostUIShim(int host_id)
gpu_channel_manager_ = new GpuChannelManager(
ui_thread_sender_,
NULL,
- g_browser_process->io_thread()->message_loop(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
g_browser_process->shutdown_event());
}
}
diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc
index ee0e253..406e7fd 100644
--- a/content/browser/renderer_host/browser_render_process_host.cc
+++ b/content/browser/renderer_host/browser_render_process_host.cc
@@ -28,7 +28,6 @@
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history.h"
-#include "chrome/browser/io_thread.h"
#include "chrome/browser/net/resolve_proxy_msg_helper.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -253,9 +252,6 @@ bool BrowserRenderProcessHost::Init(
// content, e.g. if an extension calls window.open.
extension_process_ = extension_process_ || is_extensions_process;
- // run the IPC channel on the shared IO thread.
- base::Thread* io_thread = g_browser_process->io_thread();
-
CommandLine::StringType renderer_prefix;
#if defined(OS_POSIX)
// A command prefix is something prepended to the command line of the spawned
@@ -275,10 +271,10 @@ bool BrowserRenderProcessHost::Init(
// Setup the IPC channel.
const std::string channel_id =
ChildProcessInfo::GenerateRandomChannelID(this);
- channel_.reset(
- new IPC::SyncChannel(channel_id, IPC::Channel::MODE_SERVER, this,
- io_thread->message_loop(), true,
- g_browser_process->shutdown_event()));
+ channel_.reset(new IPC::SyncChannel(
+ channel_id, IPC::Channel::MODE_SERVER, this,
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), true,
+ g_browser_process->shutdown_event()));
// As a preventive mesure, we DCHECK if someone sends a synchronous message
// with no time-out, which in the context of the browser process we should not
// be doing.
diff --git a/content/common/child_process.h b/content/common/child_process.h
index 4c5dc67..e3786ae 100644
--- a/content/common/child_process.h
+++ b/content/common/child_process.h
@@ -30,6 +30,9 @@ class ChildProcess {
void set_main_thread(ChildThread* thread);
MessageLoop* io_message_loop() { return io_thread_.message_loop(); }
+ base::MessageLoopProxy* io_message_loop_proxy() {
+ return io_thread_.message_loop_proxy();
+ }
// A global event object that is signalled when the main thread's message
// loop exits. This gives background threads a way to observe the main
diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc
index 92d2cca..9aea6a1e 100644
--- a/content/common/child_thread.cc
+++ b/content/common/child_thread.cc
@@ -45,7 +45,7 @@ void ChildThread::Init() {
channel_.reset(new IPC::SyncChannel(channel_name_,
IPC::Channel::MODE_CLIENT, this,
- ChildProcess::current()->io_message_loop(), true,
+ ChildProcess::current()->io_message_loop_proxy(), true,
ChildProcess::current()->GetShutDownEvent()));
#ifdef IPC_MESSAGE_LOG_ENABLED
IPC::Logging::GetInstance()->SetIPCSender(this);
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
index 5d346ad..a922d0c 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -303,7 +303,7 @@ void GpuChannel::OnCreateTransportTexture(int32 context_route_id,
#endif
}
-bool GpuChannel::Init(MessageLoop* io_message_loop,
+bool GpuChannel::Init(base::MessageLoopProxy* io_message_loop,
base::WaitableEvent* shutdown_event) {
// Check whether we're already initialized.
if (channel_.get())
diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h
index 0b35666..dafd53e 100644
--- a/content/common/gpu/gpu_channel.h
+++ b/content/common/gpu/gpu_channel.h
@@ -23,10 +23,10 @@
class GpuChannelManager;
struct GPUCreateCommandBufferConfig;
class GpuWatchdog;
-class MessageLoop;
class TransportTexture;
namespace base {
+class MessageLoopProxy;
class WaitableEvent;
}
@@ -42,7 +42,8 @@ class GpuChannel : public IPC::Channel::Listener,
int renderer_id);
virtual ~GpuChannel();
- bool Init(MessageLoop* io_message_loop, base::WaitableEvent* shutdown_event);
+ bool Init(base::MessageLoopProxy* io_message_loop,
+ base::WaitableEvent* shutdown_event);
// Get the GpuChannelManager that owns this channel.
GpuChannelManager* gpu_channel_manager() const {
diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc
index 842dda2..d772f48 100644
--- a/content/common/gpu/gpu_channel_manager.cc
+++ b/content/common/gpu/gpu_channel_manager.cc
@@ -19,7 +19,7 @@
GpuChannelManager::GpuChannelManager(IPC::Message::Sender* browser_channel,
GpuWatchdog* watchdog,
- MessageLoop* io_message_loop,
+ base::MessageLoopProxy* io_message_loop,
base::WaitableEvent* shutdown_event)
: ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
io_message_loop_(io_message_loop),
diff --git a/content/common/gpu/gpu_channel_manager.h b/content/common/gpu/gpu_channel_manager.h
index 351df3e..f031f76e 100644
--- a/content/common/gpu/gpu_channel_manager.h
+++ b/content/common/gpu/gpu_channel_manager.h
@@ -13,6 +13,7 @@
#include "base/command_line.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop_proxy.h"
#include "base/time.h"
#include "build/build_config.h"
#include "content/common/child_thread.h"
@@ -44,7 +45,7 @@ class GpuChannelManager : public IPC::Channel::Listener,
public:
GpuChannelManager(IPC::Message::Sender* browser_channel,
GpuWatchdog* watchdog,
- MessageLoop* io_message_loop,
+ base::MessageLoopProxy* io_message_loop,
base::WaitableEvent* shutdown_event);
~GpuChannelManager();
@@ -82,7 +83,7 @@ class GpuChannelManager : public IPC::Channel::Listener,
void OnLoseAllContexts();
- MessageLoop* io_message_loop_;
+ scoped_refptr<base::MessageLoopProxy> io_message_loop_;
base::WaitableEvent* shutdown_event_;
// Either an IPC channel to the browser or, if the GpuChannelManager is
diff --git a/content/common/pepper_plugin_registry.cc b/content/common/pepper_plugin_registry.cc
index b91e701..c8b1c78 100644
--- a/content/common/pepper_plugin_registry.cc
+++ b/content/common/pepper_plugin_registry.cc
@@ -219,10 +219,10 @@ PepperPluginRegistry::PepperPluginRegistry() {
}
}
-MessageLoop* PepperPluginRegistry::GetIPCMessageLoop() {
+base::MessageLoopProxy* PepperPluginRegistry::GetIPCMessageLoop() {
// This is called only in the renderer so we know we have a child process.
DCHECK(ChildProcess::current()) << "Must be in the renderer.";
- return ChildProcess::current()->io_message_loop();
+ return ChildProcess::current()->io_message_loop_proxy();
}
base::WaitableEvent* PepperPluginRegistry::GetShutdownEvent() {
diff --git a/content/common/pepper_plugin_registry.h b/content/common/pepper_plugin_registry.h
index 22de281..7dd9038 100644
--- a/content/common/pepper_plugin_registry.h
+++ b/content/common/pepper_plugin_registry.h
@@ -97,7 +97,7 @@ class PepperPluginRegistry
PepperPluginRegistry();
// Dispatcher::Delegate implementation.
- virtual MessageLoop* GetIPCMessageLoop();
+ virtual base::MessageLoopProxy* GetIPCMessageLoop();
virtual base::WaitableEvent* GetShutdownEvent();
virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet();
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index e3b90da..14bd90b 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -193,7 +193,7 @@ void GpuChildThread::OnInitialize() {
gpu_channel_manager_.reset(new GpuChannelManager(
this,
watchdog_thread_,
- ChildProcess::current()->io_message_loop(),
+ ChildProcess::current()->io_message_loop_proxy(),
ChildProcess::current()->GetShutDownEvent()));
// Ensure the browser process receives the GPU info before a reply to any
diff --git a/content/plugin/plugin_channel.cc b/content/plugin/plugin_channel.cc
index 9e2c2ce..cd2e99f 100644
--- a/content/plugin/plugin_channel.cc
+++ b/content/plugin/plugin_channel.cc
@@ -136,8 +136,8 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter {
IPC::Channel* channel_;
};
-PluginChannel* PluginChannel::GetPluginChannel(int renderer_id,
- MessageLoop* ipc_message_loop) {
+PluginChannel* PluginChannel::GetPluginChannel(
+ int renderer_id, base::MessageLoopProxy* ipc_message_loop) {
// Map renderer ID to a (single) channel to that process.
std::string channel_key = StringPrintf(
"%d.r%d", base::GetCurrentProcId(), renderer_id);
@@ -323,7 +323,8 @@ void PluginChannel::CleanUp() {
plugin_stubs_.clear();
}
-bool PluginChannel::Init(MessageLoop* ipc_message_loop, bool create_pipe_now) {
+bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop,
+ bool create_pipe_now) {
if (!PluginChannelBase::Init(ipc_message_loop, create_pipe_now))
return false;
diff --git a/content/plugin/plugin_channel.h b/content/plugin/plugin_channel.h
index 50b2054..b0edd9d 100644
--- a/content/plugin/plugin_channel.h
+++ b/content/plugin/plugin_channel.h
@@ -25,8 +25,8 @@ class PluginChannel : public PluginChannelBase {
// Get a new PluginChannel object for the current process to talk to the
// given renderer process. The renderer ID is an opaque unique ID generated
// by the browser.
- static PluginChannel* GetPluginChannel(int renderer_id,
- MessageLoop* ipc_message_loop);
+ static PluginChannel* GetPluginChannel(
+ int renderer_id, base::MessageLoopProxy* ipc_message_loop);
// Send a message to all renderers that the process is going to shutdown.
static void NotifyRenderersOfPendingShutdown();
@@ -62,7 +62,8 @@ class PluginChannel : public PluginChannelBase {
virtual void CleanUp();
// Overrides PluginChannelBase::Init.
- virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now);
+ virtual bool Init(base::MessageLoopProxy* ipc_message_loop,
+ bool create_pipe_now);
private:
class MessageFilter;
diff --git a/content/plugin/plugin_channel_base.cc b/content/plugin/plugin_channel_base.cc
index d78d48c..3b1aa4c 100644
--- a/content/plugin/plugin_channel_base.cc
+++ b/content/plugin/plugin_channel_base.cc
@@ -29,7 +29,7 @@ static int next_pipe_id = 0;
PluginChannelBase* PluginChannelBase::GetChannel(
const IPC::ChannelHandle& channel_handle, IPC::Channel::Mode mode,
- PluginChannelFactory factory, MessageLoop* ipc_message_loop,
+ PluginChannelFactory factory, base::MessageLoopProxy* ipc_message_loop,
bool create_pipe_now) {
scoped_refptr<PluginChannelBase> channel;
std::string channel_key = channel_handle.name;
@@ -112,7 +112,7 @@ NPObjectBase* PluginChannelBase::GetNPObjectListenerForRoute(int route_id) {
return iter->second;
}
-bool PluginChannelBase::Init(MessageLoop* ipc_message_loop,
+bool PluginChannelBase::Init(base::MessageLoopProxy* ipc_message_loop,
bool create_pipe_now) {
channel_.reset(new IPC::SyncChannel(
channel_handle_, mode_, this, ipc_message_loop, create_pipe_now,
diff --git a/content/plugin/plugin_channel_base.h b/content/plugin/plugin_channel_base.h
index 7062904f..fb69980 100644
--- a/content/plugin/plugin_channel_base.h
+++ b/content/plugin/plugin_channel_base.h
@@ -12,13 +12,16 @@
#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
#include "content/common/message_router.h"
#include "content/plugin/npobject_base.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_sync_channel.h"
#include "ui/gfx/native_widget_types.h"
+namespace base {
+class MessageLoopProxy;
+}
+
// Encapsulates an IPC channel between a renderer and a plugin process.
class PluginChannelBase : public IPC::Channel::Listener,
public IPC::Message::Sender,
@@ -77,7 +80,7 @@ class PluginChannelBase : public IPC::Channel::Listener,
// on the channel and its ref count is 0, the object deletes itself.
static PluginChannelBase* GetChannel(
const IPC::ChannelHandle& channel_handle, IPC::Channel::Mode mode,
- PluginChannelFactory factory, MessageLoop* ipc_message_loop,
+ PluginChannelFactory factory, base::MessageLoopProxy* ipc_message_loop,
bool create_pipe_now);
// Sends a message to all instances.
@@ -100,7 +103,8 @@ class PluginChannelBase : public IPC::Channel::Listener,
send_unblocking_only_during_unblock_dispatch_ = true;
}
- virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now);
+ virtual bool Init(base::MessageLoopProxy* ipc_message_loop,
+ bool create_pipe_now);
scoped_ptr<IPC::SyncChannel> channel_;
diff --git a/content/plugin/plugin_thread.cc b/content/plugin/plugin_thread.cc
index e0ce6d1..de08668 100644
--- a/content/plugin/plugin_thread.cc
+++ b/content/plugin/plugin_thread.cc
@@ -121,7 +121,7 @@ bool PluginThread::OnControlMessageReceived(const IPC::Message& msg) {
void PluginThread::OnCreateChannel(int renderer_id,
bool incognito) {
scoped_refptr<PluginChannel> channel(PluginChannel::GetPluginChannel(
- renderer_id, ChildProcess::current()->io_message_loop()));
+ renderer_id, ChildProcess::current()->io_message_loop_proxy()));
IPC::ChannelHandle channel_handle;
if (channel.get()) {
channel_handle.name = channel->channel_handle().name;
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index 70bf573f..c2070b6 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -58,8 +58,8 @@ bool PpapiThread::OnMessageReceived(const IPC::Message& msg) {
return true;
}
-MessageLoop* PpapiThread::GetIPCMessageLoop() {
- return ChildProcess::current()->io_message_loop();
+base::MessageLoopProxy* PpapiThread::GetIPCMessageLoop() {
+ return ChildProcess::current()->io_message_loop_proxy();
}
base::WaitableEvent* PpapiThread::GetShutdownEvent() {
diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h
index ea8593c..50bda11 100644
--- a/content/ppapi_plugin/ppapi_thread.h
+++ b/content/ppapi_plugin/ppapi_thread.h
@@ -33,7 +33,7 @@ class PpapiThread : public ChildThread,
virtual bool OnMessageReceived(const IPC::Message& msg);
// Dispatcher::Delegate implementation.
- virtual MessageLoop* GetIPCMessageLoop();
+ virtual base::MessageLoopProxy* GetIPCMessageLoop();
virtual base::WaitableEvent* GetShutdownEvent();
virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet();
diff --git a/content/renderer/audio_input_message_filter.h b/content/renderer/audio_input_message_filter.h
index ea927e6..f28ed6d 100644
--- a/content/renderer/audio_input_message_filter.h
+++ b/content/renderer/audio_input_message_filter.h
@@ -19,6 +19,8 @@
#include "ipc/ipc_channel_proxy.h"
#include "media/audio/audio_buffers_state.h"
+class MessageLoop;
+
class AudioInputMessageFilter : public IPC::ChannelProxy::MessageFilter {
public:
class Delegate {
diff --git a/content/renderer/audio_message_filter.h b/content/renderer/audio_message_filter.h
index 806dd60..316ac1b 100644
--- a/content/renderer/audio_message_filter.h
+++ b/content/renderer/audio_message_filter.h
@@ -19,6 +19,8 @@
#include "ipc/ipc_channel_proxy.h"
#include "media/audio/audio_buffers_state.h"
+class MessageLoop;
+
namespace base {
class Time;
}
diff --git a/content/renderer/gpu_channel_host.cc b/content/renderer/gpu_channel_host.cc
index 401e006..c73d32c 100644
--- a/content/renderer/gpu_channel_host.cc
+++ b/content/renderer/gpu_channel_host.cc
@@ -27,7 +27,7 @@ void GpuChannelHost::Connect(
// Open a channel to the GPU process.
channel_.reset(new IPC::SyncChannel(
channel_handle, IPC::Channel::MODE_CLIENT, this,
- ChildProcess::current()->io_message_loop(), true,
+ ChildProcess::current()->io_message_loop_proxy(), true,
ChildProcess::current()->GetShutDownEvent()));
// It is safe to send IPC messages before the channel completes the connection
diff --git a/content/renderer/plugin_channel_host.cc b/content/renderer/plugin_channel_host.cc
index 3d4993c..7fedc84 100644
--- a/content/renderer/plugin_channel_host.cc
+++ b/content/renderer/plugin_channel_host.cc
@@ -68,7 +68,8 @@ void PluginChannelHost::SetListening(bool flag) {
}
PluginChannelHost* PluginChannelHost::GetPluginChannelHost(
- const IPC::ChannelHandle& channel_handle, MessageLoop* ipc_message_loop) {
+ const IPC::ChannelHandle& channel_handle,
+ base::MessageLoopProxy* ipc_message_loop) {
PluginChannelHost* result =
static_cast<PluginChannelHost*>(PluginChannelBase::GetChannel(
channel_handle,
@@ -85,7 +86,7 @@ PluginChannelHost::PluginChannelHost() : expecting_shutdown_(false) {
PluginChannelHost::~PluginChannelHost() {
}
-bool PluginChannelHost::Init(MessageLoop* ipc_message_loop,
+bool PluginChannelHost::Init(base::MessageLoopProxy* ipc_message_loop,
bool create_pipe_now) {
bool ret = PluginChannelBase::Init(ipc_message_loop, create_pipe_now);
is_listening_filter_ = new IsListeningFilter;
diff --git a/content/renderer/plugin_channel_host.h b/content/renderer/plugin_channel_host.h
index 3e84412..ec6bfed 100644
--- a/content/renderer/plugin_channel_host.h
+++ b/content/renderer/plugin_channel_host.h
@@ -18,9 +18,11 @@ class NPObjectBase;
class PluginChannelHost : public PluginChannelBase {
public:
static PluginChannelHost* GetPluginChannelHost(
- const IPC::ChannelHandle& channel_handle, MessageLoop* ipc_message_loop);
+ const IPC::ChannelHandle& channel_handle,
+ base::MessageLoopProxy* ipc_message_loop);
- virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now);
+ virtual bool Init(base::MessageLoopProxy* ipc_message_loop,
+ bool create_pipe_now);
virtual int GenerateRouteID();
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index e4575cf..0667ef4 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -298,7 +298,7 @@ bool WebPluginDelegateProxy::Initialize(
scoped_refptr<PluginChannelHost> channel_host(
PluginChannelHost::GetPluginChannelHost(
- channel_handle, ChildProcess::current()->io_message_loop()));
+ channel_handle, ChildProcess::current()->io_message_loop_proxy()));
if (!channel_host.get())
return false;
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index c219829..8f981f4 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -4,7 +4,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_logging.h"
#include "ipc/ipc_message_utils.h"
@@ -60,14 +59,17 @@ void ChannelProxy::MessageFilter::OnDestruct() const {
//------------------------------------------------------------------------------
ChannelProxy::Context::Context(Channel::Listener* listener,
- MessageLoop* ipc_message_loop)
- : listener_message_loop_(MessageLoop::current()),
+ base::MessageLoopProxy* ipc_message_loop)
+ : listener_message_loop_(base::MessageLoopProxy::CreateForCurrentThread()),
listener_(listener),
ipc_message_loop_(ipc_message_loop),
peer_pid_(0),
channel_connected_called_(false) {
}
+ChannelProxy::Context::~Context() {
+}
+
void ChannelProxy::Context::CreateChannel(const IPC::ChannelHandle& handle,
const Channel::Mode& mode) {
DCHECK(channel_.get() == NULL);
@@ -280,14 +282,14 @@ void ChannelProxy::Context::OnDispatchError() {
ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
Channel::Listener* listener,
- MessageLoop* ipc_thread)
+ base::MessageLoopProxy* ipc_thread)
: context_(new Context(listener, ipc_thread)) {
Init(channel_handle, mode, ipc_thread, true);
}
ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
- MessageLoop* ipc_thread,
+ base::MessageLoopProxy* ipc_thread,
Context* context,
bool create_pipe_now)
: context_(context) {
@@ -299,7 +301,8 @@ ChannelProxy::~ChannelProxy() {
}
void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle,
- Channel::Mode mode, MessageLoop* ipc_thread_loop,
+ Channel::Mode mode,
+ base::MessageLoopProxy* ipc_thread_loop,
bool create_pipe_now) {
#if defined(OS_POSIX)
// When we are creating a server on POSIX, we need its file descriptor
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h
index 0c0176f..2b1dea8 100644
--- a/ipc/ipc_channel_proxy.h
+++ b/ipc/ipc_channel_proxy.h
@@ -2,20 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef IPC_IPC_CHANNEL_PROXY_H__
-#define IPC_IPC_CHANNEL_PROXY_H__
+#ifndef IPC_IPC_CHANNEL_PROXY_H_
+#define IPC_IPC_CHANNEL_PROXY_H_
#pragma once
#include <vector>
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop_proxy.h"
#include "base/synchronization/lock.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_handle.h"
-class MessageLoop;
-
namespace IPC {
class SendTask;
@@ -110,7 +109,7 @@ class ChannelProxy : public Message::Sender {
ChannelProxy(const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
Channel::Listener* listener,
- MessageLoop* ipc_thread_loop);
+ base::MessageLoopProxy* ipc_thread_loop);
virtual ~ChannelProxy();
@@ -156,7 +155,7 @@ class ChannelProxy : public Message::Sender {
// immediately. Otherwise it's created on the IO thread.
ChannelProxy(const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
- MessageLoop* ipc_thread_loop,
+ base::MessageLoopProxy* ipc_thread_loop,
Context* context,
bool create_pipe_now);
@@ -164,9 +163,11 @@ class ChannelProxy : public Message::Sender {
class Context : public base::RefCountedThreadSafe<Context>,
public Channel::Listener {
public:
- Context(Channel::Listener* listener, MessageLoop* ipc_thread);
+ Context(Channel::Listener* listener, base::MessageLoopProxy* ipc_thread);
void ClearIPCMessageLoop() { ipc_message_loop_ = NULL; }
- MessageLoop* ipc_message_loop() const { return ipc_message_loop_; }
+ base::MessageLoopProxy* ipc_message_loop() const {
+ return ipc_message_loop_.get();
+ }
const std::string& channel_id() const { return channel_id_; }
// Dispatches a message on the listener thread.
@@ -174,7 +175,7 @@ class ChannelProxy : public Message::Sender {
protected:
friend class base::RefCountedThreadSafe<Context>;
- virtual ~Context() { }
+ virtual ~Context();
// IPC::Channel::Listener methods:
virtual bool OnMessageReceived(const Message& message);
@@ -215,12 +216,12 @@ class ChannelProxy : public Message::Sender {
void OnDispatchConnected();
void OnDispatchError();
- MessageLoop* listener_message_loop_;
+ scoped_refptr<base::MessageLoopProxy> listener_message_loop_;
Channel::Listener* listener_;
// List of filters. This is only accessed on the IPC thread.
std::vector<scoped_refptr<MessageFilter> > filters_;
- MessageLoop* ipc_message_loop_;
+ scoped_refptr<base::MessageLoopProxy> ipc_message_loop_;
scoped_ptr<Channel> channel_;
std::string channel_id_;
int peer_pid_;
@@ -239,7 +240,7 @@ class ChannelProxy : public Message::Sender {
friend class SendTask;
void Init(const IPC::ChannelHandle& channel_handle, Channel::Mode mode,
- MessageLoop* ipc_thread_loop, bool create_pipe_now);
+ base::MessageLoopProxy* ipc_thread_loop, bool create_pipe_now);
// By maintaining this indirection (ref-counted) to our internal state, we
// can safely be destroyed while the background thread continues to do stuff
@@ -249,4 +250,4 @@ class ChannelProxy : public Message::Sender {
} // namespace IPC
-#endif // IPC_IPC_CHANNEL_PROXY_H__
+#endif // IPC_IPC_CHANNEL_PROXY_H_
diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc
index 97e1c18..f3a6a47 100644
--- a/ipc/ipc_sync_channel.cc
+++ b/ipc/ipc_sync_channel.cc
@@ -6,7 +6,6 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/message_loop.h"
#include "base/threading/thread_local.h"
#include "base/synchronization/waitable_event.h"
#include "base/synchronization/waitable_event_watcher.h"
@@ -134,7 +133,9 @@ class SyncChannel::ReceivedSyncMsgQueue :
}
WaitableEvent* dispatch_event() { return &dispatch_event_; }
- MessageLoop* listener_message_loop() { return listener_message_loop_; }
+ base::MessageLoopProxy* listener_message_loop() {
+ return listener_message_loop_;
+ }
// Holds a pointer to the per-thread ReceivedSyncMsgQueue object.
static base::LazyInstance<base::ThreadLocalPointer<ReceivedSyncMsgQueue> >
@@ -168,7 +169,7 @@ class SyncChannel::ReceivedSyncMsgQueue :
// as manual reset.
ReceivedSyncMsgQueue() :
dispatch_event_(true, false),
- listener_message_loop_(MessageLoop::current()),
+ listener_message_loop_(base::MessageLoopProxy::CreateForCurrentThread()),
task_pending_(false),
listener_count_(0),
top_send_done_watcher_(NULL) {
@@ -192,7 +193,7 @@ class SyncChannel::ReceivedSyncMsgQueue :
// sender needs its reply before it can reply to our original synchronous
// message.
WaitableEvent dispatch_event_;
- MessageLoop* listener_message_loop_;
+ scoped_refptr<base::MessageLoopProxy> listener_message_loop_;
base::Lock message_lock_;
bool task_pending_;
int listener_count_;
@@ -208,7 +209,7 @@ base::LazyInstance<base::ThreadLocalPointer<SyncChannel::ReceivedSyncMsgQueue> >
SyncChannel::SyncContext::SyncContext(
Channel::Listener* listener,
- MessageLoop* ipc_thread,
+ base::MessageLoopProxy* ipc_thread,
WaitableEvent* shutdown_event)
: ChannelProxy::Context(listener, ipc_thread),
received_sync_msgs_(ReceivedSyncMsgQueue::AddContext()),
@@ -371,7 +372,7 @@ SyncChannel::SyncChannel(
const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
Channel::Listener* listener,
- MessageLoop* ipc_message_loop,
+ base::MessageLoopProxy* ipc_message_loop,
bool create_pipe_now,
WaitableEvent* shutdown_event)
: ChannelProxy(
diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h
index 549c35d..8cea5a8 100644
--- a/ipc/ipc_sync_channel.h
+++ b/ipc/ipc_sync_channel.h
@@ -66,7 +66,7 @@ class SyncChannel : public ChannelProxy,
SyncChannel(const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
Channel::Listener* listener,
- MessageLoop* ipc_message_loop,
+ base::MessageLoopProxy* ipc_message_loop,
bool create_pipe_now,
base::WaitableEvent* shutdown_event);
virtual ~SyncChannel();
@@ -101,7 +101,7 @@ class SyncChannel : public ChannelProxy,
public base::WaitableEventWatcher::Delegate {
public:
SyncContext(Channel::Listener* listener,
- MessageLoop* ipc_thread,
+ base::MessageLoopProxy* ipc_thread,
base::WaitableEvent* shutdown_event);
// Adds information about an outgoing sync message to the context so that
diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc
index 6952aac..fe17c14 100644
--- a/ipc/ipc_sync_channel_unittest.cc
+++ b/ipc/ipc_sync_channel_unittest.cc
@@ -166,7 +166,7 @@ class Worker : public Channel::Listener, public Message::Sender {
// Link ipc_thread_, listener_thread_ and channel_ altogether.
StartThread(&ipc_thread_, MessageLoop::TYPE_IO);
channel_.reset(new SyncChannel(
- channel_name_, mode_, this, ipc_thread_.message_loop(), true,
+ channel_name_, mode_, this, ipc_thread_.message_loop_proxy(), true,
&shutdown_event_));
channel_created_->Signal();
Run();
@@ -1250,7 +1250,7 @@ class RestrictedDispatchClient : public Worker {
scoped_ptr<SyncChannel> non_restricted_channel(new SyncChannel(
"non_restricted_channel", Channel::MODE_CLIENT, this,
- ipc_thread().message_loop(), true, shutdown_event()));
+ ipc_thread().message_loop_proxy(), true, shutdown_event()));
server_->ListenerThread()->message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(server_, &RestrictedDispatchServer::OnDoPing, 2));
diff --git a/ipc/ipc_tests.cc b/ipc/ipc_tests.cc
index 93276f4..d8e3aeb 100644
--- a/ipc/ipc_tests.cc
+++ b/ipc/ipc_tests.cc
@@ -251,7 +251,7 @@ TEST_F(IPCChannelTest, ChannelProxyTest) {
{
// setup IPC channel proxy
IPC::ChannelProxy chan(kTestClientChannel, IPC::Channel::MODE_SERVER,
- &channel_listener, thread.message_loop());
+ &channel_listener, thread.message_loop_proxy());
channel_listener.Init(&chan);
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc
index f5d5668..b34ce48 100644
--- a/ppapi/proxy/dispatcher.cc
+++ b/ppapi/proxy/dispatcher.cc
@@ -250,7 +250,7 @@ const void* Dispatcher::GetLocalInterface(const char* interface_name) {
return local_get_interface_(interface_name);
}
-MessageLoop* Dispatcher::GetIPCMessageLoop() {
+base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() {
return delegate()->GetIPCMessageLoop();
}
diff --git a/ppapi/proxy/dispatcher.h b/ppapi/proxy/dispatcher.h
index 2d900b1..05f61d3 100644
--- a/ppapi/proxy/dispatcher.h
+++ b/ppapi/proxy/dispatcher.h
@@ -69,7 +69,7 @@ class Dispatcher : public ProxyChannel {
// TODO(brettw) remove this. It's a hack to support the Flash
// ModuleLocalThreadAdapter. When the thread stuff is sorted out, this
// implementation detail should be hidden.
- MessageLoop* GetIPCMessageLoop();
+ base::MessageLoopProxy* GetIPCMessageLoop();
// Adds the given filter to the IO thread. Takes ownership of the pointer.
// TODO(brettw) remove this. It's a hack to support the Flash
diff --git a/ppapi/proxy/ppb_flash_file_proxy.cc b/ppapi/proxy/ppb_flash_file_proxy.cc
index 8b55b4a..9e2aab66 100644
--- a/ppapi/proxy/ppb_flash_file_proxy.cc
+++ b/ppapi/proxy/ppb_flash_file_proxy.cc
@@ -9,7 +9,7 @@
#include <vector>
#include "base/logging.h"
-#include "base/message_loop.h"
+#include "base/message_loop_proxy.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "build/build_config.h"
@@ -111,10 +111,10 @@ class ModuleLocalThreadAdapter
base::Lock lock_;
- MessageLoop* main_thread_;
+ scoped_refptr<base::MessageLoopProxy> main_thread_;
// Will be NULL before an instance routing is added.
- MessageLoop* io_thread_;
+ scoped_refptr<base::MessageLoopProxy> io_thread_;
typedef std::map<PP_Instance, Dispatcher*> InstanceToDispatcher;
InstanceToDispatcher instance_to_dispatcher_;
@@ -188,8 +188,7 @@ bool ModuleLocalThreadAdapter::Filter::OnMessageReceived(
}
ModuleLocalThreadAdapter::ModuleLocalThreadAdapter()
- : main_thread_(MessageLoop::current()),
- io_thread_(NULL) {
+ : main_thread_(base::MessageLoopProxy::CreateForCurrentThread()) {
}
void ModuleLocalThreadAdapter::AddInstanceRouting(PP_Instance instance,
@@ -197,8 +196,8 @@ void ModuleLocalThreadAdapter::AddInstanceRouting(PP_Instance instance,
base::AutoLock lock(lock_);
// Now that we've had contact with a dispatcher, we can set up the IO thread.
- DCHECK(MessageLoop::current() == main_thread_);
- if (!io_thread_)
+ DCHECK(main_thread_->BelongsToCurrentThread());
+ if (!io_thread_.get())
io_thread_ = dispatcher->GetIPCMessageLoop();
// Set up the instance -> dispatcher routing.
@@ -275,7 +274,7 @@ bool ModuleLocalThreadAdapter::Send(PP_Instance instance, IPC::Message* msg) {
dispatcher = found->second;
}
- if (MessageLoop::current() == main_thread_) {
+ if (main_thread_->BelongsToCurrentThread()) {
// Easy case: We're on the same thread as the dispatcher, so we don't need
// a lock to access it, and we can just use the normal sync channel stuff
// to handle the message. Actually, we MUST use the normal sync channel
diff --git a/ppapi/proxy/proxy_channel.h b/ppapi/proxy/proxy_channel.h
index 8df6893..3dbb977 100644
--- a/ppapi/proxy/proxy_channel.h
+++ b/ppapi/proxy/proxy_channel.h
@@ -11,9 +11,8 @@
#include "ipc/ipc_platform_file.h"
#include "ipc/ipc_sync_channel.h"
-class MessageLoop;
-
namespace base {
+class MessageLoopProxy;
class WaitableEvent;
}
@@ -34,7 +33,7 @@ class ProxyChannel : public IPC::Channel::Listener,
class Delegate {
public:
// Returns the dedicated message loop for processing IPC requests.
- virtual MessageLoop* GetIPCMessageLoop() = 0;
+ virtual base::MessageLoopProxy* GetIPCMessageLoop() = 0;
// Returns the event object that becomes signalled when the main thread's
// message loop exits.