diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 05:02:58 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 05:02:58 +0000 |
commit | 34855e6c8666d51b92ef025a4f238e4c594c6d5e (patch) | |
tree | 7789208f31eac16434cdec7da0ef2270c1f68e2d /ppapi | |
parent | edc1250e0cf03038db503086dfd31082ed694d69 (diff) | |
download | chromium_src-34855e6c8666d51b92ef025a4f238e4c594c6d5e.zip chromium_src-34855e6c8666d51b92ef025a4f238e4c594c6d5e.tar.gz chromium_src-34855e6c8666d51b92ef025a4f238e4c594c6d5e.tar.bz2 |
Revert of Replace --ppapi-keep-alive-throttle command line switch with IPC parameter. (https://codereview.chromium.org/197693003/)
Reason for revert:
Broke building on http://build.chromium.org/p/chromium.memory/builders/Chromium%20OS%20%28x86%29%20ASan/builds/8599/steps/BuildPackages/logs/stdio
This bot builds with disable_nacl=1 for some reason (mentioned in the stdio above somewhere – not sure why this is), and thus chrome_browser doesn't depend on nacl_browser, leading to this linker error when building browser_tests:
chromeos-chrome-35.0.1889.0_alpha-r1: ../../../../../../../home/chrome-bot/chrome_root/src/chrome/browser/extensions/app_background_page_apitest.cc:134: error: undefined reference to 'nacl::NaClProcessHost::SetPpapiKeepAliveThrottleForTesting(unsigned int)'
(Maybe this change generally breaks building browser_tests with disable_nacl=1?)
Original issue's description:
> Replace --ppapi-keep-alive-throttle command line switch with IPC parameter.
>
> Part of a broad effort to reduce the number of command line switches.
>
> This is the second land of this change - correcting a static initializer issue.
>
> BUG=350510
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=256961
TBR=dmichael@chromium.org,tsepez@chromium.org,mseaborn@chromium.org,scheib@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=350510
Review URL: https://codereview.chromium.org/199933002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256993 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/ppapi_shared.gypi | 1 | ||||
-rw-r--r-- | ppapi/proxy/plugin_globals.cc | 24 | ||||
-rw-r--r-- | ppapi/proxy/plugin_globals.h | 5 | ||||
-rw-r--r-- | ppapi/proxy/plugin_main_irt.cc | 20 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 1 | ||||
-rw-r--r-- | ppapi/shared_impl/ppapi_constants.h | 19 | ||||
-rw-r--r-- | ppapi/shared_impl/ppapi_nacl_plugin_args.cc | 6 | ||||
-rw-r--r-- | ppapi/shared_impl/ppapi_nacl_plugin_args.h | 1 | ||||
-rw-r--r-- | ppapi/shared_impl/ppapi_switches.cc | 3 | ||||
-rw-r--r-- | ppapi/shared_impl/ppapi_switches.h | 1 |
10 files changed, 40 insertions, 41 deletions
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index f71fb2e..620a6eb 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -46,7 +46,6 @@ 'shared_impl/media_stream_video_track_shared.cc', 'shared_impl/platform_file.cc', 'shared_impl/platform_file.h', - 'shared_impl/ppapi_constants.h', 'shared_impl/ppapi_globals.cc', 'shared_impl/ppapi_globals.h', 'shared_impl/ppapi_nacl_plugin_args.cc', diff --git a/ppapi/proxy/plugin_globals.cc b/ppapi/proxy/plugin_globals.cc index d361ae1..d34adf1 100644 --- a/ppapi/proxy/plugin_globals.cc +++ b/ppapi/proxy/plugin_globals.cc @@ -13,10 +13,15 @@ #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppb_message_loop_proxy.h" #include "ppapi/proxy/resource_reply_thread_registrar.h" -#include "ppapi/shared_impl/ppapi_constants.h" #include "ppapi/shared_impl/proxy_lock.h" #include "ppapi/thunk/enter.h" +namespace { + +const int kKeepaliveThrottleIntervalDefault = 5000; + +} // namespace + namespace ppapi { namespace proxy { @@ -59,7 +64,7 @@ PluginGlobals::PluginGlobals() new ResourceReplyThreadRegistrar(GetMainThreadMessageLoop())), plugin_recently_active_(false), keepalive_throttle_interval_milliseconds_( - ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds), + kKeepaliveThrottleIntervalDefault), weak_factory_(this) { DCHECK(!plugin_globals_); plugin_globals_ = this; @@ -80,7 +85,7 @@ PluginGlobals::PluginGlobals(PerThreadForTest per_thread_for_test) new ResourceReplyThreadRegistrar(GetMainThreadMessageLoop())), plugin_recently_active_(false), keepalive_throttle_interval_milliseconds_( - kKeepaliveThrottleIntervalDefaultMilliseconds), + kKeepaliveThrottleIntervalDefault), weak_factory_(this) { DCHECK(!plugin_globals_); } @@ -181,13 +186,12 @@ void PluginGlobals::MarkPluginIsActive() { if (!GetBrowserSender() || !base::MessageLoop::current()) return; GetBrowserSender()->Send(new PpapiHostMsg_Keepalive()); - DCHECK(keepalive_throttle_interval_milliseconds_); - GetMainThreadMessageLoop()->PostDelayedTask( - FROM_HERE, + + GetMainThreadMessageLoop()->PostDelayedTask(FROM_HERE, RunWhileLocked(base::Bind(&PluginGlobals::OnReleaseKeepaliveThrottle, weak_factory_.GetWeakPtr())), base::TimeDelta::FromMilliseconds( - keepalive_throttle_interval_milliseconds_)); + keepalive_throttle_interval_milliseconds())); } } @@ -221,7 +225,11 @@ MessageLoopResource* PluginGlobals::loop_for_main_thread() { return loop_for_main_thread_.get(); } -void PluginGlobals::set_keepalive_throttle_interval_milliseconds(unsigned i) { +int PluginGlobals::keepalive_throttle_interval_milliseconds() const { + return keepalive_throttle_interval_milliseconds_; +} + +void PluginGlobals::set_keepalive_throttle_interval_milliseconds(int i) { keepalive_throttle_interval_milliseconds_ = i; } diff --git a/ppapi/proxy/plugin_globals.h b/ppapi/proxy/plugin_globals.h index 5dc614d..dac33b6 100644 --- a/ppapi/proxy/plugin_globals.h +++ b/ppapi/proxy/plugin_globals.h @@ -137,7 +137,8 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { // Interval to limit how many IPC messages are sent indicating that the plugin // is active and should be kept alive. The value must be smaller than any // threshold used to kill inactive plugins by the embedder host. - void set_keepalive_throttle_interval_milliseconds(unsigned i); + int keepalive_throttle_interval_milliseconds() const; + void set_keepalive_throttle_interval_milliseconds(int i); private: class BrowserSender; @@ -182,7 +183,7 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { // all considered active. bool plugin_recently_active_; - unsigned keepalive_throttle_interval_milliseconds_; + int keepalive_throttle_interval_milliseconds_; // Member variables should appear before the WeakPtrFactory, see weak_ptr.h. base::WeakPtrFactory<PluginGlobals> weak_factory_; diff --git a/ppapi/proxy/plugin_main_irt.cc b/ppapi/proxy/plugin_main_irt.cc index 980cc6e..a3ea6c1 100644 --- a/ppapi/proxy/plugin_main_irt.cc +++ b/ppapi/proxy/plugin_main_irt.cc @@ -32,6 +32,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(__native_client__) @@ -115,6 +116,8 @@ class PpapiDispatcher : public PluginDispatcher::PluginDelegate, void OnMsgInitializeNaClDispatcher(const ppapi::PpapiNaClPluginArgs& args); void OnPluginDispatcherMessageReceived(const IPC::Message& msg); + void SetPpapiKeepAliveThrottleFromCommandLine(); + std::set<PP_Instance> instances_; std::map<uint32, PluginDispatcher*> plugin_dispatchers_; uint32 next_plugin_dispatcher_id_; @@ -246,10 +249,7 @@ void PpapiDispatcher::OnMsgInitializeNaClDispatcher( logging::LoggingSettings settings; settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; logging::InitLogging(settings); - - ppapi::proxy::PluginGlobals::Get() - ->set_keepalive_throttle_interval_milliseconds( - args.keepalive_throttle_interval_milliseconds); + SetPpapiKeepAliveThrottleFromCommandLine(); // Tell the process-global GetInterface which interfaces it can return to the // plugin. @@ -294,6 +294,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 SetIPCFileDescriptors(int ipc_browser_fd, int ipc_renderer_fd) { diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index b05b56b..71f791e 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -364,7 +364,6 @@ IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(ppapi::PpapiNaClPluginArgs) IPC_STRUCT_TRAITS_MEMBER(off_the_record) IPC_STRUCT_TRAITS_MEMBER(permissions) - IPC_STRUCT_TRAITS_MEMBER(keepalive_throttle_interval_milliseconds) IPC_STRUCT_TRAITS_MEMBER(switch_names) IPC_STRUCT_TRAITS_MEMBER(switch_values) IPC_STRUCT_TRAITS_END() diff --git a/ppapi/shared_impl/ppapi_constants.h b/ppapi/shared_impl/ppapi_constants.h deleted file mode 100644 index dcc9b29..0000000 --- a/ppapi/shared_impl/ppapi_constants.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PPAPI_SHARED_IMPL_PPAPI_CONSTANTS_H_ -#define PPAPI_SHARED_IMPL_PPAPI_CONSTANTS_H_ - -#include "ppapi/shared_impl/ppapi_shared_export.h" - -namespace ppapi { - -// Default interval to space out IPC messages sent indicating that a plugin is -// active and should be kept alive. The value must be smaller than any threshold -// used to kill inactive plugins by the embedder host. -const unsigned kKeepaliveThrottleIntervalDefaultMilliseconds = 5000; - -} // namespace ppapi - -#endif // PPAPI_SHARED_IMPL_PPAPI_CONSTANTS_H_ diff --git a/ppapi/shared_impl/ppapi_nacl_plugin_args.cc b/ppapi/shared_impl/ppapi_nacl_plugin_args.cc index 4dd5110..92df690 100644 --- a/ppapi/shared_impl/ppapi_nacl_plugin_args.cc +++ b/ppapi/shared_impl/ppapi_nacl_plugin_args.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ppapi/shared_impl/ppapi_constants.h" #include "ppapi/shared_impl/ppapi_nacl_plugin_args.h" namespace ppapi { @@ -10,10 +9,7 @@ namespace ppapi { // We must provide explicit definitions of these functions for builds on // Windows. PpapiNaClPluginArgs::PpapiNaClPluginArgs() - : off_the_record(false), - supports_dev_channel(false), - keepalive_throttle_interval_milliseconds( - kKeepaliveThrottleIntervalDefaultMilliseconds) {} + : off_the_record(false), supports_dev_channel(false) {} PpapiNaClPluginArgs::~PpapiNaClPluginArgs() {} diff --git a/ppapi/shared_impl/ppapi_nacl_plugin_args.h b/ppapi/shared_impl/ppapi_nacl_plugin_args.h index 993131d..2f18c8e 100644 --- a/ppapi/shared_impl/ppapi_nacl_plugin_args.h +++ b/ppapi/shared_impl/ppapi_nacl_plugin_args.h @@ -20,7 +20,6 @@ struct PPAPI_SHARED_EXPORT PpapiNaClPluginArgs { bool off_the_record; PpapiPermissions permissions; bool supports_dev_channel; - unsigned keepalive_throttle_interval_milliseconds; // Switches from the command-line. std::vector<std::string> switch_names; diff --git a/ppapi/shared_impl/ppapi_switches.cc b/ppapi/shared_impl/ppapi_switches.cc index 84ba250..2a3f1c28 100644 --- a/ppapi/shared_impl/ppapi_switches.cc +++ b/ppapi/shared_impl/ppapi_switches.cc @@ -9,4 +9,7 @@ namespace switches { // Enables the testing interface for PPAPI. const char kEnablePepperTesting[] = "enable-pepper-testing"; +// Specifies throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs. +const char kPpapiKeepAliveThrottle[] = "ppapi-keep-alive-throttle"; + } // namespace switches diff --git a/ppapi/shared_impl/ppapi_switches.h b/ppapi/shared_impl/ppapi_switches.h index a5c8e9d..4fb9c3481 100644 --- a/ppapi/shared_impl/ppapi_switches.h +++ b/ppapi/shared_impl/ppapi_switches.h @@ -10,6 +10,7 @@ namespace switches { PPAPI_SHARED_EXPORT extern const char kEnablePepperTesting[]; +PPAPI_SHARED_EXPORT extern const char kPpapiKeepAliveThrottle[]; } // namespace switches |