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

Unified Diff: ppapi/proxy/host_dispatcher.h

Issue 589213003: PPAPI: Never re-enter JavaScript for PostMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup/fixes 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
Index: ppapi/proxy/host_dispatcher.h
diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h
index c1ba15feb1144ca0691665e2094d00ea3a562fc9..4c58a2450dba0a0b9194a162f1ce022dda3ea140 100644
--- a/ppapi/proxy/host_dispatcher.h
+++ b/ppapi/proxy/host_dispatcher.h
@@ -11,6 +11,7 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
+#include "base/observer_list.h"
#include "base/process/process.h"
#include "ipc/message_filter.h"
#include "ppapi/c/pp_instance.h"
@@ -27,11 +28,13 @@ namespace proxy {
class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
public:
// This interface receives notifications about sync messages being sent by
- // the dispatcher to the plugin process. It is used to detect a hung plugin.
+ // the dispatcher to the plugin process. Some parts of Chrome may need to
+ // know whether we are sending a synchronous message to the plugin; e.g. to
+ // detect a hung plugin or to avoid re-entering JavaScript.
//
// Note that there can be nested sync messages, so the begin/end status
// actually represents a stack of blocking messages.
- class SyncMessageStatusReceiver : public IPC::MessageFilter {
+ class SyncMessageStatusObserver {
public:
// Notification that a sync message is about to be sent out.
virtual void BeginBlockOnSyncMessage() = 0;
@@ -41,7 +44,7 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
virtual void EndBlockOnSyncMessage() = 0;
protected:
- virtual ~SyncMessageStatusReceiver() {}
+ virtual ~SyncMessageStatusObserver() {}
};
// Constructor for the renderer side. This will take a reference to the
@@ -50,7 +53,7 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
// You must call InitHostWithChannel after the constructor.
HostDispatcher(PP_Module module,
PP_GetInterface_Func local_get_interface,
- SyncMessageStatusReceiver* sync_status,
+ scoped_refptr<IPC::MessageFilter> sync_filter,
const PpapiPermissions& permissions);
~HostDispatcher();
@@ -102,6 +105,9 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
// Returns the proxy interface for talking to the implementation.
const PPB_Proxy_Private* ppb_proxy() const { return ppb_proxy_; }
+ void AddSyncMessageStatusObserver(SyncMessageStatusObserver* obs);
+ void RemoveSyncMessageStatusObserver(SyncMessageStatusObserver* obs);
+
void AddFilter(IPC::Listener* listener);
protected:
@@ -114,7 +120,8 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
const std::string& source,
const std::string& value);
- scoped_refptr<SyncMessageStatusReceiver> sync_status_;
+ // TODO/FIXME(dmichael): Do we still need this to guarantee proper lifetime???
+ scoped_refptr<IPC::MessageFilter> sync_filter_;
raymes 2014/09/23 02:57:09 It looks like ChannelProxy::Context::AddFilter doe
dmichael (off chromium) 2014/09/23 17:38:42 Agreed.
PP_Module pp_module_;
@@ -133,6 +140,8 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
// ultimately call back into the plugin.
bool allow_plugin_reentrancy_;
+ ObserverList<SyncMessageStatusObserver> sync_status_observer_list_;
+
std::vector<IPC::Listener*> filters_;
DISALLOW_COPY_AND_ASSIGN(HostDispatcher);

Powered by Google App Engine
This is Rietveld 408576698