diff options
Diffstat (limited to 'chrome/plugin/plugin_process.cc')
-rw-r--r-- | chrome/plugin/plugin_process.cc | 49 |
1 files changed, 5 insertions, 44 deletions
diff --git a/chrome/plugin/plugin_process.cc b/chrome/plugin/plugin_process.cc index fe19b9b..9d0f567 100644 --- a/chrome/plugin/plugin_process.cc +++ b/chrome/plugin/plugin_process.cc @@ -13,20 +13,6 @@ #include "chrome/common/render_messages.h" #include "webkit/glue/webkit_glue.h" -// Custom factory to allow us to pass additional ctor arguments. -class PluginProcessFactory : public ChildProcessFactoryInterface { - public: - explicit PluginProcessFactory(const FilePath& plugin_path) - : plugin_path_(plugin_path) { - } - - virtual ChildProcess* Create(const std::wstring& channel_name) { - return new PluginProcess(channel_name, plugin_path_); - } - - const FilePath& plugin_path_; -}; - // How long to wait after there are no more plugin instances before killing the // process. static const int kProcessShutdownDelayMs = 10 * 1000; @@ -39,31 +25,21 @@ template <> struct RunnableMethodTraits<PluginProcess> { static void ReleaseCallee(PluginProcess*) {} }; -PluginProcess::PluginProcess(const std::wstring& channel_name, - const FilePath& plugin_path) : - plugin_path_(plugin_path), -#pragma warning(suppress: 4355) // Okay to pass "this" here. - plugin_thread_(this, channel_name) { +PluginProcess::PluginProcess() + : ChildProcess(new PluginThread()) { } PluginProcess::~PluginProcess() { } -bool PluginProcess::GlobalInit(const std::wstring &channel_name, - const FilePath &plugin_path) { - PluginProcessFactory factory(plugin_path); - return ChildProcess::GlobalInit(channel_name, &factory); -} - - // Note: may be called on any thread void PluginProcess::OnFinalRelease() { // We override this to have the process linger for a few seconds to // better accomdate back/forth navigation. This avoids shutting down and // immediately starting a new plugin process. If a new channel is // opened in the interim, the current process will not be shutdown. - main_thread_loop_->PostDelayedTask(FROM_HERE, NewRunnableMethod( - this, &PluginProcess::OnProcessShutdownTimeout), + child_thread()->owner_loop()->PostDelayedTask(FROM_HERE, NewRunnableMethod( + this, &PluginProcess::OnProcessShutdownTimeout), kProcessShutdownDelayMs); } @@ -74,25 +50,10 @@ void PluginProcess::OnProcessShutdownTimeout() { // process host instance in the browser to verify if it is ok to shutdown // the plugin process. The browser then sends back a response indicating // whether it is ok to shutdown. - plugin_thread_.Send(new PluginProcessHostMsg_ShutdownRequest); - } -} - -// static -void PluginProcess::ShutdownProcessResponse(bool ok_to_shutdown) { - if (ok_to_shutdown) { - PluginProcess* plugin_process = - static_cast<PluginProcess*>(child_process_); - DCHECK(plugin_process); - plugin_process->Shutdown(); + child_thread()->Send(new PluginProcessHostMsg_ShutdownRequest); } } -void PluginProcess::BrowserShutdown() { - ShutdownProcessResponse(true); -} - void PluginProcess::Shutdown() { ChildProcess::OnFinalRelease(); } - |