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

Side by Side Diff: ppapi/proxy/host_dispatcher.h

Issue 10014013: Add a hang monitor for Pepper plugins (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/dispatcher.cc ('k') | ppapi/proxy/host_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_PROXY_HOST_DISPATCHER_H_ 5 #ifndef PPAPI_PROXY_HOST_DISPATCHER_H_
6 #define PPAPI_PROXY_HOST_DISPATCHER_H_ 6 #define PPAPI_PROXY_HOST_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/process.h" 14 #include "base/process.h"
15 #include "ipc/ipc_channel_proxy.h"
14 #include "ppapi/c/pp_instance.h" 16 #include "ppapi/c/pp_instance.h"
15 #include "ppapi/proxy/dispatcher.h" 17 #include "ppapi/proxy/dispatcher.h"
16 #include "ppapi/shared_impl/function_group_base.h" 18 #include "ppapi/shared_impl/function_group_base.h"
17 19
18 struct PPB_Proxy_Private; 20 struct PPB_Proxy_Private;
19 21
20 namespace ppapi { 22 namespace ppapi {
21 23
22 struct Preferences; 24 struct Preferences;
23 25
24 namespace proxy { 26 namespace proxy {
25 27
26 class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher { 28 class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher {
27 public: 29 public:
28 // Constructor for the renderer side. 30 // This interface receives notifications about sync messages being sent by
31 // the dispatcher to the plugin process. It is used to detect a hung plugin.
32 //
33 // Note that there can be nested sync messages, so the begin/end status
34 // actually represents a stack of blocking messages.
35 class SyncMessageStatusReceiver : public IPC::ChannelProxy::MessageFilter {
36 public:
37 virtual ~SyncMessageStatusReceiver() {}
38
39 // Notification that a sync message is about to be sent out.
40 virtual void BeginBlockOnSyncMessage() = 0;
41
42 // Notification that a sync message reply was received and the dispatcher
43 // is no longer blocked on a sync message.
44 virtual void EndBlockOnSyncMessage() = 0;
45 };
46
47 // Constructor for the renderer side. This will take a reference to the
48 // SyncMessageStatusReceiver.
29 // 49 //
30 // You must call InitHostWithChannel after the constructor. 50 // You must call InitHostWithChannel after the constructor.
31 HostDispatcher(base::ProcessHandle host_process_handle, 51 HostDispatcher(base::ProcessHandle host_process_handle,
32 PP_Module module, 52 PP_Module module,
33 GetInterfaceFunc local_get_interface); 53 GetInterfaceFunc local_get_interface,
54 SyncMessageStatusReceiver* sync_status);
34 ~HostDispatcher(); 55 ~HostDispatcher();
35 56
36 // You must call this function before anything else. Returns true on success. 57 // You must call this function before anything else. Returns true on success.
37 // The delegate pointer must outlive this class, ownership is not 58 // The delegate pointer must outlive this class, ownership is not
38 // transferred. 59 // transferred.
39 virtual bool InitHostWithChannel(Delegate* delegate, 60 virtual bool InitHostWithChannel(Delegate* delegate,
40 const IPC::ChannelHandle& channel_handle, 61 const IPC::ChannelHandle& channel_handle,
41 bool is_client, 62 bool is_client,
42 const Preferences& preferences); 63 const Preferences& preferences);
43 64
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 protected: 104 protected:
84 // Overridden from Dispatcher. 105 // Overridden from Dispatcher.
85 virtual void OnInvalidMessageReceived(); 106 virtual void OnInvalidMessageReceived();
86 107
87 private: 108 private:
88 void OnHostMsgLogWithSource(PP_Instance instance, 109 void OnHostMsgLogWithSource(PP_Instance instance,
89 int int_log_level, 110 int int_log_level,
90 const std::string& source, 111 const std::string& source,
91 const std::string& value); 112 const std::string& value);
92 113
114 scoped_refptr<SyncMessageStatusReceiver> sync_status_;
115
93 PP_Module pp_module_; 116 PP_Module pp_module_;
94 117
95 // Maps interface name to whether that interface is supported. If an interface 118 // Maps interface name to whether that interface is supported. If an interface
96 // name is not in the map, that implies that we haven't queried for it yet. 119 // name is not in the map, that implies that we haven't queried for it yet.
97 typedef base::hash_map<std::string, bool> PluginSupportedMap; 120 typedef base::hash_map<std::string, bool> PluginSupportedMap;
98 PluginSupportedMap plugin_supported_; 121 PluginSupportedMap plugin_supported_;
99 122
100 // Guaranteed non-NULL. 123 // Guaranteed non-NULL.
101 const PPB_Proxy_Private* ppb_proxy_; 124 const PPB_Proxy_Private* ppb_proxy_;
102 125
(...skipping 21 matching lines...) Expand all
124 private: 147 private:
125 HostDispatcher* dispatcher_; 148 HostDispatcher* dispatcher_;
126 149
127 DISALLOW_COPY_AND_ASSIGN(ScopedModuleReference); 150 DISALLOW_COPY_AND_ASSIGN(ScopedModuleReference);
128 }; 151 };
129 152
130 } // namespace proxy 153 } // namespace proxy
131 } // namespace ppapi 154 } // namespace ppapi
132 155
133 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_ 156 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/dispatcher.cc ('k') | ppapi/proxy/host_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698