Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1227)

Unified Diff: content/renderer/pepper/pepper_plugin_registry.cc

Issue 69363002: Pepper: Tighten GetLiveModule in PluginRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Gross possible test fix Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_plugin_registry.cc
diff --git a/content/renderer/pepper/pepper_plugin_registry.cc b/content/renderer/pepper/pepper_plugin_registry.cc
index c40294bfbcfc9fc78419b1fdfa85aa79a30739fb..d85dac55316c8a1fe9a63f711b586c30d4022852 100644
--- a/content/renderer/pepper/pepper_plugin_registry.cc
+++ b/content/renderer/pepper/pepper_plugin_registry.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "content/common/pepper_plugin_list.h"
+#include "content/renderer/pepper/pepper_plugin_instance_impl.h"
#include "content/renderer/pepper/plugin_module.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
@@ -46,7 +47,24 @@ PluginModule* PepperPluginRegistry::GetLiveModule(const base::FilePath& path) {
NonOwningModuleMap::iterator it = live_modules_.find(path);
if (it == live_modules_.end())
dmichael (off chromium) 2013/11/11 23:41:36 I think "it" and "jt" are too similar. Maybe: it->
return NULL;
- return it->second;
+
+ // Check the instances for the module to see if they've all been Delete()d.
+ // We don't want to return a PluginModule in that case, since the plugin may
+ // have exited already.
+ const PluginModule::PluginInstanceSet& instance_set =
+ it->second->GetAllInstances();
+ // If instance_set is empty, InstanceCreated() hasn't been called yet, so
+ // it's safe to return the PluginModule.
+ if (instance_set.size() == 0)
+ return it->second;
+
+ PluginModule::PluginInstanceSet::const_iterator jt = instance_set.begin();
+ while (jt != instance_set.end()) {
+ if (!(*jt)->is_deleted())
+ return it->second;
+ ++jt;
+ }
+ return NULL;
}
void PepperPluginRegistry::AddLiveModule(const base::FilePath& path,
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698