Pepper: Log in UMA when an interface is used.
We'd like to know what versions of our interfaces are used by end users. This
change logs usage of PPB interfaces for out-of-process plugins the first time
that get_interface<>() is called for a given interface and version.
I tested this change by loading some plugin examples and checking the
about:histograms page.
BUG=111542
[email protected], [email protected], [email protected]
Review URL: https://codereview.chromium.org/141523010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249007 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/interface_list.h b/ppapi/proxy/interface_list.h
index 85b7eb6..a2b4569c 100644
--- a/ppapi/proxy/interface_list.h
+++ b/ppapi/proxy/interface_list.h
@@ -41,7 +41,7 @@
// Returns the interface pointer for the given browser or plugin interface,
// or NULL if it's not supported.
- const void* GetInterfaceForPPB(const std::string& name) const;
+ const void* GetInterfaceForPPB(const std::string& name);
const void* GetInterfaceForPPP(const std::string& name) const;
private:
@@ -50,11 +50,13 @@
struct InterfaceInfo {
InterfaceInfo()
: iface(NULL),
- required_permission(PERMISSION_NONE) {
+ required_permission(PERMISSION_NONE),
+ interface_logged(false) {
}
InterfaceInfo(const void* in_interface, Permission in_perm)
: iface(in_interface),
- required_permission(in_perm) {
+ required_permission(in_perm),
+ interface_logged(false) {
}
const void* iface;
@@ -63,6 +65,9 @@
// be checked with the value set via SetProcessGlobalPermissionBits when
// an interface is requested.
Permission required_permission;
+
+ // Interface usage is logged just once per-interface-per-plugin-process.
+ bool interface_logged;
};
typedef std::map<std::string, InterfaceInfo> NameToInterfaceInfoMap;
@@ -75,6 +80,9 @@
void AddPPB(const char* name, const void* iface, Permission permission);
void AddPPP(const char* name, const void* iface);
+ // Hash the interface name for UMA logging.
+ static int HashInterfaceName(const std::string& name);
+
PpapiPermissions permissions_;
NameToInterfaceInfoMap name_to_browser_info_;