Index: content/browser/renderer_host/pepper/browser_ppapi_host_impl.h |
diff --git a/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h b/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h |
index 101e0ebae0e29111ec4d6425a5f3a8f1be9e9e8e..f9ada6c6f2daec5ff4b5173cf813221989df7bdc 100644 |
--- a/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h |
+++ b/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h |
@@ -11,8 +11,10 @@ |
#include "base/basictypes.h" |
#include "base/compiler_specific.h" |
#include "base/files/file_path.h" |
+#include "base/memory/linked_ptr.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/observer_list.h" |
#include "base/process/process.h" |
#include "content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h" |
#include "content/browser/renderer_host/pepper/ssl_context_helper.h" |
@@ -31,6 +33,11 @@ namespace content { |
class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { |
public: |
+ class InstanceObserver { |
+ public: |
+ virtual void OnThrottleStateChanged(bool is_throttled) = 0; |
dmichael (off chromium)
2015/02/18 18:58:09
Maybe add a note about what this function means an
tommycli
2015/02/18 19:19:09
Done. I assume it's okay that it's invoked on IO t
dmichael (off chromium)
2015/02/18 20:31:40
Right, I just want to make sure it's documented ri
tommycli
2015/02/18 21:31:17
Done.
|
+ }; |
+ |
// The creator is responsible for calling set_plugin_process as soon as it is |
// known (we start the process asynchronously so it won't be known when this |
// object is created). |
@@ -73,6 +80,12 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { |
const PepperRendererInstanceData& instance_data); |
void DeleteInstance(PP_Instance instance); |
+ void AddInstanceObserver(PP_Instance instance, InstanceObserver* observer); |
+ void RemoveInstanceObserver(PP_Instance instance, InstanceObserver* observer); |
+ |
+ void OnThrottleStateChanged(PP_Instance instance, bool is_throttled); |
+ bool IsThrottled(PP_Instance instance) const; |
+ |
scoped_refptr<IPC::MessageFilter> message_filter() { |
return message_filter_; |
} |
@@ -108,6 +121,18 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { |
BrowserPpapiHostImpl* browser_ppapi_host_impl_; |
}; |
+ struct InstanceData { |
+ InstanceData(); |
+ ~InstanceData(); |
+ |
+ PepperRendererInstanceData renderer_data; |
+ bool is_throttled; |
+ |
+ // linked_ptr wrapper required because InstanceData must be copyable to |
+ // be stored in an STL container. |
+ linked_ptr<ObserverList<InstanceObserver>> observer_list; |
+ }; |
+ |
// Reports plugin activity to the callback set with SetOnKeepaliveCallback. |
void OnKeepalive(); |
@@ -126,9 +151,8 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { |
scoped_refptr<SSLContextHelper> ssl_context_helper_; |
- // Tracks all PP_Instances in this plugin and associated renderer-related |
- // data. |
- typedef std::map<PP_Instance, PepperRendererInstanceData> InstanceMap; |
+ // Tracks all PP_Instances in this plugin and associated data. |
+ typedef std::map<PP_Instance, InstanceData> InstanceMap; |
InstanceMap instance_map_; |
scoped_refptr<HostMessageFilter> message_filter_; |