summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/pepper_plugin_delegate_impl.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 17:35:45 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 17:35:45 +0000
commit4923a338552b0b10747a7ee3c5d424089db2293d (patch)
treeeba4da9f4d58eb04ddced35bf5d3e2166e3f2b80 /chrome/renderer/pepper_plugin_delegate_impl.cc
parent525c657a4051abcad9a95631b2074ae27caac41f (diff)
downloadchromium_src-4923a338552b0b10747a7ee3c5d424089db2293d.zip
chromium_src-4923a338552b0b10747a7ee3c5d424089db2293d.tar.gz
chromium_src-4923a338552b0b10747a7ee3c5d424089db2293d.tar.bz2
Revert 68482 - Make webkit/glue/plugins no longer depend on ppapi/proxy directly. This causes
things that use webkit but otherwise don't need IPC to include the IPC directory. This patch moves the set-up of the proxy into the renderer. I also did a lot of clean-up of the initialization and it seems much nicer now. BUG=63684 TEST=manual PPAPI proxy testing Review URL: http://codereview.chromium.org/5592005 TBR=brettw@chromium.org Review URL: http://codereview.chromium.org/5616004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/pepper_plugin_delegate_impl.cc')
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.cc88
1 files changed, 9 insertions, 79 deletions
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc
index a949ffb8..c3a85d9 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.cc
+++ b/chrome/renderer/pepper_plugin_delegate_impl.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/renderer/pepper_plugin_delegate_impl.h"
-
#include <cmath>
+#include "chrome/renderer/pepper_plugin_delegate_impl.h"
+
#include "app/l10n_util.h"
#include "app/surface/transport_dib.h"
#include "base/callback.h"
@@ -18,7 +18,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/child_thread.h"
#include "chrome/common/file_system/file_system_dispatcher.h"
-#include "chrome/common/pepper_plugin_registry.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
#include "chrome/renderer/audio_message_filter.h"
@@ -33,7 +32,6 @@
#include "grit/locale_settings.h"
#include "ipc/ipc_channel_handle.h"
#include "ppapi/c/dev/pp_video_dev.h"
-#include "ppapi/proxy/host_dispatcher.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h"
@@ -49,10 +47,6 @@
#include "chrome/renderer/render_thread.h"
#endif
-#if defined(OS_POSIX)
-#include "ipc/ipc_channel_posix.h"
-#endif
-
using WebKit::WebView;
namespace {
@@ -419,60 +413,6 @@ class PlatformVideoDecoderImpl
DISALLOW_COPY_AND_ASSIGN(PlatformVideoDecoderImpl);
};
-class DispatcherWrapper : public pepper::PluginDelegate::OutOfProcessProxy {
- public:
- DispatcherWrapper() {}
- virtual ~DispatcherWrapper() {}
-
- bool Init(base::ProcessHandle plugin_process_handle,
- IPC::ChannelHandle channel_handle,
- PP_Module pp_module,
- pp::proxy::Dispatcher::GetInterfaceFunc local_get_interface);
-
- // OutOfProcessProxy implementation.
- virtual const void* GetProxiedInterface(const char* name) {
- return dispatcher_->GetProxiedInterface(name);
- }
- virtual void AddInstance(PP_Instance instance) {
- pp::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get());
- }
- virtual void RemoveInstance(PP_Instance instance) {
- pp::proxy::HostDispatcher::RemoveForInstance(instance);
- }
-
- private:
- scoped_ptr<pp::proxy::HostDispatcher> dispatcher_;
-};
-
-bool DispatcherWrapper::Init(
- base::ProcessHandle plugin_process_handle,
- IPC::ChannelHandle channel_handle,
- PP_Module pp_module,
- pp::proxy::Dispatcher::GetInterfaceFunc local_get_interface) {
- dispatcher_.reset(new pp::proxy::HostDispatcher(
- plugin_process_handle, pp_module, local_get_interface));
-
-#if defined(OS_POSIX)
- // If we received a ChannelHandle, register it now.
- if (channel_handle.socket.fd >= 0)
- IPC::AddChannelSocket(channel_handle.name, channel_handle.socket.fd);
-#endif
-
- if (!dispatcher_->InitWithChannel(
- ChildProcess::current()->io_message_loop(), channel_handle.name,
- true, ChildProcess::current()->GetShutDownEvent())) {
- dispatcher_.reset();
- return false;
- }
-
- if (!dispatcher_->InitializeModule()) {
- // TODO(brettw) does the module get unloaded in this case?
- dispatcher_.reset();
- return false;
- }
- return true;
-}
-
} // namespace
PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderView* render_view)
@@ -484,29 +424,19 @@ PepperPluginDelegateImpl::~PepperPluginDelegateImpl() {
}
scoped_refptr<pepper::PluginModule>
-PepperPluginDelegateImpl::CreatePepperPlugin(const FilePath& path) {
- // Easy case is in-process plugins.
- if (!PepperPluginRegistry::GetInstance()->RunOutOfProcessForPlugin(path))
- return PepperPluginRegistry::GetInstance()->GetModule(path);
-
- // Out of process: have the browser start the plugin process for us.
+PepperPluginDelegateImpl::CreateOutOfProcessPepperPlugin(
+ const FilePath& path) {
base::ProcessHandle plugin_process_handle = NULL;
IPC::ChannelHandle channel_handle;
render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin(
path, &plugin_process_handle, &channel_handle));
if (channel_handle.name.empty())
return scoped_refptr<pepper::PluginModule>(); // Couldn't be initialized.
-
- // Create a new HostDispatcher for the proxying, and hook it to a new
- // PluginModule.
- scoped_refptr<pepper::PluginModule> module(new pepper::PluginModule);
- scoped_ptr<DispatcherWrapper> dispatcher(new DispatcherWrapper);
- if (!dispatcher->Init(plugin_process_handle, channel_handle,
- module->pp_module(),
- pepper::PluginModule::GetLocalGetInterfaceFunc()))
- return scoped_refptr<pepper::PluginModule>();
- module->InitAsProxied(dispatcher.release());
- return module;
+ return pepper::PluginModule::CreateOutOfProcessModule(
+ ChildProcess::current()->io_message_loop(),
+ plugin_process_handle,
+ channel_handle,
+ ChildProcess::current()->GetShutDownEvent());
}
void PepperPluginDelegateImpl::ViewInitiatedPaint() {