Index: ppapi/proxy/host_dispatcher.cc |
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc |
index d1c28f7236e1910cb0846fb6ff4d2c048b3b5131..9256fe9459e9f4c40a003204bd85e0be8f2cf5d4 100644 |
--- a/ppapi/proxy/host_dispatcher.cc |
+++ b/ppapi/proxy/host_dispatcher.cc |
@@ -63,8 +63,10 @@ class BoolRestorer { |
HostDispatcher::HostDispatcher(base::ProcessHandle remote_process_handle, |
PP_Module module, |
- GetInterfaceFunc local_get_interface) |
+ GetInterfaceFunc local_get_interface, |
+ SyncMessageStatusReceiver* sync_status) |
: Dispatcher(remote_process_handle, local_get_interface), |
+ sync_status_(sync_status), |
pp_module_(module), |
ppb_proxy_(NULL), |
allow_plugin_reentrancy_(false) { |
@@ -92,6 +94,8 @@ bool HostDispatcher::InitHostWithChannel( |
const ppapi::Preferences& preferences) { |
if (!Dispatcher::InitWithChannel(delegate, channel_handle, is_client)) |
return false; |
+ AddIOThreadMessageFilter(sync_status_.get()); |
+ |
Send(new PpapiMsg_SetPreferences(preferences)); |
return true; |
} |
@@ -152,7 +156,12 @@ bool HostDispatcher::Send(IPC::Message* msg) { |
// waiting for the reply, dispatches an incoming ExecuteScript call which |
// destroys the plugin module and in turn the dispatcher. |
ScopedModuleReference scoped_ref(this); |
- return Dispatcher::Send(msg); |
+ |
+ sync_status_->BeginBlockOnSyncMessage(); |
+ bool result = Dispatcher::Send(msg); |
+ sync_status_->EndBlockOnSyncMessage(); |
+ |
+ return result; |
} else { |
// We don't want to have a scoped ref for async message cases since since |
// async messages are sent during module desruction. In this case, the |