Index: content/renderer/pepper/plugin_module.cc |
=================================================================== |
--- content/renderer/pepper/plugin_module.cc (revision 213482) |
+++ content/renderer/pepper/plugin_module.cc (working copy) |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "webkit/plugins/ppapi/plugin_module.h" |
+#include "content/renderer/pepper/plugin_module.h" |
#include <set> |
@@ -13,6 +13,18 @@ |
#include "base/message_loop/message_loop.h" |
#include "base/message_loop/message_loop_proxy.h" |
#include "base/time/time.h" |
+#include "content/common/pepper_plugin_registry.h" |
+#include "content/renderer/pepper/common.h" |
+#include "content/renderer/pepper/host_globals.h" |
+#include "content/renderer/pepper/ppapi_interface_factory.h" |
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h" |
+#include "content/renderer/pepper/ppb_gpu_blacklist_private_impl.h" |
+#include "content/renderer/pepper/ppb_image_data_impl.h" |
+#include "content/renderer/pepper/ppb_proxy_impl.h" |
+#include "content/renderer/pepper/ppb_scrollbar_impl.h" |
+#include "content/renderer/pepper/ppb_uma_private_impl.h" |
+#include "content/renderer/pepper/ppb_var_deprecated_impl.h" |
+#include "content/renderer/pepper/ppb_video_decoder_impl.h" |
#include "ppapi/c/dev/ppb_audio_input_dev.h" |
#include "ppapi/c/dev/ppb_buffer_dev.h" |
#include "ppapi/c/dev/ppb_char_set_dev.h" |
@@ -120,17 +132,6 @@ |
#include "ppapi/thunk/ppb_graphics_2d_api.h" |
#include "ppapi/thunk/thunk.h" |
#include "webkit/plugins/plugin_switches.h" |
-#include "webkit/plugins/ppapi/common.h" |
-#include "webkit/plugins/ppapi/host_globals.h" |
-#include "webkit/plugins/ppapi/ppapi_interface_factory.h" |
-#include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h" |
-#include "webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h" |
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
-#include "webkit/plugins/ppapi/ppb_proxy_impl.h" |
-#include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" |
-#include "webkit/plugins/ppapi/ppb_uma_private_impl.h" |
-#include "webkit/plugins/ppapi/ppb_var_deprecated_impl.h" |
-#include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" |
using ppapi::InputEventData; |
using ppapi::PpapiGlobals; |
@@ -340,10 +341,11 @@ |
// Gets the PPAPI entry points from the given library and places them into the |
// given structure. Returns true on success. |
-bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library, |
- PluginModule::EntryPoints* entry_points) { |
+bool LoadEntryPointsFromLibrary( |
+ const base::NativeLibrary& library, |
+ content::PepperPluginInfo::EntryPoints* entry_points) { |
entry_points->get_interface = |
- reinterpret_cast<PluginModule::GetInterfaceFunc>( |
+ reinterpret_cast<content::PepperPluginInfo::GetInterfaceFunc>( |
base::GetFunctionPointerFromNativeLibrary(library, |
"PPP_GetInterface")); |
if (!entry_points->get_interface) { |
@@ -352,7 +354,7 @@ |
} |
entry_points->initialize_module = |
- reinterpret_cast<PluginModule::PPP_InitializeModuleFunc>( |
+ reinterpret_cast<content::PepperPluginInfo::PPP_InitializeModuleFunc>( |
base::GetFunctionPointerFromNativeLibrary(library, |
"PPP_InitializeModule")); |
if (!entry_points->initialize_module) { |
@@ -363,7 +365,7 @@ |
// It's okay for PPP_ShutdownModule to not be defined and shutdown_module to |
// be NULL. |
entry_points->shutdown_module = |
- reinterpret_cast<PluginModule::PPP_ShutdownModuleFunc>( |
+ reinterpret_cast<content::PepperPluginInfo::PPP_ShutdownModuleFunc>( |
base::GetFunctionPointerFromNativeLibrary(library, |
"PPP_ShutdownModule")); |
@@ -372,20 +374,12 @@ |
} // namespace |
-PluginModule::EntryPoints::EntryPoints() |
- : get_interface(NULL), |
- initialize_module(NULL), |
- shutdown_module(NULL) { |
-} |
- |
// PluginModule ---------------------------------------------------------------- |
PluginModule::PluginModule(const std::string& name, |
const base::FilePath& path, |
- PluginDelegate::ModuleLifetime* lifetime_delegate, |
const ::ppapi::PpapiPermissions& perms) |
- : lifetime_delegate_(lifetime_delegate), |
- callback_tracker_(new ::ppapi::CallbackTracker), |
+ : callback_tracker_(new ::ppapi::CallbackTracker), |
is_in_destructor_(false), |
is_crashed_(false), |
broker_(NULL), |
@@ -429,10 +423,10 @@ |
// Notifications that we've been deleted should be last. |
HostGlobals::Get()->ModuleDeleted(pp_module_); |
- if (!is_crashed_ && lifetime_delegate_) { |
+ if (!is_crashed_) { |
// When the plugin crashes, we immediately tell the lifetime delegate that |
// we're gone, so we don't want to tell it again. |
- lifetime_delegate_->PluginModuleDead(this); |
+ content::PepperPluginRegistry::GetInstance()->PluginModuleDead(this); |
} |
// Don't add stuff here, the two notifications that the module object has |
@@ -449,7 +443,8 @@ |
return embedder_state_.get(); |
} |
-bool PluginModule::InitAsInternalPlugin(const EntryPoints& entry_points) { |
+bool PluginModule::InitAsInternalPlugin( |
+ const content::PepperPluginInfo::EntryPoints& entry_points) { |
if (InitializeModule(entry_points)) { |
entry_points_ = entry_points; |
return true; |
@@ -462,7 +457,7 @@ |
if (!library) |
return false; |
- EntryPoints entry_points; |
+ content::PepperPluginInfo::EntryPoints entry_points; |
if (!LoadEntryPointsFromLibrary(library, &entry_points) || |
!InitializeModule(entry_points)) { |
@@ -487,7 +482,6 @@ |
scoped_refptr<PluginModule> external_plugin_module( |
new PluginModule(name_, |
path_, |
- NULL, // no lifetime_delegate |
permissions_)); |
return external_plugin_module; |
} |
@@ -528,7 +522,8 @@ |
} |
// static |
-PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { |
+content::PepperPluginInfo::GetInterfaceFunc |
+ PluginModule::GetLocalGetInterfaceFunc() { |
return &GetInterface; |
} |
@@ -593,8 +588,7 @@ |
i != instances_.end(); ++i) |
(*i)->InstanceCrashed(); |
- if (lifetime_delegate_) |
- lifetime_delegate_->PluginModuleDead(this); |
+ content::PepperPluginRegistry::GetInstance()->PluginModuleDead(this); |
} |
void PluginModule::SetReserveInstanceIDCallback( |
@@ -624,7 +618,8 @@ |
host_globals = NULL; |
} |
-bool PluginModule::InitializeModule(const EntryPoints& entry_points) { |
+bool PluginModule::InitializeModule( |
+ const content::PepperPluginInfo::EntryPoints& entry_points) { |
DCHECK(!out_of_process_proxy_.get()) << "Don't call for proxied modules."; |
DCHECK(entry_points.initialize_module != NULL); |
int retval = entry_points.initialize_module(pp_module(), &GetInterface); |