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

Unified Diff: ppapi/proxy/interface_list.cc

Issue 566243004: Revert of PPAPI: Fix GetBrowserInterface race conditions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 | « ppapi/proxy/interface_list.h ('k') | ppapi/proxy/plugin_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/interface_list.cc
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 75138dc2ca5a6018ca87cc02adb7e51440f1dfaa..295069e706d0b96bf7dfabe9715b93143e711984 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -319,8 +319,6 @@
// 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();
}
@@ -339,19 +337,20 @@
}
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())) {
+ found->second.required_permission)) {
// Only log interface use once per plugin.
- found->second->LogWithUmaOnce(
- PluginGlobals::Get()->GetBrowserSender(), name);
- return found->second->iface();
+ if (!found->second.interface_logged) {
+ PluginGlobals::Get()->GetBrowserSender()->Send(
+ new PpapiHostMsg_LogInterfaceUsage(HashInterfaceName(name)));
+ found->second.interface_logged = true;
+ }
+ return found->second.iface;
}
return NULL;
}
@@ -361,20 +360,7 @@
name_to_plugin_info_.find(name);
if (found == name_to_plugin_info_.end())
return NULL;
- return found->second->iface();
-}
-
-void InterfaceList::InterfaceInfo::LogWithUmaOnce(
- IPC::Sender* sender, const std::string& name) {
- {
- base::AutoLock acquire(sent_to_uma_lock_);
- if (sent_to_uma_)
- return;
- sent_to_uma_ = true;
- }
- int hash = InterfaceList::HashInterfaceName(name);
- PluginGlobals::Get()->GetBrowserSender()->Send(
- new PpapiHostMsg_LogInterfaceUsage(hash));
+ return found->second.iface;
}
void InterfaceList::AddProxy(ApiID id,
@@ -397,18 +383,16 @@
const void* iface,
Permission perm) {
DCHECK(name_to_browser_info_.find(name) == name_to_browser_info_.end());
- name_to_browser_info_.add(
- name, scoped_ptr<InterfaceInfo>(new InterfaceInfo(iface, perm)));
+ name_to_browser_info_[name] = 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_.add(
- name,
- scoped_ptr<InterfaceInfo>(new InterfaceInfo(iface, PERMISSION_NONE)));
-}
-
+ name_to_plugin_info_[name] = 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,
« no previous file with comments | « ppapi/proxy/interface_list.h ('k') | ppapi/proxy/plugin_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698