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

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

Issue 3391010: Update the PPAPI DEPS revision. This change included parameter profile chang... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 10 years, 3 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 | « src/shared/ppapi_proxy/browser_globals.h ('k') | src/shared/ppapi_proxy/browser_ppp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/ppapi_proxy/browser_globals.cc
===================================================================
--- src/shared/ppapi_proxy/browser_globals.cc (revision 3312)
+++ src/shared/ppapi_proxy/browser_globals.cc (working copy)
@@ -13,6 +13,8 @@
namespace {
std::map<PP_Instance, BrowserPpp*>* instance_to_ppp_map = NULL;
+std::map<NaClSrpcChannel*, PP_Module>* channel_to_module_id_map = NULL;
+
// The GetInterface pointer from the browser.
PPB_GetInterface get_interface;
// For efficiency, cached results from GetInterface.
@@ -53,6 +55,38 @@
return (*instance_to_ppp_map)[instance];
}
+void SetModuleIdForSrpcChannel(NaClSrpcChannel* channel, PP_Module module_id) {
+ // If there was no map, create one.
+ if (channel_to_module_id_map == NULL) {
+ channel_to_module_id_map = new std::map<NaClSrpcChannel*, PP_Module>;
+ }
+ // Add the channel to the map.
+ (*channel_to_module_id_map)[channel] = module_id;
+}
+
+void UnsetModuleIdForSrpcChannel(NaClSrpcChannel* channel) {
+ if (channel_to_module_id_map == NULL) {
+ // Something major is wrong here. We are deleting a map entry
+ // when there is no map.
+ // TODO(sehr): a CHECK here would be appropriate if we had one in NaCl.
+ return;
+ }
+ // Erase the channel from the map.
+ channel_to_module_id_map->erase(channel);
+ // If there are no more channels alive, remove the map.
+ if (channel_to_module_id_map->size() == 0) {
+ delete channel_to_module_id_map;
+ channel_to_module_id_map = NULL;
+ }
+}
+
+PP_Module LookupModuleIdForSrpcChannel(NaClSrpcChannel* channel) {
+ if (channel_to_module_id_map == NULL) {
+ return NULL;
+ }
+ return (*channel_to_module_id_map)[channel];
+}
+
void SetBrowserGetInterface(PPB_GetInterface get_interface_function) {
get_interface = get_interface_function;
const void* core = (*get_interface_function)(PPB_CORE_INTERFACE);
« no previous file with comments | « src/shared/ppapi_proxy/browser_globals.h ('k') | src/shared/ppapi_proxy/browser_ppp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698