summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/common/pepper_plugin_registry.cc11
-rw-r--r--content/common/pepper_plugin_registry.h8
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.cc76
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.h1
-rw-r--r--ppapi/proxy/proxy_channel.h2
5 files changed, 49 insertions, 49 deletions
diff --git a/content/common/pepper_plugin_registry.cc b/content/common/pepper_plugin_registry.cc
index 9fb1381..80154f5 100644
--- a/content/common/pepper_plugin_registry.cc
+++ b/content/common/pepper_plugin_registry.cc
@@ -10,7 +10,6 @@
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "content/common/child_process.h"
#include "content/common/content_client.h"
#include "content/common/content_switches.h"
#include "webkit/plugins/npapi/plugin_list.h"
@@ -250,13 +249,3 @@ PepperPluginRegistry::PepperPluginRegistry() {
}
}
-base::MessageLoopProxy* PepperPluginRegistry::GetIPCMessageLoop() {
- // This is called only in the renderer so we know we have a child process.
- DCHECK(ChildProcess::current()) << "Must be in the renderer.";
- return ChildProcess::current()->io_message_loop_proxy();
-}
-
-base::WaitableEvent* PepperPluginRegistry::GetShutdownEvent() {
- DCHECK(ChildProcess::current()) << "Must be in the renderer.";
- return ChildProcess::current()->GetShutDownEvent();
-}
diff --git a/content/common/pepper_plugin_registry.h b/content/common/pepper_plugin_registry.h
index ee2404a4..2ec144c 100644
--- a/content/common/pepper_plugin_registry.h
+++ b/content/common/pepper_plugin_registry.h
@@ -13,7 +13,6 @@
#include "base/file_path.h"
#include "content/common/content_export.h"
-#include "ppapi/proxy/proxy_channel.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/webplugininfo.h"
@@ -59,8 +58,7 @@ bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info,
// is a list of all live modules (some of which may be out-of-process and hence
// not preloaded).
class PepperPluginRegistry
- : public webkit::ppapi::PluginDelegate::ModuleLifetime,
- public ppapi::proxy::ProxyChannel::Delegate {
+ : public webkit::ppapi::PluginDelegate::ModuleLifetime {
public:
~PepperPluginRegistry();
@@ -105,10 +103,6 @@ class PepperPluginRegistry
private:
PepperPluginRegistry();
- // ProxyChannel::Delegate implementation.
- virtual base::MessageLoopProxy* GetIPCMessageLoop();
- virtual base::WaitableEvent* GetShutdownEvent();
-
// All known pepper plugins.
std::vector<PepperPluginInfo> plugin_list_;
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
index e863ea2..cd0cefb 100644
--- a/content/renderer/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper_plugin_delegate_impl.cc
@@ -333,17 +333,47 @@ void PlatformAudioImpl::OnLowLatencyCreated(
}
}
-class DispatcherWrapper
+class DispatcherDelegate : public ppapi::proxy::ProxyChannel::Delegate {
+ public:
+ virtual ~DispatcherDelegate() {}
+
+ // ProxyChannel::Delegate implementation.
+ virtual base::MessageLoopProxy* GetIPCMessageLoop() {
+ // This is called only in the renderer so we know we have a child process.
+ DCHECK(ChildProcess::current()) << "Must be in the renderer.";
+ return ChildProcess::current()->io_message_loop_proxy();
+ }
+ virtual base::WaitableEvent* GetShutdownEvent() {
+ DCHECK(ChildProcess::current()) << "Must be in the renderer.";
+ return ChildProcess::current()->GetShutDownEvent();
+ }
+};
+
+class HostDispatcherWrapper
: public webkit::ppapi::PluginDelegate::OutOfProcessProxy {
public:
- DispatcherWrapper() {}
- virtual ~DispatcherWrapper() {}
+ HostDispatcherWrapper() {}
+ virtual ~HostDispatcherWrapper() {}
- bool Init(RenderView* render_view,
- base::ProcessHandle plugin_process_handle,
+ bool Init(base::ProcessHandle plugin_process_handle,
const IPC::ChannelHandle& channel_handle,
PP_Module pp_module,
- ppapi::proxy::Dispatcher::GetInterfaceFunc local_get_interface);
+ ppapi::proxy::Dispatcher::GetInterfaceFunc local_get_interface,
+ const ppapi::Preferences& preferences) {
+ dispatcher_delegate_.reset(new DispatcherDelegate);
+ dispatcher_.reset(new ppapi::proxy::HostDispatcher(
+ plugin_process_handle, pp_module, local_get_interface));
+
+ if (!dispatcher_->InitHostWithChannel(
+ dispatcher_delegate_.get(),
+ channel_handle, true, preferences)) {
+ dispatcher_.reset();
+ dispatcher_delegate_.reset();
+ return false;
+ }
+ dispatcher_->channel()->SetRestrictDispatchToSameChannel(true);
+ return true;
+ }
// OutOfProcessProxy implementation.
virtual const void* GetProxiedInterface(const char* name) {
@@ -358,6 +388,7 @@ class DispatcherWrapper
private:
scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_;
+ scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_;
};
class QuotaCallbackTranslator : public QuotaDispatcher::Callback {
@@ -437,26 +468,6 @@ class PlatformVideoCaptureImpl
} // namespace
-bool DispatcherWrapper::Init(
- RenderView* render_view,
- base::ProcessHandle plugin_process_handle,
- const IPC::ChannelHandle& channel_handle,
- PP_Module pp_module,
- ppapi::proxy::Dispatcher::GetInterfaceFunc local_get_interface) {
- dispatcher_.reset(new ppapi::proxy::HostDispatcher(
- plugin_process_handle, pp_module, local_get_interface));
-
- if (!dispatcher_->InitHostWithChannel(
- PepperPluginRegistry::GetInstance(),
- channel_handle, true,
- ppapi::Preferences(render_view->webkit_preferences()))) {
- dispatcher_.reset();
- return false;
- }
- dispatcher_->channel()->SetRestrictDispatchToSameChannel(true);
- return true;
-}
-
BrokerDispatcherWrapper::BrokerDispatcherWrapper() {
}
@@ -466,13 +477,15 @@ BrokerDispatcherWrapper::~BrokerDispatcherWrapper() {
bool BrokerDispatcherWrapper::Init(
base::ProcessHandle plugin_process_handle,
const IPC::ChannelHandle& channel_handle) {
+ dispatcher_delegate_.reset(new DispatcherDelegate);
dispatcher_.reset(
new ppapi::proxy::BrokerHostDispatcher(plugin_process_handle));
- if (!dispatcher_->InitBrokerWithChannel(PepperPluginRegistry::GetInstance(),
+ if (!dispatcher_->InitBrokerWithChannel(dispatcher_delegate_.get(),
channel_handle,
true)) {
dispatcher_.reset();
+ dispatcher_delegate_.reset();
return false;
}
dispatcher_->channel()->SetRestrictDispatchToSameChannel(true);
@@ -698,12 +711,13 @@ PepperPluginDelegateImpl::CreatePepperPluginModule(
module = new webkit::ppapi::PluginModule(info->name, path,
PepperPluginRegistry::GetInstance());
PepperPluginRegistry::GetInstance()->AddLiveModule(path, module);
- scoped_ptr<DispatcherWrapper> dispatcher(new DispatcherWrapper);
+ scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper);
if (!dispatcher->Init(
- render_view_,
- plugin_process_handle, channel_handle,
+ plugin_process_handle,
+ channel_handle,
module->pp_module(),
- webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc()))
+ webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(),
+ GetPreferences()))
return scoped_refptr<webkit::ppapi::PluginModule>();
module->InitAsProxied(dispatcher.release());
return module;
diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h
index ca2b3fd..cf8d2c3 100644
--- a/content/renderer/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper_plugin_delegate_impl.h
@@ -68,6 +68,7 @@ class BrokerDispatcherWrapper {
private:
scoped_ptr<ppapi::proxy::BrokerDispatcher> dispatcher_;
+ scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_;
};
// This object is NOT thread-safe.
diff --git a/ppapi/proxy/proxy_channel.h b/ppapi/proxy/proxy_channel.h
index 744d087..3dfc297 100644
--- a/ppapi/proxy/proxy_channel.h
+++ b/ppapi/proxy/proxy_channel.h
@@ -34,6 +34,8 @@ class PPAPI_PROXY_EXPORT ProxyChannel
class Delegate {
public:
+ virtual ~Delegate() {}
+
// Returns the dedicated message loop for processing IPC requests.
virtual base::MessageLoopProxy* GetIPCMessageLoop() = 0;