| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 // SRPC-abstraction wrappers around PPP functions. | 5 // SRPC-abstraction wrappers around PPP functions. |
| 6 | 6 |
| 7 #include <stdarg.h> | 7 #include <stdarg.h> |
| 8 | 8 |
| 9 #include "native_client/src/include/portability.h" | 9 #include "native_client/src/include/portability.h" |
| 10 #include "native_client/src/include/portability_process.h" | 10 #include "native_client/src/include/portability_process.h" |
| 11 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" | 11 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // | 88 // |
| 89 // The following methods are the SRPC dispatchers for ppapi/c/ppp.h. | 89 // The following methods are the SRPC dispatchers for ppapi/c/ppp.h. |
| 90 // | 90 // |
| 91 | 91 |
| 92 void PppRpcServer::PPP_InitializeModule( | 92 void PppRpcServer::PPP_InitializeModule( |
| 93 NaClSrpcRpc* rpc, | 93 NaClSrpcRpc* rpc, |
| 94 NaClSrpcClosure* done, | 94 NaClSrpcClosure* done, |
| 95 int32_t pid, | 95 int32_t pid, |
| 96 PP_Module module, | 96 PP_Module module, |
| 97 NaClSrpcImcDescType upcall_channel_desc, | 97 NaClSrpcImcDescType upcall_channel_desc, |
| 98 char* service_description, | 98 const char* service_description, |
| 99 int32_t* nacl_pid, | 99 int32_t* nacl_pid, |
| 100 int32_t* success) { | 100 int32_t* success) { |
| 101 NaClSrpcClosureRunner runner(done); | 101 NaClSrpcClosureRunner runner(done); |
| 102 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | 102 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
| 103 DebugPrintf("PPP_InitializeModule: module=%"NACL_PRIu32": %s\n", | 103 DebugPrintf("PPP_InitializeModule: module=%"NACL_PRIu32": %s\n", |
| 104 module, service_description); | 104 module, service_description); |
| 105 // Set up the service for calling back into the browser. | 105 // Set up the service for calling back into the browser. |
| 106 if (!StartMainSrpcChannel(const_cast<const char*>(service_description), | 106 if (!StartMainSrpcChannel(const_cast<const char*>(service_description), |
| 107 rpc->channel)) { | 107 rpc->channel)) { |
| 108 DebugPrintf("PPP_InitializeModule: " | 108 DebugPrintf("PPP_InitializeModule: " |
| (...skipping 25 matching lines...) Expand all Loading... |
| 134 // TODO(sehr, polina): do we even need this function? | 134 // TODO(sehr, polina): do we even need this function? |
| 135 // Shouldn't the Dtor be called when nexe's main exits? | 135 // Shouldn't the Dtor be called when nexe's main exits? |
| 136 //StopMainSrpcChannel(); | 136 //StopMainSrpcChannel(); |
| 137 // Exit the srpc loop. The server won't answer any more requests. | 137 // Exit the srpc loop. The server won't answer any more requests. |
| 138 rpc->result = NACL_SRPC_RESULT_BREAK; | 138 rpc->result = NACL_SRPC_RESULT_BREAK; |
| 139 DebugPrintf("PPP_ShutdownModule: %s\n", NaClSrpcErrorString(rpc->result)); | 139 DebugPrintf("PPP_ShutdownModule: %s\n", NaClSrpcErrorString(rpc->result)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void PppRpcServer::PPP_GetInterface(NaClSrpcRpc* rpc, | 142 void PppRpcServer::PPP_GetInterface(NaClSrpcRpc* rpc, |
| 143 NaClSrpcClosure* done, | 143 NaClSrpcClosure* done, |
| 144 char* interface_name, | 144 const char* interface_name, |
| 145 int32_t* exports_interface_name) { | 145 int32_t* exports_interface_name) { |
| 146 NaClSrpcClosureRunner runner(done); | 146 NaClSrpcClosureRunner runner(done); |
| 147 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | 147 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
| 148 DebugPrintf("PPP_GetInterface('%s')\n", interface_name); | 148 DebugPrintf("PPP_GetInterface('%s')\n", interface_name); |
| 149 // Since the proxy will make calls to proxied interfaces, we need simply | 149 // Since the proxy will make calls to proxied interfaces, we need simply |
| 150 // to know whether the plugin exports a given interface. | 150 // to know whether the plugin exports a given interface. |
| 151 const void* plugin_interface = ::PPP_GetInterface(interface_name); | 151 const void* plugin_interface = ::PPP_GetInterface(interface_name); |
| 152 *exports_interface_name = (plugin_interface != NULL); | 152 *exports_interface_name = (plugin_interface != NULL); |
| 153 rpc->result = NACL_SRPC_RESULT_OK; | 153 rpc->result = NACL_SRPC_RESULT_OK; |
| 154 } | 154 } |
| OLD | NEW |