summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins/pepper_plugin_module.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-08 22:57:18 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-08 22:57:18 +0000
commit1deed85adce1b9dcd1e133eb591331f49092aad2 (patch)
treeccfd2f40ca4d1cccb8dd68d9fba74a1c742293a2 /webkit/glue/plugins/pepper_plugin_module.cc
parent552751a35b96a59a945677b892a5e15c06ffce7d (diff)
downloadchromium_src-1deed85adce1b9dcd1e133eb591331f49092aad2.zip
chromium_src-1deed85adce1b9dcd1e133eb591331f49092aad2.tar.gz
chromium_src-1deed85adce1b9dcd1e133eb591331f49092aad2.tar.bz2
Convert pepper module and instance IDs from being pointer values to being
random numbers. BUG=57330 TEST=none Review URL: http://codereview.chromium.org/3571022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins/pepper_plugin_module.cc')
-rw-r--r--webkit/glue/plugins/pepper_plugin_module.cc23
1 files changed, 7 insertions, 16 deletions
diff --git a/webkit/glue/plugins/pepper_plugin_module.cc b/webkit/glue/plugins/pepper_plugin_module.cc
index 99047bf..d54eaa1 100644
--- a/webkit/glue/plugins/pepper_plugin_module.cc
+++ b/webkit/glue/plugins/pepper_plugin_module.cc
@@ -179,21 +179,21 @@ void QuitMessageLoop() {
}
uint32_t GetLiveObjectCount(PP_Module module_id) {
- PluginModule* module = PluginModule::FromPPModule(module_id);
+ PluginModule* module = ResourceTracker::Get()->GetModule(module_id);
if (!module)
return static_cast<uint32_t>(-1);
return ResourceTracker::Get()->GetLiveObjectsForModule(module);
}
PP_Resource GetInaccessibleFileRef(PP_Module module_id) {
- PluginModule* module = PluginModule::FromPPModule(module_id);
+ PluginModule* module = ResourceTracker::Get()->GetModule(module_id);
if (!module)
return static_cast<uint32_t>(-1);
return FileRef::GetInaccessibleFileRef(module)->GetReference();
}
PP_Resource GetNonexistentFileRef(PP_Module module_id) {
- PluginModule* module = PluginModule::FromPPModule(module_id);
+ PluginModule* module = ResourceTracker::Get()->GetModule(module_id);
if (!module)
return static_cast<uint32_t>(-1);
return FileRef::GetNonexistentFileRef(module)->GetReference();
@@ -299,6 +299,7 @@ const void* GetInterface(const char* name) {
PluginModule::PluginModule()
: initialized_(false),
library_(NULL) {
+ pp_module_ = ResourceTracker::Get()->AddModule(this);
GetMainThreadMessageLoop(); // Initialize the main thread message loop.
GetLivePluginSet()->insert(this);
}
@@ -326,6 +327,8 @@ PluginModule::~PluginModule() {
if (library_)
base::UnloadNativeLibrary(library_);
+
+ ResourceTracker::Get()->ModuleDeleted(pp_module_);
}
// static
@@ -350,14 +353,6 @@ scoped_refptr<PluginModule> PluginModule::CreateInternalModule(
}
// static
-PluginModule* PluginModule::FromPPModule(PP_Module module) {
- PluginModule* lib = reinterpret_cast<PluginModule*>(module);
- if (GetLivePluginSet()->find(lib) == GetLivePluginSet()->end())
- return NULL; // Invalid plugin.
- return lib;
-}
-
-// static
const PPB_Core* PluginModule::GetCore() {
return &core_interface;
}
@@ -367,7 +362,7 @@ bool PluginModule::InitFromEntryPoints(const EntryPoints& entry_points) {
return true;
// Attempt to run the initialization funciton.
- int retval = entry_points.initialize_module(GetPPModule(), &GetInterface);
+ int retval = entry_points.initialize_module(pp_module(), &GetInterface);
if (retval != 0) {
LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
return false;
@@ -431,10 +426,6 @@ bool PluginModule::LoadEntryPoints(const base::NativeLibrary& library,
return true;
}
-PP_Module PluginModule::GetPPModule() const {
- return reinterpret_cast<intptr_t>(this);
-}
-
PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) {
const PPP_Instance* plugin_instance_interface =
reinterpret_cast<const PPP_Instance*>(GetPluginInterface(