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

Unified Diff: ppapi/proxy/plugin_globals.h

Issue 61063003: Keep NaCl plugins used in app background pages alive when active. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments in patch 3 & 4. Created 7 years 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/plugin_globals.h
diff --git a/ppapi/proxy/plugin_globals.h b/ppapi/proxy/plugin_globals.h
index bc55245d611a10c5dc154529a1749b595ef86134..918839cda12ffef44e5749767bbbe88b3a3aee0f 100644
--- a/ppapi/proxy/plugin_globals.h
+++ b/ppapi/proxy/plugin_globals.h
@@ -73,6 +73,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();
@@ -128,12 +129,21 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
// The embedder should call this function when the command line is known.
void set_command_line(const std::string& c) { command_line_ = c; }
+ // 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 keep_aliave_throttle_interval_milliseconds();
yzshen1 2013/12/13 21:23:15 alive, please. And it seems you use keepalive with
yzshen1 2013/12/13 21:23:15 const for the method, please.
scheib 2013/12/14 00:07:41 Done.
scheib 2013/12/14 00:07:41 Done.
+ void set_keep_aliave_throttle_interval_milliseconds(int i);
+
private:
class BrowserSender;
// PpapiGlobals overrides.
virtual bool IsPluginGlobals() const OVERRIDE;
+ // Releases the throttle on sending keepalive IPC messages.
+ void OnReleaseKeepaliveThrottle();
yzshen1 2013/12/13 21:23:15 It seems better to comment that "Locks the proxy l
scheib 2013/12/14 00:07:41 Done.
+
static PluginGlobals* plugin_globals_;
PluginProxyDelegate* plugin_proxy_delegate_;
@@ -160,6 +170,17 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
// lazily, since it might not be needed.
scoped_ptr<base::Thread> file_thread_;
+ // 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 keep_aliave_throttle_interval_milliseconds_;
yzshen1 2013/12/13 21:23:15 alive, please. (You are using auto-completion for
scheib 2013/12/14 00:07:41 Done.
+
+ // Member variables should appear before the WeakPtrFactory, see weak_ptr.h.
+ base::WeakPtrFactory<PluginGlobals> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(PluginGlobals);
};

Powered by Google App Engine
This is Rietveld 408576698