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

Unified Diff: ppapi/proxy/host_dispatcher.cc

Issue 589213003: PPAPI: Never re-enter JavaScript for PostMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make MessageChannel observer clean up more reliably, guarantee HungPluginFilter stays alive long en… Created 6 years, 3 months 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
« no previous file with comments | « ppapi/proxy/host_dispatcher.h ('k') | ppapi/proxy/ppapi_proxy_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/host_dispatcher.cc
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index 8f3833f5ddff7fa8f6a8cec321b59911f77b60bb..ee7e91905b111ee9e5c3d06d82db5e359a05838c 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -61,13 +61,12 @@ class BoolRestorer {
HostDispatcher::HostDispatcher(PP_Module module,
PP_GetInterface_Func local_get_interface,
- SyncMessageStatusReceiver* sync_status,
const PpapiPermissions& permissions)
: Dispatcher(local_get_interface, permissions),
- sync_status_(sync_status),
pp_module_(module),
ppb_proxy_(NULL),
- allow_plugin_reentrancy_(false) {
+ allow_plugin_reentrancy_(false),
+ weak_ptr_factory_(this) {
if (!g_module_to_dispatcher)
g_module_to_dispatcher = new ModuleToDispatcherMap;
(*g_module_to_dispatcher)[pp_module_] = this;
@@ -94,8 +93,6 @@ bool HostDispatcher::InitHostWithChannel(
if (!Dispatcher::InitWithChannel(delegate, peer_pid, channel_handle,
is_client))
return false;
- AddIOThreadMessageFilter(sync_status_.get());
-
Send(new PpapiMsg_SetPreferences(preferences));
return true;
}
@@ -157,9 +154,11 @@ bool HostDispatcher::Send(IPC::Message* msg) {
// destroys the plugin module and in turn the dispatcher.
ScopedModuleReference scoped_ref(this);
- sync_status_->BeginBlockOnSyncMessage();
+ FOR_EACH_OBSERVER(SyncMessageStatusObserver, sync_status_observer_list_,
+ BeginBlockOnSyncMessage());
bool result = Dispatcher::Send(msg);
- sync_status_->EndBlockOnSyncMessage();
+ FOR_EACH_OBSERVER(SyncMessageStatusObserver, sync_status_observer_list_,
+ EndBlockOnSyncMessage());
return result;
} else {
@@ -240,6 +239,19 @@ const void* HostDispatcher::GetProxiedInterface(const std::string& iface_name) {
return NULL;
}
+base::Closure HostDispatcher::AddSyncMessageStatusObserver(
+ SyncMessageStatusObserver* obs) {
+ sync_status_observer_list_.AddObserver(obs);
+ return base::Bind(&HostDispatcher::RemoveSyncMessageStatusObserver,
+ weak_ptr_factory_.GetWeakPtr(),
+ obs);
+}
+
+void HostDispatcher::RemoveSyncMessageStatusObserver(
+ SyncMessageStatusObserver* obs) {
+ sync_status_observer_list_.RemoveObserver(obs);
+}
+
void HostDispatcher::AddFilter(IPC::Listener* listener) {
filters_.push_back(listener);
}
« no previous file with comments | « ppapi/proxy/host_dispatcher.h ('k') | ppapi/proxy/ppapi_proxy_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698