summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/plugin_main_nacl.cc
diff options
context:
space:
mode:
authorscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-20 10:40:27 +0000
committerscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-20 10:40:27 +0000
commitcc7126cc8e4050e80abde5332f695ffa1fc36caa (patch)
tree4b7696a6b23788d7a9cf562e3221a66a3f3f04b9 /ppapi/proxy/plugin_main_nacl.cc
parent5e3e3a9e4955653b835b55a3a2d4a3daad9ef1e0 (diff)
downloadchromium_src-cc7126cc8e4050e80abde5332f695ffa1fc36caa.zip
chromium_src-cc7126cc8e4050e80abde5332f695ffa1fc36caa.tar.gz
chromium_src-cc7126cc8e4050e80abde5332f695ffa1fc36caa.tar.bz2
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
Diffstat (limited to 'ppapi/proxy/plugin_main_nacl.cc')
-rw-r--r--ppapi/proxy/plugin_main_nacl.cc17
1 files changed, 17 insertions, 0 deletions
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<PP_Instance> instances_;
std::map<uint32, PluginDispatcher*> 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(