Index: ppapi/proxy/interface_list.cc |
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc |
index 295069e706d0b96bf7dfabe9715b93143e711984..617c9d35b506da4dec806d219485718a7cbd341f 100644 |
--- a/ppapi/proxy/interface_list.cc |
+++ b/ppapi/proxy/interface_list.cc |
@@ -319,6 +319,8 @@ InterfaceList::~InterfaceList() { |
// static |
InterfaceList* InterfaceList::GetInstance() { |
+ // CAUTION: This function is called without the ProxyLock to avoid excessive |
+ // excessive locking from C++ wrappers. (See also GetBrowserInterface.) |
return Singleton<InterfaceList>::get(); |
} |
@@ -337,20 +339,22 @@ InterfaceProxy::Factory InterfaceList::GetFactoryForID(ApiID id) const { |
} |
const void* InterfaceList::GetInterfaceForPPB(const std::string& name) { |
+ // CAUTION: This function is called without the ProxyLock to avoid excessive |
+ // excessive locking from C++ wrappers. (See also GetBrowserInterface.) |
NameToInterfaceInfoMap::iterator found = |
name_to_browser_info_.find(name); |
if (found == name_to_browser_info_.end()) |
return NULL; |
if (g_process_global_permissions.Get().HasPermission( |
- found->second.required_permission)) { |
- // Only log interface use once per plugin. |
- if (!found->second.interface_logged) { |
+ found->second->required_permission)) { |
+ // Only log interface use approximately once per plugin. If the atomic |
+ // sequence number rolls over, we might log again, but that's OK. |
+ if (found->second->interface_request_count_.GetNext() == 0) { |
PluginGlobals::Get()->GetBrowserSender()->Send( |
new PpapiHostMsg_LogInterfaceUsage(HashInterfaceName(name))); |
dmichael (off chromium)
2014/09/12 18:12:07
note that previously, even with the "interface_log
|
- found->second.interface_logged = true; |
} |
- return found->second.iface; |
+ return found->second->iface; |
} |
return NULL; |
} |
@@ -360,7 +364,7 @@ const void* InterfaceList::GetInterfaceForPPP(const std::string& name) const { |
name_to_plugin_info_.find(name); |
if (found == name_to_plugin_info_.end()) |
return NULL; |
- return found->second.iface; |
+ return found->second->iface; |
} |
void InterfaceList::AddProxy(ApiID id, |
@@ -383,16 +387,18 @@ void InterfaceList::AddPPB(const char* name, |
const void* iface, |
Permission perm) { |
DCHECK(name_to_browser_info_.find(name) == name_to_browser_info_.end()); |
- name_to_browser_info_[name] = InterfaceInfo(iface, perm); |
+ name_to_browser_info_.add( |
+ name, scoped_ptr<InterfaceInfo>(new InterfaceInfo(iface, perm))); |
} |
void InterfaceList::AddPPP(const char* name, |
const void* iface) { |
DCHECK(name_to_plugin_info_.find(name) == name_to_plugin_info_.end()); |
- name_to_plugin_info_[name] = InterfaceInfo(iface, PERMISSION_NONE); |
+ name_to_plugin_info_.add( |
+ name, |
+ scoped_ptr<InterfaceInfo>(new InterfaceInfo(iface, PERMISSION_NONE))); |
} |
-// static |
int InterfaceList::HashInterfaceName(const std::string& name) { |
uint32 data = base::Hash(name.c_str(), name.size()); |
// Strip off the signed bit because UMA doesn't support negative values, |