| 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..5939ce16d23c3827909b38f283c9337bac643321 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"
|
|
|
| @@ -43,10 +44,29 @@ const PepperPluginInfo* PepperPluginRegistry::GetInfoForPlugin(
|
| }
|
|
|
| PluginModule* PepperPluginRegistry::GetLiveModule(const base::FilePath& path) {
|
| - NonOwningModuleMap::iterator it = live_modules_.find(path);
|
| - if (it == live_modules_.end())
|
| + NonOwningModuleMap::iterator module_iter = live_modules_.find(path);
|
| + if (module_iter == live_modules_.end())
|
| 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 =
|
| + module_iter->second->GetAllInstances();
|
| +
|
| + // If instance_set is empty, InstanceCreated() hasn't been called yet, so
|
| + // it's safe to return the PluginModule.
|
| + if (instance_set.empty())
|
| + return module_iter->second;
|
| +
|
| + PluginModule::PluginInstanceSet::const_iterator instance_iter =
|
| + instance_set.begin();
|
| + while (instance_iter != instance_set.end()) {
|
| + if (!(*instance_iter)->is_deleted())
|
| + return module_iter->second;
|
| + ++instance_iter;
|
| + }
|
| + return NULL;
|
| }
|
|
|
| void PepperPluginRegistry::AddLiveModule(const base::FilePath& path,
|
|
|