| Index: content/browser/plugin_service.cc
|
| diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc
|
| index 97a90c4243d14c1334675707eff6847739c5df27..394c81d84bf0e4c0b2eb3deabd6de072a544d3b6 100644
|
| --- a/content/browser/plugin_service.cc
|
| +++ b/content/browser/plugin_service.cc
|
| @@ -23,19 +23,21 @@
|
| #include "content/browser/renderer_host/render_process_host.h"
|
| #include "content/browser/renderer_host/render_view_host.h"
|
| #include "content/browser/resource_context.h"
|
| -#include "content/browser/utility_process_host.h"
|
| #include "content/common/content_notification_types.h"
|
| #include "content/common/content_switches.h"
|
| #include "content/common/notification_service.h"
|
| #include "content/common/pepper_plugin_registry.h"
|
| #include "content/common/plugin_messages.h"
|
| -#include "content/common/utility_messages.h"
|
| #include "content/common/view_messages.h"
|
| #include "webkit/plugins/npapi/plugin_constants_win.h"
|
| #include "webkit/plugins/npapi/plugin_group.h"
|
| #include "webkit/plugins/npapi/plugin_list.h"
|
| #include "webkit/plugins/webplugininfo.h"
|
|
|
| +#if defined(OS_POSIX)
|
| +#include "content/browser/plugin_loader.h"
|
| +#endif
|
| +
|
| #if defined(OS_POSIX) && !defined(OS_MACOSX)
|
| using ::base::files::FilePathWatcher;
|
| #endif
|
| @@ -73,72 +75,6 @@ void WillLoadPluginsCallback() {
|
| #endif
|
| }
|
|
|
| -#if defined(OS_POSIX)
|
| -// Utility child process client that manages the IPC for loading plugins out of
|
| -// process.
|
| -class PluginLoaderClient : public UtilityProcessHost::Client {
|
| - public:
|
| - // Meant to be called on the IO thread. Will invoke the callback on the target
|
| - // loop when the plugins have been loaded.
|
| - static void LoadPluginsOutOfProcess(
|
| - base::MessageLoopProxy* target_loop,
|
| - const PluginService::GetPluginsCallback& callback) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| -
|
| - PluginLoaderClient* client = new PluginLoaderClient(target_loop, callback);
|
| - UtilityProcessHost* process_host =
|
| - new UtilityProcessHost(client, BrowserThread::IO);
|
| - process_host->set_no_sandbox(true);
|
| -#if defined(OS_MACOSX)
|
| - process_host->set_child_flags(ChildProcessHost::CHILD_ALLOW_HEAP_EXECUTION);
|
| -#endif
|
| -
|
| - std::vector<FilePath> extra_plugin_paths;
|
| - std::vector<FilePath> extra_plugin_dirs;
|
| - std::vector<webkit::WebPluginInfo> internal_plugins;
|
| - webkit::npapi::PluginList::Singleton()->GetPluginPathListsToLoad(
|
| - &extra_plugin_paths, &extra_plugin_dirs, &internal_plugins);
|
| -
|
| - process_host->Send(new UtilityMsg_LoadPlugins(
|
| - extra_plugin_paths, extra_plugin_dirs, internal_plugins));
|
| - }
|
| -
|
| - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
|
| - bool handled = true;
|
| - IPC_BEGIN_MESSAGE_MAP(PluginLoaderClient, message)
|
| - IPC_MESSAGE_HANDLER(UtilityHostMsg_LoadedPlugins, OnGotPlugins)
|
| - IPC_MESSAGE_UNHANDLED(handled = false)
|
| - IPC_END_MESSAGE_MAP()
|
| - return handled;
|
| - }
|
| -
|
| - virtual void OnProcessCrashed(int exit_code) OVERRIDE {
|
| - LOG(ERROR) << "Out-of-process plugin loader crashed with code " << exit_code
|
| - << ". You will have no plugins!";
|
| - // Don't leave callers hanging.
|
| - OnGotPlugins(std::vector<webkit::WebPluginInfo>());
|
| - }
|
| -
|
| - virtual void OnGotPlugins(const std::vector<webkit::WebPluginInfo>& plugins) {
|
| - webkit::npapi::PluginList::Singleton()->SetPlugins(plugins);
|
| - target_loop_->PostTask(FROM_HERE,
|
| - base::Bind(&RunGetPluginsCallback, callback_, plugins));
|
| - }
|
| -
|
| - private:
|
| - PluginLoaderClient(base::MessageLoopProxy* target_loop,
|
| - const PluginService::GetPluginsCallback& callback)
|
| - : target_loop_(target_loop),
|
| - callback_(callback) {
|
| - }
|
| -
|
| - scoped_refptr<base::MessageLoopProxy> target_loop_;
|
| - PluginService::GetPluginsCallback callback_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(PluginLoaderClient);
|
| -};
|
| -#endif // OS_POSIX
|
| -
|
| } // namespace
|
|
|
| #if defined(OS_MACOSX)
|
| @@ -574,8 +510,8 @@ void PluginService::GetPlugins(const GetPluginsCallback& callback) {
|
| base::Bind(&RunGetPluginsCallback, callback, cached_plugins));
|
| } else {
|
| BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
|
| - base::Bind(&PluginLoaderClient::LoadPluginsOutOfProcess,
|
| - target_loop, callback));
|
| + base::Bind(&PluginService::LoadPluginsOutOfProcess,
|
| + base::Unretained(this), target_loop, callback));
|
| }
|
| #endif
|
| }
|
| @@ -596,6 +532,17 @@ void PluginService::GetPluginsInternal(
|
| base::Bind(&RunGetPluginsCallback, callback, plugins));
|
| }
|
|
|
| +#if defined(OS_POSIX)
|
| +void PluginService::LoadPluginsOutOfProcess(
|
| + base::MessageLoopProxy* target_loop,
|
| + const PluginService::GetPluginsCallback& callback) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| + if (!plugin_loader_)
|
| + plugin_loader_ = new PluginLoader();
|
| + plugin_loader_->LoadPlugins(target_loop, callback);
|
| +}
|
| +#endif
|
| +
|
| void PluginService::OnWaitableEventSignaled(
|
| base::WaitableEvent* waitable_event) {
|
| #if defined(OS_WIN)
|
|
|