summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/host_dispatcher.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-13 19:49:29 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-13 19:49:29 +0000
commit8be45847f76ec798c1241ed7e98cfb19f68b7e96 (patch)
tree7198fc01d68a1a5f4110c3167635f2000444054c /ppapi/proxy/host_dispatcher.h
parent43095f23d76d2ae3d50e1e8bb55c71152025d76c (diff)
downloadchromium_src-8be45847f76ec798c1241ed7e98cfb19f68b7e96.zip
chromium_src-8be45847f76ec798c1241ed7e98cfb19f68b7e96.tar.gz
chromium_src-8be45847f76ec798c1241ed7e98cfb19f68b7e96.tar.bz2
This adds a hang monitor for Pepper plugins. It monitors sync messages on the I/O thread of the renderer and sends a message to the browser if it's blocked for too long.
The browser will show an infobar allowing you to terminate the plugin. BUG=122795 Review URL: https://chromiumcodereview.appspot.com/10014013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132245 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/host_dispatcher.h')
-rw-r--r--ppapi/proxy/host_dispatcher.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h
index 1bacdfa..2d44979 100644
--- a/ppapi/proxy/host_dispatcher.h
+++ b/ppapi/proxy/host_dispatcher.h
@@ -9,8 +9,10 @@
#include <string>
#include <vector>
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/process.h"
+#include "ipc/ipc_channel_proxy.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/proxy/dispatcher.h"
#include "ppapi/shared_impl/function_group_base.h"
@@ -25,12 +27,31 @@ namespace proxy {
class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
public:
- // Constructor for the renderer side.
+ // This interface receives notifications about sync messages being sent by
+ // the dispatcher to the plugin process. It is used to detect a hung plugin.
+ //
+ // Note that there can be nested sync messages, so the begin/end status
+ // actually represents a stack of blocking messages.
+ class SyncMessageStatusReceiver : public IPC::ChannelProxy::MessageFilter {
+ public:
+ virtual ~SyncMessageStatusReceiver() {}
+
+ // Notification that a sync message is about to be sent out.
+ virtual void BeginBlockOnSyncMessage() = 0;
+
+ // Notification that a sync message reply was received and the dispatcher
+ // is no longer blocked on a sync message.
+ virtual void EndBlockOnSyncMessage() = 0;
+ };
+
+ // Constructor for the renderer side. This will take a reference to the
+ // SyncMessageStatusReceiver.
//
// You must call InitHostWithChannel after the constructor.
HostDispatcher(base::ProcessHandle host_process_handle,
PP_Module module,
- GetInterfaceFunc local_get_interface);
+ GetInterfaceFunc local_get_interface,
+ SyncMessageStatusReceiver* sync_status);
~HostDispatcher();
// You must call this function before anything else. Returns true on success.
@@ -90,6 +111,8 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
const std::string& source,
const std::string& value);
+ scoped_refptr<SyncMessageStatusReceiver> sync_status_;
+
PP_Module pp_module_;
// Maps interface name to whether that interface is supported. If an interface