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

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_rpc_server.cc

Issue 9015040: NaCl: Remove getpid() calls from the PPAPI proxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copyright Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 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"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 } // namespace 86 } // namespace
87 87
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,
96 PP_Module module, 95 PP_Module module,
97 NaClSrpcImcDescType upcall_channel_desc, 96 NaClSrpcImcDescType upcall_channel_desc,
98 const char* service_description, 97 const char* service_description,
99 int32_t* nacl_pid,
100 int32_t* success) { 98 int32_t* success) {
101 NaClSrpcClosureRunner runner(done); 99 NaClSrpcClosureRunner runner(done);
102 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 100 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
103 DebugPrintf("PPP_InitializeModule: module=%"NACL_PRIu32": %s\n", 101 DebugPrintf("PPP_InitializeModule: module=%"NACL_PRIu32": %s\n",
104 module, service_description); 102 module, service_description);
105 // Set up the service for calling back into the browser. 103 // Set up the service for calling back into the browser.
106 if (!StartMainSrpcChannel(const_cast<const char*>(service_description), 104 if (!StartMainSrpcChannel(const_cast<const char*>(service_description),
107 rpc->channel)) { 105 rpc->channel)) {
108 DebugPrintf("PPP_InitializeModule: " 106 DebugPrintf("PPP_InitializeModule: "
109 "failed to export service on main channel\n"); 107 "failed to export service on main channel\n");
110 return; 108 return;
111 } 109 }
112 // Set up the upcall channel for calling back into the browser. 110 // Set up the upcall channel for calling back into the browser.
113 if (!StartUpcallSrpcChannel(upcall_channel_desc)) { 111 if (!StartUpcallSrpcChannel(upcall_channel_desc)) {
114 DebugPrintf("PPP_InitializeModule: " 112 DebugPrintf("PPP_InitializeModule: "
115 "failed to construct upcall channel\n"); 113 "failed to construct upcall channel\n");
116 StopMainSrpcChannel(); 114 StopMainSrpcChannel();
117 return; 115 return;
118 } 116 }
119 ppapi_proxy::SetModuleIdForSrpcChannel(rpc->channel, module); 117 ppapi_proxy::SetModuleIdForSrpcChannel(rpc->channel, module);
120 *success = ::PPP_InitializeModule(module, ppapi_proxy::GetBrowserInterface); 118 *success = ::PPP_InitializeModule(module, ppapi_proxy::GetBrowserInterface);
121 *nacl_pid = GETPID();
122 rpc->result = NACL_SRPC_RESULT_OK; 119 rpc->result = NACL_SRPC_RESULT_OK;
123 } 120 }
124 121
125 void PppRpcServer::PPP_ShutdownModule(NaClSrpcRpc* rpc, 122 void PppRpcServer::PPP_ShutdownModule(NaClSrpcRpc* rpc,
126 NaClSrpcClosure* done) { 123 NaClSrpcClosure* done) {
127 NaClSrpcClosureRunner runner(done); 124 NaClSrpcClosureRunner runner(done);
128 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 125 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
129 DebugPrintf("PPP_ShutdownModule\n"); 126 DebugPrintf("PPP_ShutdownModule\n");
130 // We do NOT call ::PPP_ShutdownModule as it cannot do anything useful 127 // We do NOT call ::PPP_ShutdownModule as it cannot do anything useful
131 // at this point while still having an ability to hang the browser. 128 // at this point while still having an ability to hang the browser.
(...skipping 13 matching lines...) Expand all
145 int32_t* exports_interface_name) { 142 int32_t* exports_interface_name) {
146 NaClSrpcClosureRunner runner(done); 143 NaClSrpcClosureRunner runner(done);
147 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 144 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
148 DebugPrintf("PPP_GetInterface('%s')\n", interface_name); 145 DebugPrintf("PPP_GetInterface('%s')\n", interface_name);
149 // Since the proxy will make calls to proxied interfaces, we need simply 146 // Since the proxy will make calls to proxied interfaces, we need simply
150 // to know whether the plugin exports a given interface. 147 // to know whether the plugin exports a given interface.
151 const void* plugin_interface = ::PPP_GetInterface(interface_name); 148 const void* plugin_interface = ::PPP_GetInterface(interface_name);
152 *exports_interface_name = (plugin_interface != NULL); 149 *exports_interface_name = (plugin_interface != NULL);
153 rpc->result = NACL_SRPC_RESULT_OK; 150 rpc->result = NACL_SRPC_RESULT_OK;
154 } 151 }
OLDNEW
« no previous file with comments | « ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc ('k') | ppapi/native_client/src/shared/ppapi_proxy/ppp.srpc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698