diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-02 18:00:49 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-02 18:00:49 +0000 |
commit | 92bf906d13ba00204d3f2fc338340ccc670ed545 (patch) | |
tree | 28a8803d9a9a0810d2f9d93576d20d1cdf4d63b6 /ppapi | |
parent | 68a008e82da08b0bf7d421049f0a292b99b88048 (diff) | |
download | chromium_src-92bf906d13ba00204d3f2fc338340ccc670ed545.zip chromium_src-92bf906d13ba00204d3f2fc338340ccc670ed545.tar.gz chromium_src-92bf906d13ba00204d3f2fc338340ccc670ed545.tar.bz2 |
Switch IPC::ChannelProxy to use MessageLoopProxy instead of MessageLoop. This allows us to remove usage of the IOThread object, and generally makes IPC::ChannelProxy more robust for future uses.
Review URL: http://codereview.chromium.org/6901146
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83741 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/dispatcher.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/dispatcher.h | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppb_flash_file_proxy.cc | 15 | ||||
-rw-r--r-- | ppapi/proxy/proxy_channel.h | 5 |
4 files changed, 11 insertions, 13 deletions
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. |