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

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

Issue 10069041: Add more NULL checks in proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc » ('j') | 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
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc (revision 132078)
+++ ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc (working copy)
@@ -56,7 +56,7 @@
void SetBrowserPppForInstance(PP_Instance instance, BrowserPpp* browser_ppp) {
// If there was no map, create one.
- if (instance_to_ppp_map == NULL) {
+ if (NULL == instance_to_ppp_map) {
instance_to_ppp_map = new std::map<PP_Instance, BrowserPpp*>;
}
// Add the instance to the map.
@@ -64,7 +64,7 @@
}
void UnsetBrowserPppForInstance(PP_Instance instance) {
- if (instance_to_ppp_map == NULL) {
+ if (NULL == instance_to_ppp_map) {
// Something major is wrong here. We are deleting a map entry
// when there is no map.
NACL_NOTREACHED();
@@ -80,7 +80,7 @@
}
BrowserPpp* LookupBrowserPppForInstance(PP_Instance instance) {
- if (instance_to_ppp_map == NULL) {
+ if (NULL == instance_to_ppp_map) {
return NULL;
}
return (*instance_to_ppp_map)[instance];
@@ -88,7 +88,7 @@
void SetModuleIdForSrpcChannel(NaClSrpcChannel* channel, PP_Module module_id) {
// If there was no map, create one.
- if (channel_to_module_id_map == NULL) {
+ if (NULL == channel_to_module_id_map) {
channel_to_module_id_map = new std::map<NaClSrpcChannel*, PP_Module>;
}
// Add the channel to the map.
@@ -97,14 +97,14 @@
void SetInstanceIdForSrpcChannel(NaClSrpcChannel* channel,
PP_Instance instance_id) {
- if (channel_to_instance_id_map == NULL) {
+ if (NULL == channel_to_instance_id_map) {
channel_to_instance_id_map = new std::map<NaClSrpcChannel*, PP_Instance>;
}
(*channel_to_instance_id_map)[channel] = instance_id;
}
void UnsetModuleIdForSrpcChannel(NaClSrpcChannel* channel) {
- if (channel_to_module_id_map == NULL) {
+ if (NULL == channel_to_module_id_map) {
// Something major is wrong here. We are deleting a map entry
// when there is no map.
NACL_NOTREACHED();
@@ -120,7 +120,7 @@
}
void UnsetInstanceIdForSrpcChannel(NaClSrpcChannel* channel) {
- if (channel_to_instance_id_map == NULL) {
+ if (NULL == channel_to_instance_id_map) {
NACL_NOTREACHED();
return;
}
@@ -132,14 +132,14 @@
}
PP_Module LookupModuleIdForSrpcChannel(NaClSrpcChannel* channel) {
- if (channel_to_module_id_map == NULL) {
+ if (NULL == channel_to_module_id_map) {
return 0;
}
return (*channel_to_module_id_map)[channel];
}
PP_Module LookupInstanceIdForSrpcChannel(NaClSrpcChannel* channel) {
- if (channel_to_instance_id_map == NULL) {
+ if (NULL == channel_to_instance_id_map) {
return 0;
}
return (*channel_to_instance_id_map)[channel];
@@ -154,13 +154,16 @@
}
NaClSrpcChannel* GetMainSrpcChannel(PP_Instance instance) {
- return LookupBrowserPppForInstance(instance)->main_channel();
+ BrowserPpp* proxy = LookupBrowserPppForInstance(instance);
+ if (NULL == proxy)
+ return NULL;
+ return proxy->main_channel();
}
void CleanUpAfterDeadNexe(PP_Instance instance) {
DebugPrintf("CleanUpAfterDeadNexe\n");
BrowserPpp* proxy = LookupBrowserPppForInstance(instance);
- if (proxy == NULL)
+ if (NULL == proxy)
return;
proxy->plugin()->ReportDeadNexe(); // Shuts down and deletes the proxy.
}
@@ -207,9 +210,9 @@
const void* GetBrowserInterfaceSafe(const char* interface_name) {
const void* ppb_interface = GetBrowserInterface(interface_name);
- if (ppb_interface == NULL)
+ if (NULL == ppb_interface)
DebugPrintf("PPB_GetInterface: %s not found\n", interface_name);
- CHECK(ppb_interface != NULL);
+ CHECK(NULL != ppb_interface);
return ppb_interface;
}
« no previous file with comments | « no previous file | ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698