Chromium Code Reviews| 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, |