Chromium Code Reviews| Index: content/renderer/pepper/pepper_plugin_delegate_impl.cc |
| =================================================================== |
| --- content/renderer/pepper/pepper_plugin_delegate_impl.cc (revision 161836) |
| +++ content/renderer/pepper/pepper_plugin_delegate_impl.cc (working copy) |
| @@ -415,6 +415,51 @@ |
| } |
| scoped_refptr<webkit::ppapi::PluginModule> |
| +PepperPluginDelegateImpl::CreateNaClPluginModule( |
|
brettw
2012/10/16 18:23:53
Let's call this "CreateExternalPluginModule" and p
bbudge
2012/10/16 21:03:38
Done.
|
| + webkit::ppapi::PluginInstance* plugin_instance, |
| + ppapi::PpapiPermissions permissions, |
| + const IPC::ChannelHandle& channel_handle, |
| + int nacl_process_id) { |
| + // Create a new module for each instance of the NaCl plugin that is using |
| + // the IPC based out-of-process proxy. We can't use the existing module, |
| + // because it is configured for the in-process NaCl plugin, and we must |
| + // keep it that way to allow the page to create other instances. |
| + webkit::ppapi::PluginModule* plugin_module = plugin_instance->module(); |
| + scoped_refptr<webkit::ppapi::PluginModule> nacl_plugin_module( |
| + plugin_module->CreateModuleForNaClInstance()); |
| + |
| + scoped_refptr<PepperHungPluginFilter> hung_filter( |
| + new PepperHungPluginFilter( |
| + FilePath(FILE_PATH_LITERAL("NaCl")), |
| + render_view_->routing_id(), |
| + nacl_process_id)); |
| + |
| + // Create a new HostDispatcher for the proxy, and hook it up to the new |
| + // PluginModule. |
| + scoped_ptr<HostDispatcherWrapper> dispatcher( |
| + new HostDispatcherWrapper(nacl_plugin_module, |
| + nacl_process_id, |
| + permissions)); |
| + if (!dispatcher->Init( |
| + channel_handle, |
| + webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), |
| + GetPreferences(), |
| + permissions, |
| + hung_filter.get())) |
| + return scoped_refptr<webkit::ppapi::PluginModule>(); |
| + |
| + RendererPpapiHostImpl* host_impl = |
| + content::RendererPpapiHostImpl::CreateOnModuleForOutOfProcess( |
| + nacl_plugin_module, dispatcher->dispatcher(), permissions); |
| + render_view_->PpapiPluginCreated(host_impl); |
| + |
| + nacl_plugin_module->InitAsProxiedNaCl( |
| + dispatcher.release(), |
| + plugin_instance); |
| + return nacl_plugin_module; |
| +} |
| + |
| +scoped_refptr<webkit::ppapi::PluginModule> |
| PepperPluginDelegateImpl::CreateBrowserPluginModule( |
| const IPC::ChannelHandle& channel_handle, |
| int guest_process_id) { |