| OLD | NEW |
| 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" | 5 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "native_client/src/include/nacl_scoped_ptr.h" | 9 #include "native_client/src/include/nacl_scoped_ptr.h" |
| 10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return PP_OK; | 118 return PP_OK; |
| 119 } | 119 } |
| 120 | 120 |
| 121 void BrowserPpp::ShutdownModule() { | 121 void BrowserPpp::ShutdownModule() { |
| 122 DebugPrintf("PPP_Shutdown: main_channel=%p\n", | 122 DebugPrintf("PPP_Shutdown: main_channel=%p\n", |
| 123 static_cast<void*>(main_channel_)); | 123 static_cast<void*>(main_channel_)); |
| 124 if (main_channel_ == NULL) { | 124 if (main_channel_ == NULL) { |
| 125 CHECK(!is_nexe_alive_); | 125 CHECK(!is_nexe_alive_); |
| 126 return; // The proxy has already been shut down. | 126 return; // The proxy has already been shut down. |
| 127 } | 127 } |
| 128 NaClSrpcError srpc_result = | 128 if (is_nexe_alive_) { |
| 129 PppRpcClient::PPP_ShutdownModule(main_channel_); | 129 NaClSrpcError srpc_result = |
| 130 DebugPrintf("PPP_ShutdownModule: %s\n", NaClSrpcErrorString(srpc_result)); | 130 PppRpcClient::PPP_ShutdownModule(main_channel_); |
| 131 DebugPrintf("PPP_ShutdownModule: %s\n", NaClSrpcErrorString(srpc_result)); |
| 132 } |
| 131 NaClThreadJoin(&upcall_thread_); | 133 NaClThreadJoin(&upcall_thread_); |
| 132 UnsetBrowserPppForInstance(plugin_->pp_instance()); | 134 UnsetBrowserPppForInstance(plugin_->pp_instance()); |
| 133 UnsetModuleIdForSrpcChannel(main_channel_); | 135 UnsetModuleIdForSrpcChannel(main_channel_); |
| 134 UnsetInstanceIdForSrpcChannel(main_channel_); | 136 UnsetInstanceIdForSrpcChannel(main_channel_); |
| 135 main_channel_ = NULL; | 137 main_channel_ = NULL; |
| 136 is_nexe_alive_ = false; | 138 is_nexe_alive_ = false; |
| 137 DebugPrintf("PPP_Shutdown: done\n"); | 139 DebugPrintf("PPP_Shutdown: main_channel=NULL\n"); |
| 138 } | 140 } |
| 139 | 141 |
| 140 const void* BrowserPpp::GetPluginInterface(const char* interface_name) { | 142 const void* BrowserPpp::GetPluginInterface(const char* interface_name) { |
| 141 DebugPrintf("PPP_GetInterface('%s')\n", interface_name); | 143 DebugPrintf("PPP_GetInterface('%s')\n", interface_name); |
| 142 if (!is_valid()) | 144 if (!is_valid()) |
| 143 return NULL; | 145 return NULL; |
| 144 int32_t exports_interface_name; | 146 int32_t exports_interface_name; |
| 145 NaClSrpcError srpc_result = | 147 NaClSrpcError srpc_result = |
| 146 PppRpcClient::PPP_GetInterface(main_channel_, | 148 PppRpcClient::PPP_GetInterface(main_channel_, |
| 147 const_cast<char*>(interface_name), | 149 const_cast<char*>(interface_name), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 190 |
| 189 const void* BrowserPpp::GetPluginInterfaceSafe(const char* interface_name) { | 191 const void* BrowserPpp::GetPluginInterfaceSafe(const char* interface_name) { |
| 190 const void* ppp_interface = GetPluginInterface(interface_name); | 192 const void* ppp_interface = GetPluginInterface(interface_name); |
| 191 if (ppp_interface == NULL) | 193 if (ppp_interface == NULL) |
| 192 DebugPrintf("PPB_GetInterface: %s not found\n", interface_name); | 194 DebugPrintf("PPB_GetInterface: %s not found\n", interface_name); |
| 193 CHECK(ppp_interface != NULL); | 195 CHECK(ppp_interface != NULL); |
| 194 return ppp_interface; | 196 return ppp_interface; |
| 195 } | 197 } |
| 196 | 198 |
| 197 } // namespace ppapi_proxy | 199 } // namespace ppapi_proxy |
| OLD | NEW |