Index: ppapi/proxy/host_dispatcher.cc |
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc |
index c00390bf3245716b227c0d7636d495d9cf7527d2..35143be71d5e9bd47f1b114eeec6ff56908a0f1a 100644 |
--- a/ppapi/proxy/host_dispatcher.cc |
+++ b/ppapi/proxy/host_dispatcher.cc |
@@ -75,9 +75,6 @@ HostDispatcher::HostDispatcher(base::ProcessHandle remote_process_handle, |
local_get_interface(PPB_VAR_DEPRECATED_INTERFACE)); |
SetSerializationRules(new HostVarSerializationRules(var_interface, module)); |
- memset(plugin_interface_support_, 0, |
- sizeof(PluginInterfaceSupport) * INTERFACE_ID_COUNT); |
- |
ppb_proxy_ = reinterpret_cast<const PPB_Proxy_Private*>( |
GetLocalInterface(PPB_PROXY_PRIVATE_INTERFACE)); |
DCHECK(ppb_proxy_) << "The proxy interface should always be supported."; |
@@ -208,21 +205,19 @@ const void* HostDispatcher::GetProxiedInterface(const std::string& interface) { |
if (!info) |
return NULL; |
- if (plugin_interface_support_[static_cast<int>(info->id)] != |
- INTERFACE_UNQUERIED) { |
- // Already queried the plugin if it supports this interface. |
- if (plugin_interface_support_[info->id] == INTERFACE_SUPPORTED) |
- return info->interface_ptr; |
- return NULL; |
+ PluginIFSupportMap::iterator iter(plugin_if_support_.find(interface)); |
+ if (iter == plugin_if_support_.end()) { |
+ // Need to query. Cache the result so we only do this once. |
+ bool supported = false; |
+ Send(new PpapiMsg_SupportsInterface(interface, &supported)); |
+ std::pair<PluginIFSupportMap::iterator, bool> iter_success_pair; |
+ iter_success_pair = plugin_if_support_.insert( |
+ PluginIFSupportMap::value_type(interface, |
+ supported ? INTERFACE_SUPPORTED : |
+ INTERFACE_UNSUPPORTED)); |
+ iter = iter_success_pair.first; |
} |
- |
- // Need to re-query. Cache the result so we only do this once. |
- bool supported = false; |
- Send(new PpapiMsg_SupportsInterface(interface, &supported)); |
- plugin_interface_support_[static_cast<int>(info->id)] = |
- supported ? INTERFACE_SUPPORTED : INTERFACE_UNSUPPORTED; |
- |
- if (supported) |
+ if (iter->second == INTERFACE_SUPPORTED) |
return info->interface_ptr; |
return NULL; |
} |