Index: chrome/browser/nacl_host/nacl_process_host.cc |
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc |
index 530ebbb50318b7ab873e46560581e670801946ad..9b533625c36a2ea062a6f23301abe102c8957826 100644 |
--- a/chrome/browser/nacl_host/nacl_process_host.cc |
+++ b/chrome/browser/nacl_host/nacl_process_host.cc |
@@ -25,7 +25,10 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "base/win/windows_version.h" |
#include "build/build_config.h" |
+#include "chrome/browser/extensions/extension_service.h" |
+#include "chrome/browser/extensions/extension_system.h" |
#include "chrome/browser/nacl_host/nacl_host_message_filter.h" |
+#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/chrome_switches.h" |
#include "components/nacl/browser/nacl_browser.h" |
#include "components/nacl/common/nacl_cmd_line.h" |
@@ -36,6 +39,8 @@ |
#include "content/public/browser/browser_child_process_host.h" |
#include "content/public/browser/browser_ppapi_host.h" |
#include "content/public/browser/child_process_data.h" |
+#include "content/public/browser/render_view_host.h" |
+#include "content/public/browser/site_instance.h" |
#include "content/public/common/child_process_host.h" |
#include "content/public/common/content_switches.h" |
#include "content/public/common/process_type.h" |
@@ -769,6 +774,54 @@ bool NaClProcessHost::SendStart() { |
return StartNaClExecution(); |
} |
+class BrowserPpapiHostDelegate : public content::BrowserPpapiHost::Delegate { |
+ virtual void OnIdleState(bool idle, |
dmichael (off chromium)
2013/11/06 22:39:21
OnIdleStateChange?
OnIdleStateTransition?
scheib
2013/11/15 01:22:17
Done: IdleStateChange
|
+ const base::FilePath& profile_data_directory, |
+ const content::RenderViewHost* render_view_host, |
+ const GURL& document_url) OVERRIDE { |
+ DCHECK(render_view_host); |
+ if (!render_view_host) |
+ return; |
+ |
+ content::SiteInstance* site_instance = render_view_host->GetSiteInstance(); |
+ DCHECK(site_instance); |
+ if (!site_instance) |
+ return; |
+ |
+ extensions::ExtensionSystem* extension_system = |
+ extensions::ExtensionSystem::GetForBrowserContext( |
+ site_instance->GetBrowserContext()); |
+ DCHECK(extension_system); |
+ if (!extension_system) |
+ return; |
+ |
+ const ExtensionService* extension_service = |
+ extension_system->extension_service(); |
+ DCHECK(extension_service); |
+ if (!extension_service) |
+ return; |
+ |
+ const extensions::Extension* extension = |
+ extension_service->GetExtensionById(document_url.host(), false); |
+ DCHECK(extension); |
+ if (!extension) |
+ return; |
+ |
+ ExtensionProcessManager* pm = extension_system->process_manager(); |
+ DCHECK(pm); |
+ if (!pm) |
+ return; |
+ |
+ if (idle) { |
+ fprintf(stderr, "%s:%s:%d DecrementLazyKeepaliveCount\n", __FILE__, __FUNCTION__, __LINE__); |
+ pm->DecrementLazyKeepaliveCount(extension); |
+ } else { |
+ fprintf(stderr, "%s:%s:%d IncrementLazyKeepaliveCount\n", __FILE__, __FUNCTION__, __LINE__); |
+ pm->IncrementLazyKeepaliveCount(extension); |
+ } |
+ } |
+}; |
dmichael (off chromium)
2013/11/06 22:39:21
This should probably go up in the unnamed namespac
scheib
2013/11/15 01:22:17
Done.
|
+ |
// This method is called when NaClProcessHostMsg_PpapiChannelCreated is |
// received or PpapiHostMsg_ChannelCreated is forwarded by our plugin |
// listener. |
@@ -788,14 +841,15 @@ void NaClProcessHost::OnPpapiChannelCreated( |
base::MessageLoopProxy::current().get())); |
// Create the browser ppapi host and enable PPAPI message dispatching to the |
// browser process. |
- ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( |
+ ppapi_host_ = content::BrowserPpapiHost::CreateExternalPluginProcess( |
+ new BrowserPpapiHostDelegate(), |
ipc_proxy_channel_.get(), // sender |
permissions_, |
process_->GetData().handle, |
ipc_proxy_channel_.get(), |
nacl_host_message_filter_->render_process_id(), |
render_view_id_, |
- profile_directory_)); |
+ profile_directory_); |
ppapi::PpapiNaClChannelArgs args; |
args.off_the_record = nacl_host_message_filter_->off_the_record(); |