diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-12 20:15:54 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-12 20:15:54 +0000 |
commit | 1673cafa26a222117bbd137f1ca61628e7f7bbaa (patch) | |
tree | d6ffad2d49399608c3d5cfb95cce68ee2d80758e /content/ppapi_plugin | |
parent | a41f8f60ba86a09490de53a738f2adee9a618ccb (diff) | |
download | chromium_src-1673cafa26a222117bbd137f1ca61628e7f7bbaa.zip chromium_src-1673cafa26a222117bbd137f1ca61628e7f7bbaa.tar.gz chromium_src-1673cafa26a222117bbd137f1ca61628e7f7bbaa.tar.bz2 |
Implement ScopedChildProcessReference class
An innocent attempt.
BUG=none
Review URL: https://codereview.chromium.org/66443002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/ppapi_plugin')
4 files changed, 8 insertions, 11 deletions
diff --git a/content/ppapi_plugin/broker_process_dispatcher.cc b/content/ppapi_plugin/broker_process_dispatcher.cc index 727506c..5f1ff63 100644 --- a/content/ppapi_plugin/broker_process_dispatcher.cc +++ b/content/ppapi_plugin/broker_process_dispatcher.cc @@ -81,8 +81,6 @@ BrokerProcessDispatcher::BrokerProcessDispatcher( flash_browser_operations_1_3_(NULL), flash_browser_operations_1_2_(NULL), flash_browser_operations_1_0_(NULL) { - ChildProcess::current()->AddRefProcess(); - if (get_plugin_interface) { flash_browser_operations_1_0_ = static_cast<const PPP_Flash_BrowserOperations_1_0*>( @@ -105,10 +103,7 @@ BrokerProcessDispatcher::~BrokerProcessDispatcher() { // plugin. This is the case for common plugins where they may be used on a // source and destination page of a navigation. We don't want to tear down // and re-start processes each time in these cases. - base::MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&ChildProcess::ReleaseProcess, - base::Unretained(ChildProcess::current())), + process_ref_.ReleaseWithDelay( base::TimeDelta::FromSeconds(kBrokerReleaseTimeSeconds)); } diff --git a/content/ppapi_plugin/broker_process_dispatcher.h b/content/ppapi_plugin/broker_process_dispatcher.h index dd8c6a6..7b64717 100644 --- a/content/ppapi_plugin/broker_process_dispatcher.h +++ b/content/ppapi_plugin/broker_process_dispatcher.h @@ -7,6 +7,7 @@ #include "base/basictypes.h" #include "base/memory/weak_ptr.h" +#include "content/child/scoped_child_process_reference.h" #include "ppapi/c/ppp.h" #include "ppapi/proxy/broker_dispatcher.h" #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h" @@ -78,6 +79,8 @@ class BrokerProcessDispatcher PP_Flash_BrowserOperations_SettingType setting_type, const ppapi::FlashSiteSettings& sites); + ScopedChildProcessReference process_ref_; + PP_GetInterface_Func get_plugin_interface_; const PPP_Flash_BrowserOperations_1_3* flash_browser_operations_1_3_; diff --git a/content/ppapi_plugin/plugin_process_dispatcher.cc b/content/ppapi_plugin/plugin_process_dispatcher.cc index b0574d4..3bfc46a 100644 --- a/content/ppapi_plugin/plugin_process_dispatcher.cc +++ b/content/ppapi_plugin/plugin_process_dispatcher.cc @@ -23,7 +23,6 @@ PluginProcessDispatcher::PluginProcessDispatcher( : ppapi::proxy::PluginDispatcher(get_interface, permissions, incognito) { - ChildProcess::current()->AddRefProcess(); } PluginProcessDispatcher::~PluginProcessDispatcher() { @@ -32,10 +31,7 @@ PluginProcessDispatcher::~PluginProcessDispatcher() { // plugin. This is the case for common plugins where they may be used on a // source and destination page of a navigation. We don't want to tear down // and re-start processes each time in these cases. - base::MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&ChildProcess::ReleaseProcess, - base::Unretained(ChildProcess::current())), + process_ref_.ReleaseWithDelay( base::TimeDelta::FromSeconds(kPluginReleaseTimeSeconds)); } diff --git a/content/ppapi_plugin/plugin_process_dispatcher.h b/content/ppapi_plugin/plugin_process_dispatcher.h index 1398a06..2d80e0f 100644 --- a/content/ppapi_plugin/plugin_process_dispatcher.h +++ b/content/ppapi_plugin/plugin_process_dispatcher.h @@ -6,6 +6,7 @@ #define CONTENT_PPAPI_PLUGIN_PLUGIN_PROCESS_DISPATCHER_H_ #include "base/basictypes.h" +#include "content/child/scoped_child_process_reference.h" #include "ppapi/proxy/plugin_dispatcher.h" namespace content { @@ -21,6 +22,8 @@ class PluginProcessDispatcher : public ppapi::proxy::PluginDispatcher { virtual ~PluginProcessDispatcher(); private: + ScopedChildProcessReference process_ref_; + DISALLOW_COPY_AND_ASSIGN(PluginProcessDispatcher); }; |