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

Unified Diff: ppapi/proxy/host_dispatcher.cc

Issue 7189045: Make o.o.p. proxy handle PPP_Instance versions 0.4 and 0.5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 9 years, 6 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
« no previous file with comments | « ppapi/proxy/host_dispatcher.h ('k') | ppapi/proxy/host_dispatcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/host_dispatcher.cc
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index c00390bf3245716b227c0d7636d495d9cf7527d2..60c0cf7f66d98680bb91a27d8757c0b2aac381d1 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -75,9 +75,8 @@ 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);
-
+ // TODO(brettw): It might be more testable to inject the PPB_Proxy_Private
+ // instead of requesting it from GetLocalInterface.
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 +207,17 @@ 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;
+ PluginIFSupportedMap::iterator iter(plugin_if_supported_.find(interface));
+ if (iter == plugin_if_supported_.end()) {
+ // Need to query. Cache the result so we only do this once.
+ bool supported = false;
+ Send(new PpapiMsg_SupportsInterface(interface, &supported));
+ std::pair<PluginIFSupportedMap::iterator, bool> iter_success_pair;
+ iter_success_pair = plugin_if_supported_.insert(
+ PluginIFSupportedMap::value_type(interface, supported));
+ 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)
return info->interface_ptr;
return NULL;
}
« no previous file with comments | « ppapi/proxy/host_dispatcher.h ('k') | ppapi/proxy/host_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698