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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc

Issue 10082013: NaCl PPAPI Proxy: Make browser Lookup* functions return 0 when the key is not found. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc
index 976b7bc3aba0bba9ed91f8cb79e135a20dda4ba0..af424aed3cc7f49fb3f8457acc8ce3b6524d7973 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc
@@ -83,7 +83,11 @@ BrowserPpp* LookupBrowserPppForInstance(PP_Instance instance) {
if (NULL == instance_to_ppp_map) {
return NULL;
}
- return (*instance_to_ppp_map)[instance];
+ std::map<PP_Instance, BrowserPpp*>::const_iterator iter =
+ instance_to_ppp_map->find(instance);
+ if (iter == instance_to_ppp_map->end())
+ return NULL;
+ return iter->second;
}
void SetModuleIdForSrpcChannel(NaClSrpcChannel* channel, PP_Module module_id) {
@@ -135,14 +139,24 @@ PP_Module LookupModuleIdForSrpcChannel(NaClSrpcChannel* channel) {
if (NULL == channel_to_module_id_map) {
return 0;
}
- return (*channel_to_module_id_map)[channel];
+ std::map<NaClSrpcChannel*, PP_Module>::const_iterator iter =
+ channel_to_module_id_map->find(channel);
+ if (iter == channel_to_module_id_map->end()) {
+ return 0;
+ }
+ return iter->second;
}
-PP_Module LookupInstanceIdForSrpcChannel(NaClSrpcChannel* channel) {
+PP_Instance LookupInstanceIdForSrpcChannel(NaClSrpcChannel* channel) {
if (NULL == channel_to_instance_id_map) {
return 0;
}
- return (*channel_to_instance_id_map)[channel];
+ std::map<NaClSrpcChannel*, PP_Instance>::const_iterator iter =
+ channel_to_instance_id_map->find(channel);
+ if (iter == channel_to_instance_id_map->end()) {
+ return 0;
+ }
+ return iter->second;
}
NaClSrpcChannel* GetMainSrpcChannel(NaClSrpcRpc* upcall_rpc) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698