OLD | NEW |
1 // Copyright (c) 2010 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <stdarg.h> | 5 #include <stdarg.h> |
6 | 6 |
7 #include "native_client/src/include/portability.h" | 7 #include "native_client/src/include/portability.h" |
8 #include "native_client/src/include/portability_process.h" | 8 #include "native_client/src/include/portability_process.h" |
9 #include "gen/native_client/src/shared/ppapi_proxy/ppp_rpc.h" | 9 #include "gen/native_client/src/shared/ppapi_proxy/ppp_rpc.h" |
10 #include "native_client/src/shared/ppapi_proxy/plugin_getinterface.h" | 10 #include "native_client/src/shared/ppapi_proxy/plugin_getinterface.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 channel)) { | 98 channel)) { |
99 DebugPrintf(" Failed to export service on main channel\n"); | 99 DebugPrintf(" Failed to export service on main channel\n"); |
100 return NACL_SRPC_RESULT_APP_ERROR; | 100 return NACL_SRPC_RESULT_APP_ERROR; |
101 } | 101 } |
102 // Set up the upcall channel for calling back into the browser. | 102 // Set up the upcall channel for calling back into the browser. |
103 if (!StartUpcallSrpcChannel(upcall_channel_desc)) { | 103 if (!StartUpcallSrpcChannel(upcall_channel_desc)) { |
104 DebugPrintf(" Failed to construct upcall channel\n"); | 104 DebugPrintf(" Failed to construct upcall channel\n"); |
105 StopMainSrpcChannel(); | 105 StopMainSrpcChannel(); |
106 return NACL_SRPC_RESULT_APP_ERROR; | 106 return NACL_SRPC_RESULT_APP_ERROR; |
107 } | 107 } |
| 108 ppapi_proxy::SetModuleIdForSrpcChannel(channel, module); |
108 *success = ::PPP_InitializeModule(module, ppapi_proxy::GetInterfaceProxy); | 109 *success = ::PPP_InitializeModule(module, ppapi_proxy::GetInterfaceProxy); |
109 *nacl_pid = GETPID(); | 110 *nacl_pid = GETPID(); |
110 return NACL_SRPC_RESULT_OK; | 111 return NACL_SRPC_RESULT_OK; |
111 } | 112 } |
112 | 113 |
113 NaClSrpcError PppRpcServer::PPP_ShutdownModule(NaClSrpcChannel* channel) { | 114 NaClSrpcError PppRpcServer::PPP_ShutdownModule(NaClSrpcChannel* channel) { |
114 DebugPrintf("PPP_ShutdownModule\n"); | 115 DebugPrintf("PPP_ShutdownModule\n"); |
115 ::PPP_ShutdownModule(); | 116 ::PPP_ShutdownModule(); |
| 117 ppapi_proxy::UnsetModuleIdForSrpcChannel(channel); |
116 // Clean up the upcall channel. | 118 // Clean up the upcall channel. |
117 StopUpcallSrpcChannel(); | 119 StopUpcallSrpcChannel(); |
118 // Clean up the main channel. | 120 // Clean up the main channel. |
119 StopMainSrpcChannel(); | 121 StopMainSrpcChannel(); |
120 return NACL_SRPC_RESULT_OK; | 122 return NACL_SRPC_RESULT_OK; |
121 } | 123 } |
122 | 124 |
123 NaClSrpcError PppRpcServer::PPP_GetInterface(NaClSrpcChannel* channel, | 125 NaClSrpcError PppRpcServer::PPP_GetInterface(NaClSrpcChannel* channel, |
124 char* interface_name, | 126 char* interface_name, |
125 int32_t* exports_interface_name) { | 127 int32_t* exports_interface_name) { |
126 DebugPrintf("PPP_GetInterface(%s)\n", interface_name); | 128 DebugPrintf("PPP_GetInterface(%s)\n", interface_name); |
127 // Since the proxy will make calls to proxied interfaces, we need simply | 129 // Since the proxy will make calls to proxied interfaces, we need simply |
128 // to know whether the plugin exports a given interface. | 130 // to know whether the plugin exports a given interface. |
129 const void* plugin_interface = ::PPP_GetInterface(interface_name); | 131 const void* plugin_interface = ::PPP_GetInterface(interface_name); |
130 *exports_interface_name = (plugin_interface != NULL); | 132 *exports_interface_name = (plugin_interface != NULL); |
131 return NACL_SRPC_RESULT_OK; | 133 return NACL_SRPC_RESULT_OK; |
132 } | 134 } |
OLD | NEW |