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

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: Move callback impl to nacl_browser_delegate_impl.cc. 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..1cd6d98c1ce03272ffc83158ea37c753633873c0 100644
--- a/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h
+++ b/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h
@@ -12,6 +12,7 @@
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h"
#include "content/browser/renderer_host/pepper/ssl_context_helper.h"
#include "content/common/content_export.h"
@@ -52,6 +53,9 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
virtual const base::FilePath& GetProfileDataDirectory() OVERRIDE;
virtual GURL GetDocumentURLForInstance(PP_Instance instance) OVERRIDE;
virtual GURL GetPluginURLForInstance(PP_Instance instance) OVERRIDE;
+ virtual void SetOnIdleChangeCallback(
+ const BrowserPpapiHost::OnIdleChangeCallback callback) OVERRIDE;
yzshen1 2013/11/21 18:01:50 const &, please.
scheib 2013/12/11 21:35:40 Done.
+
void set_plugin_process_handle(base::ProcessHandle handle) {
plugin_process_handle_ = handle;
@@ -83,19 +87,27 @@ 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) {}
+ typedef base::Callback<void (bool idle)> OnIdleChangeCallback;
+
+ HostMessageFilter(ppapi::host::PpapiHost* ppapi_host,
yzshen1 2013/11/21 18:01:50 If we directly pass in BrowserPpapiHostImpl*: - we
scheib 2013/12/11 21:35:40 Done.
+ const OnIdleChangeCallback on_idle_change_callback);
yzshen1 2013/11/21 18:01:50 const &, please
scheib 2013/12/11 21:35:40 Done.
+
// IPC::ChannelProxy::MessageFilter.
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
void OnHostDestroyed();
private:
- virtual ~HostMessageFilter() {}
+ virtual ~HostMessageFilter();
+
+ void OnIdleStateChange(bool idle);
ppapi::host::PpapiHost* ppapi_host_;
+ OnIdleChangeCallback on_idle_change_callback_;
};
+ void OnIdleChange(bool idle);
+
scoped_ptr<ppapi::host::PpapiHost> ppapi_host_;
base::ProcessHandle plugin_process_handle_;
std::string plugin_name_;
@@ -118,6 +130,11 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost {
scoped_refptr<HostMessageFilter> message_filter_;
+ BrowserPpapiHost::OnIdleChangeCallback on_idle_change_callback_;
+
+ // Member variables should appear before the WeakPtrFactory, see weak_ptr.h.
+ base::WeakPtrFactory<BrowserPpapiHostImpl> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl);
};

Powered by Google App Engine
This is Rietveld 408576698