Index: ppapi/proxy/plugin_globals.h |
diff --git a/ppapi/proxy/plugin_globals.h b/ppapi/proxy/plugin_globals.h |
index 029e2d2e28eebae94a1d69040ea59a19d04221f7..dac33b613fe52c3e94c0627896c847cb611ddf7c 100644 |
--- a/ppapi/proxy/plugin_globals.h |
+++ b/ppapi/proxy/plugin_globals.h |
@@ -74,6 +74,7 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { |
const std::string& value) OVERRIDE; |
virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; |
base::TaskRunner* GetFileTaskRunner() OVERRIDE; |
+ virtual void MarkPluginIsActive() OVERRIDE; |
// Returns the channel for sending to the browser. |
IPC::Sender* GetBrowserSender(); |
@@ -133,12 +134,21 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { |
return resource_reply_thread_registrar_.get(); |
} |
+ // Interval to limit how many IPC messages are sent indicating that the plugin |
+ // is active and should be kept alive. The value must be smaller than any |
+ // threshold used to kill inactive plugins by the embedder host. |
+ int keepalive_throttle_interval_milliseconds() const; |
+ void set_keepalive_throttle_interval_milliseconds(int i); |
+ |
private: |
class BrowserSender; |
// PpapiGlobals overrides. |
virtual bool IsPluginGlobals() const OVERRIDE; |
+ // Locks the proxy lock and releases the throttle on keepalive IPC messages. |
+ void OnReleaseKeepaliveThrottle(); |
+ |
static PluginGlobals* plugin_globals_; |
PluginProxyDelegate* plugin_proxy_delegate_; |
@@ -167,6 +177,17 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { |
scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_; |
+ // Indicates activity by the plugin. Used to monitor when a plugin can be |
+ // shutdown due to idleness. Current needs do not require differentiating |
+ // between idle state between multiple instances, if any are active they are |
+ // all considered active. |
+ bool plugin_recently_active_; |
+ |
+ int keepalive_throttle_interval_milliseconds_; |
+ |
+ // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. |
+ base::WeakPtrFactory<PluginGlobals> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PluginGlobals); |
}; |