Support PPB_Flash_ModileLocal blocking calls from background threads. This is
a temporary stopgap to allow these specific functions to be used until the
entire proxy can support threading.
There are two functions that set up and clean up the routing information in
the interface. These are necessary because the global dispatcher routing
information is not threadsafe.
When used from the main thread, the code works the same as before. When used
from a background thread, we create a sync message, send it to the I/O thread,
and block the sending thread until the reply is received. There is no handling
of other incoming blocking messages (which are impossible), and no other
Pepper functions are supported from the background thread.
TEST=manual
BUG=none
Review URL: http://codereview.chromium.org/6875009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81814 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc
index ebdc718..a4d9798 100644
--- a/ppapi/proxy/dispatcher.cc
+++ b/ppapi/proxy/dispatcher.cc
@@ -192,6 +192,7 @@
bool Dispatcher::InitWithChannel(Delegate* delegate,
const IPC::ChannelHandle& channel_handle,
bool is_client) {
+ delegate_ = delegate;
IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT
: IPC::Channel::MODE_SERVER;
channel_.reset(new IPC::SyncChannel(channel_handle, mode, this,
@@ -297,6 +298,15 @@
return out_handle;
}
+MessageLoop* Dispatcher::GetIPCMessageLoop() {
+ return delegate_->GetIPCMessageLoop();
+}
+
+void Dispatcher::AddIOThreadMessageFilter(
+ IPC::ChannelProxy::MessageFilter* filter) {
+ channel_->AddFilter(filter);
+}
+
bool Dispatcher::Send(IPC::Message* msg) {
if (test_sink_)
return test_sink_->Send(msg);