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

Unified Diff: ppapi/proxy/plugin_main_nacl.cc

Issue 111563006: Test Keeping NaCl plugins used in app background pages alive when active. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update after yzshen comments on impl patch 5 Created 7 years 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: ppapi/proxy/plugin_main_nacl.cc
diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc
index f050778227cad4eef35c4f1c26f59fe1a6ccbcbe..d916f9139f6d6d1fd407939ec30f99a12ed025ab 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"
@@ -27,6 +28,7 @@
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/plugin_proxy_delegate.h"
+#include "ppapi/shared_impl/ppapi_switches.h"
#include "ppapi/shared_impl/ppb_audio_shared.h"
#if defined(IPC_MESSAGE_LOG_ENABLED)
@@ -96,6 +98,8 @@ class PpapiDispatcher : public ProxyChannel,
const IPC::Message& nested_msg);
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
@@ -257,6 +262,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(

Powered by Google App Engine
This is Rietveld 408576698