Chromium Code Reviews| 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())); |
|
Alexei Svitkine (slow)
2014/01/31 17:49:04
What is |name| in this case? Is there a list of va
teravest
2014/02/03 15:36:55
There's a list of valid possibilities, but it's sp
Alexei Svitkine (slow)
2014/02/03 19:25:10
I think you should make an effort to enumerate the
|
| + PluginGlobals::Get()->GetBrowserSender()->Send( |
| + new PpapiHostMsg_LogInterfaceUsage(hash)); |
| + found->second.interface_logged = true; |
| + } |
| return found->second.iface; |
| + } |
| return NULL; |
| } |