| Index: ppapi/proxy/interface_list.h
|
| diff --git a/ppapi/proxy/interface_list.h b/ppapi/proxy/interface_list.h
|
| index a2b4569c8f1b3b3693af6f85b068e82095a334c4..dc109e5c5afd45ca1395ff1dec3d658684e12bbf 100644
|
| --- a/ppapi/proxy/interface_list.h
|
| +++ b/ppapi/proxy/interface_list.h
|
| @@ -9,6 +9,8 @@
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/containers/scoped_ptr_hash_map.h"
|
| +#include "base/synchronization/lock.h"
|
| #include "ppapi/proxy/interface_proxy.h"
|
| #include "ppapi/proxy/ppapi_proxy_export.h"
|
| #include "ppapi/shared_impl/ppapi_permissions.h"
|
| @@ -47,30 +49,39 @@ class PPAPI_PROXY_EXPORT InterfaceList {
|
| private:
|
| friend class InterfaceListTest;
|
|
|
| - struct InterfaceInfo {
|
| - InterfaceInfo()
|
| - : iface(NULL),
|
| - required_permission(PERMISSION_NONE),
|
| - interface_logged(false) {
|
| - }
|
| + class InterfaceInfo {
|
| + public:
|
| InterfaceInfo(const void* in_interface, Permission in_perm)
|
| - : iface(in_interface),
|
| - required_permission(in_perm),
|
| - interface_logged(false) {
|
| + : iface_(in_interface),
|
| + required_permission_(in_perm),
|
| + sent_to_uma_(false) {
|
| }
|
|
|
| - const void* iface;
|
| + const void* iface() { return iface_; }
|
|
|
| // Permission required to return non-null for this interface. This will
|
| // be checked with the value set via SetProcessGlobalPermissionBits when
|
| // an interface is requested.
|
| - Permission required_permission;
|
| + Permission required_permission() { return required_permission_; };
|
| +
|
| + // Call this any time the interface is requested. It will log a UMA count
|
| + // only the first time. This is safe to call from any thread, regardless of
|
| + // whether the proxy lock is held.
|
| + void LogWithUmaOnce(IPC::Sender* sender, const std::string& name);
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(InterfaceInfo);
|
| +
|
| + const void* const iface_;
|
| + const Permission required_permission_;
|
|
|
| - // Interface usage is logged just once per-interface-per-plugin-process.
|
| - bool interface_logged;
|
| + bool sent_to_uma_;
|
| + base::Lock sent_to_uma_lock_;
|
| };
|
| + // Give friendship for HashInterfaceName.
|
| + friend class InterfaceInfo;
|
|
|
| - typedef std::map<std::string, InterfaceInfo> NameToInterfaceInfoMap;
|
| + typedef base::ScopedPtrHashMap<std::string, InterfaceInfo>
|
| + NameToInterfaceInfoMap;
|
|
|
| void AddProxy(ApiID id, InterfaceProxy::Factory factory);
|
|
|
|
|