| Index: content/renderer/pepper_plugin_delegate_impl.cc
|
| ===================================================================
|
| --- content/renderer/pepper_plugin_delegate_impl.cc (revision 101299)
|
| +++ content/renderer/pepper_plugin_delegate_impl.cc (working copy)
|
| @@ -333,18 +333,48 @@
|
| }
|
| }
|
|
|
| -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) {
|
| return dispatcher_->GetProxiedInterface(name);
|
| @@ -358,6 +388,7 @@
|
|
|
| private:
|
| scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_;
|
| + scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_;
|
| };
|
|
|
| class QuotaCallbackTranslator : public QuotaDispatcher::Callback {
|
| @@ -437,26 +468,6 @@
|
|
|
| } // 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 @@
|
| 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 @@
|
| 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;
|
|
|