From cc7126cc8e4050e80abde5332f695ffa1fc36caa Mon Sep 17 00:00:00 2001 From: "scheib@chromium.org" Date: Fri, 20 Dec 2013 10:40:27 +0000 Subject: Test Keeping NaCl plugins used in app background pages alive when active. Activity in Native Client plugins results in IPC messages sent to the BrowserPpapiHostImpl and routed to call extensions::ProcessManager::KeepaliveImpulse. Testing patch, builds on implementation. See: https://codereview.chromium.org/61063003/ Implementation. https://codereview.chromium.org/105873003/ Cumulative patch. Design doc: https://docs.google.com/a/chromium.org/document/d/1mI0lS1rfAf-BAGLmWAEcWy37Xq9dOvgfMx8OqeUMXts/edit# BUG=298339 Review URL: https://codereview.chromium.org/111563006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242061 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/proxy/plugin_main_nacl.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ppapi/proxy/plugin_main_nacl.cc') diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc index bced108..6690f20 100644 --- a/ppapi/proxy/plugin_main_nacl.cc +++ b/ppapi/proxy/plugin_main_nacl.cc @@ -13,6 +13,7 @@ #include "base/command_line.h" #include "base/message_loop/message_loop.h" +#include "base/strings/string_number_conversions.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" #include "components/tracing/child_trace_message_filter.h" @@ -29,6 +30,7 @@ #include "ppapi/proxy/plugin_message_filter.h" #include "ppapi/proxy/plugin_proxy_delegate.h" #include "ppapi/proxy/resource_reply_thread_registrar.h" +#include "ppapi/shared_impl/ppapi_switches.h" #include "ppapi/shared_impl/ppb_audio_shared.h" #if defined(IPC_MESSAGE_LOG_ENABLED) @@ -95,6 +97,8 @@ class PpapiDispatcher : public ProxyChannel, SerializedHandle handle); void OnPluginDispatcherMessageReceived(const IPC::Message& msg); + void SetPpapiKeepAliveThrottleFromCommandLine(); + std::set instances_; std::map plugin_dispatchers_; uint32 next_plugin_dispatcher_id_; @@ -208,6 +212,7 @@ void PpapiDispatcher::OnMsgCreateNaClChannel( logging::LoggingSettings settings; settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; logging::InitLogging(settings); + SetPpapiKeepAliveThrottleFromCommandLine(); command_line_and_logging_initialized = true; } // Tell the process-global GetInterface which interfaces it can return to the @@ -250,6 +255,18 @@ void PpapiDispatcher::OnPluginDispatcherMessageReceived( dispatcher->second->OnMessageReceived(msg); } +void PpapiDispatcher::SetPpapiKeepAliveThrottleFromCommandLine() { + unsigned keepalive_throttle_interval_milliseconds = 0; + if (base::StringToUint( + CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kPpapiKeepAliveThrottle), + &keepalive_throttle_interval_milliseconds)) { + ppapi::proxy::PluginGlobals::Get()-> + set_keepalive_throttle_interval_milliseconds( + keepalive_throttle_interval_milliseconds); + } +} + } // namespace void PpapiPluginRegisterThreadCreator( -- cgit v1.1