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

Unified Diff: content/browser/renderer_host/pepper/browser_ppapi_host_impl.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: working prototype Created 7 years, 1 month 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: 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 5d953422c1bedacae428d8adbc7720a0471fff8d..e4eb41624f9985c35bac7a824fee006d662a0a50 100644
--- a/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h
+++ b/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h
@@ -23,14 +23,18 @@
namespace content {
-class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
+class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost
+{
public:
+ // |delegate| will be owned by BrowserPpapiHostImpl, is optional and may be
+ // NULL, and is used only for OnIdleState for NaCl extensions.
// The creator is responsible for calling set_plugin_process_handle as soon
// as it is known (we start the process asynchronously so it won't be known
// when this object is created).
// |external_plugin| signfies that this is a proxy created for an embedder's
// plugin, i.e. using BrowserPpapiHost::CreateExternalPluginProcess.
BrowserPpapiHostImpl(
+ BrowserPpapiHost::Delegate* delegate,
IPC::Sender* sender,
const ppapi::PpapiPermissions& permissions,
const std::string& plugin_name,
@@ -67,6 +71,9 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
const PepperRendererInstanceData& instance_data);
void DeleteInstance(PP_Instance instance);
+ // Called to handle the idle state of the plugin changing.
+ void OnIdleState(bool idle);
+
scoped_refptr<IPC::ChannelProxy::MessageFilter> message_filter() {
return message_filter_;
}
@@ -83,8 +90,10 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
// reference. To avoid that, define a message filter object.
class HostMessageFilter : public IPC::ChannelProxy::MessageFilter {
public:
- explicit HostMessageFilter(ppapi::host::PpapiHost* ppapi_host)
- : ppapi_host_(ppapi_host) {}
+ explicit HostMessageFilter(BrowserPpapiHostImpl* host,
dmichael (off chromium) 2013/11/06 22:39:21 nit: explicit not necessary now w/2 params
scheib 2013/11/15 01:22:17 Done.
+ ppapi::host::PpapiHost* ppapi_host)
+ : browser_ppapi_host_impl_(host),
+ ppapi_host_(ppapi_host) {}
// IPC::ChannelProxy::MessageFilter.
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
@@ -93,9 +102,13 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
private:
virtual ~HostMessageFilter() {}
+ void OnIdleState(bool idle);
+
+ BrowserPpapiHostImpl* browser_ppapi_host_impl_; // Not owned;
ppapi::host::PpapiHost* ppapi_host_;
};
+ scoped_ptr<BrowserPpapiHost::Delegate> delegate_;
scoped_ptr<ppapi::host::PpapiHost> ppapi_host_;
base::ProcessHandle plugin_process_handle_;
std::string plugin_name_;

Powered by Google App Engine
This is Rietveld 408576698