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

Unified Diff: ppapi/proxy/interface_list.cc

Issue 141523010: Pepper: Log in UMA when an interface is used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
Index: ppapi/proxy/interface_list.cc
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 79789d70ace37d9fc95b62b3a6bb4790289e589b..ddf92b708ada3b805eb281f74fb8a7d5f070c556 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -4,6 +4,7 @@
#include "ppapi/proxy/interface_list.h"
+#include "base/hash.h"
#include "base/lazy_instance.h"
#include "base/memory/singleton.h"
#include "ppapi/c/dev/ppb_alarms_dev.h"
@@ -104,6 +105,8 @@
#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
#include "ppapi/proxy/interface_proxy.h"
+#include "ppapi/proxy/plugin_globals.h"
+#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppb_audio_proxy.h"
#include "ppapi/proxy/ppb_broker_proxy.h"
#include "ppapi/proxy/ppb_buffer_proxy.h"
@@ -315,15 +318,23 @@ InterfaceProxy::Factory InterfaceList::GetFactoryForID(ApiID id) const {
return id_to_factory_[index];
}
-const void* InterfaceList::GetInterfaceForPPB(const std::string& name) const {
- NameToInterfaceInfoMap::const_iterator found =
+const void* InterfaceList::GetInterfaceForPPB(const std::string& name) {
+ 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.
+ if (!found->second.interface_logged) {
+ int hash = bit_cast<int>(base::Hash(name.c_str(), name.size()));
+ PluginGlobals::Get()->GetBrowserSender()->Send(
+ new PpapiHostMsg_LogInterfaceUsage(hash));
+ found->second.interface_logged = true;
+ }
return found->second.iface;
+ }
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698