diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-15 16:46:53 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-15 16:46:53 +0000 |
commit | 59bea13f0036ab8c3ef9a1fca0f95bc446bea839 (patch) | |
tree | e15a226565ce5bddbd30bfbf7c035efa38000fec | |
parent | 14b5cd31c15d02716b536d315dbf187c161f170f (diff) | |
download | chromium_src-59bea13f0036ab8c3ef9a1fca0f95bc446bea839.zip chromium_src-59bea13f0036ab8c3ef9a1fca0f95bc446bea839.tar.gz chromium_src-59bea13f0036ab8c3ef9a1fca0f95bc446bea839.tar.bz2 |
Reland r101259 after fixing shared-library build issues.
Removed the dependency of PepperPluginRegistry on Pepper proxy.
We would need to move PepperPluginRegistry to webkit/plugins/ppapi so that it can be used by test_shell. But before we can move it, we need to remove all dependencies on content and pepper/proxy.
TEST=Manually ran pepper 3d demos in-process and out-of-process.
TBR=brettw@chromium.org
Review URL: http://codereview.chromium.org/7912001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101306 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/common/pepper_plugin_registry.cc | 11 | ||||
-rw-r--r-- | content/common/pepper_plugin_registry.h | 8 | ||||
-rw-r--r-- | content/renderer/pepper_plugin_delegate_impl.cc | 76 | ||||
-rw-r--r-- | content/renderer/pepper_plugin_delegate_impl.h | 1 | ||||
-rw-r--r-- | ppapi/proxy/proxy_channel.h | 4 |
5 files changed, 50 insertions, 50 deletions
diff --git a/content/common/pepper_plugin_registry.cc b/content/common/pepper_plugin_registry.cc index 5bb2f29..38304d3 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" @@ -239,13 +238,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 b3b94ab..4f29402 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" @@ -56,8 +55,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(); @@ -102,10 +100,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..89d81ae 100644 --- a/ppapi/proxy/proxy_channel.h +++ b/ppapi/proxy/proxy_channel.h @@ -32,8 +32,10 @@ class PPAPI_PROXY_EXPORT ProxyChannel public: typedef void (*ShutdownModuleFunc)(); - class Delegate { + class PPAPI_PROXY_EXPORT Delegate { public: + virtual ~Delegate() {} + // Returns the dedicated message loop for processing IPC requests. virtual base::MessageLoopProxy* GetIPCMessageLoop() = 0; |