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

Side by Side Diff: src/shared/ppapi_proxy/plugin_ppp_impl.cc

Issue 5631003: ppapi_proxy: Make DebugPrintf more usable.... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 10 years 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
« no previous file with comments | « src/shared/ppapi_proxy/plugin_instance.cc ('k') | src/shared/ppapi_proxy/plugin_var.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "srpcgen/ppp_rpc.h" 9 #include "srpcgen/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 NaClSrpcServiceDtor(service); 43 NaClSrpcServiceDtor(service);
44 channel->client = NULL; 44 channel->client = NULL;
45 ppapi_proxy::SetMainSrpcChannel(NULL); 45 ppapi_proxy::SetMainSrpcChannel(NULL);
46 } 46 }
47 47
48 // The plugin will make asynchronous calls to the browser on other threads. 48 // The plugin will make asynchronous calls to the browser on other threads.
49 // The service exported on this channel will be gotten by service discovery. 49 // The service exported on this channel will be gotten by service discovery.
50 bool StartUpcallSrpcChannel(NaClSrpcImcDescType upcall_channel_desc) { 50 bool StartUpcallSrpcChannel(NaClSrpcImcDescType upcall_channel_desc) {
51 // Create the upcall srpc client. 51 // Create the upcall srpc client.
52 if (upcall_channel_desc == -1) { 52 if (upcall_channel_desc == -1) {
53 DebugPrintf(" Bad upcall_channel_desc\n");
54 return false; 53 return false;
55 } 54 }
56 NaClSrpcChannel* upcall_channel = reinterpret_cast<NaClSrpcChannel*>( 55 NaClSrpcChannel* upcall_channel = reinterpret_cast<NaClSrpcChannel*>(
57 calloc(1, sizeof(*upcall_channel))); 56 calloc(1, sizeof(*upcall_channel)));
58 if (NULL == upcall_channel) { 57 if (NULL == upcall_channel) {
59 return false; 58 return false;
60 } 59 }
61 if (!NaClSrpcClientCtor(upcall_channel, upcall_channel_desc)) { 60 if (!NaClSrpcClientCtor(upcall_channel, upcall_channel_desc)) {
62 free(upcall_channel); 61 free(upcall_channel);
63 return false; 62 return false;
(...skipping 18 matching lines...) Expand all
82 NaClSrpcRpc* rpc, 81 NaClSrpcRpc* rpc,
83 NaClSrpcClosure* done, 82 NaClSrpcClosure* done,
84 int32_t pid, 83 int32_t pid,
85 int64_t module, 84 int64_t module,
86 NaClSrpcImcDescType upcall_channel_desc, 85 NaClSrpcImcDescType upcall_channel_desc,
87 char* service_description, 86 char* service_description,
88 int32_t* nacl_pid, 87 int32_t* nacl_pid,
89 int32_t* success) { 88 int32_t* success) {
90 NaClSrpcClosureRunner runner(done); 89 NaClSrpcClosureRunner runner(done);
91 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 90 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
92 DebugPrintf("PPP_InitializeModule: %s\n", service_description); 91 DebugPrintf("Plugin::PPP_InitializeModule: %s\n", service_description);
93 // Set up the service for calling back into the browser. 92 // Set up the service for calling back into the browser.
94 if (!StartMainSrpcChannel(const_cast<const char*>(service_description), 93 if (!StartMainSrpcChannel(const_cast<const char*>(service_description),
95 rpc->channel)) { 94 rpc->channel)) {
96 DebugPrintf(" Failed to export service on main channel\n"); 95 DebugPrintf("Plugin::PPP_InitializeModule: "
96 "failed to export service on main channel\n");
97 return; 97 return;
98 } 98 }
99 // Set up the upcall channel for calling back into the browser. 99 // Set up the upcall channel for calling back into the browser.
100 if (!StartUpcallSrpcChannel(upcall_channel_desc)) { 100 if (!StartUpcallSrpcChannel(upcall_channel_desc)) {
101 DebugPrintf(" Failed to construct upcall channel\n"); 101 DebugPrintf("Plugin::PPP_InitializeModule: "
102 "failed to construct upcall channel\n");
102 StopMainSrpcChannel(); 103 StopMainSrpcChannel();
103 return; 104 return;
104 } 105 }
105 ppapi_proxy::SetModuleIdForSrpcChannel(rpc->channel, module); 106 ppapi_proxy::SetModuleIdForSrpcChannel(rpc->channel, module);
106 *success = ::PPP_InitializeModule(module, ppapi_proxy::GetInterfaceProxy); 107 *success = ::PPP_InitializeModule(module, ppapi_proxy::GetInterfaceProxy);
107 *nacl_pid = GETPID(); 108 *nacl_pid = GETPID();
108 rpc->result = NACL_SRPC_RESULT_OK; 109 rpc->result = NACL_SRPC_RESULT_OK;
109 } 110 }
110 111
111 void PppRpcServer::PPP_ShutdownModule(NaClSrpcRpc* rpc, 112 void PppRpcServer::PPP_ShutdownModule(NaClSrpcRpc* rpc,
112 NaClSrpcClosure* done) { 113 NaClSrpcClosure* done) {
113 NaClSrpcClosureRunner runner(done); 114 NaClSrpcClosureRunner runner(done);
114 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 115 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
115 DebugPrintf("PPP_ShutdownModule\n"); 116 DebugPrintf("Plugin::PPP_ShutdownModule\n");
116 ::PPP_ShutdownModule(); 117 ::PPP_ShutdownModule();
117 ppapi_proxy::UnsetModuleIdForSrpcChannel(rpc->channel); 118 ppapi_proxy::UnsetModuleIdForSrpcChannel(rpc->channel);
118 StopUpcallSrpcChannel(); 119 StopUpcallSrpcChannel();
119 StopMainSrpcChannel(); 120 StopMainSrpcChannel();
120 rpc->result = NACL_SRPC_RESULT_OK; 121 rpc->result = NACL_SRPC_RESULT_OK;
121 } 122 }
122 123
123 void PppRpcServer::PPP_GetInterface(NaClSrpcRpc* rpc, 124 void PppRpcServer::PPP_GetInterface(NaClSrpcRpc* rpc,
124 NaClSrpcClosure* done, 125 NaClSrpcClosure* done,
125 char* interface_name, 126 char* interface_name,
126 int32_t* exports_interface_name) { 127 int32_t* exports_interface_name) {
127 NaClSrpcClosureRunner runner(done); 128 NaClSrpcClosureRunner runner(done);
128 rpc->result = NACL_SRPC_RESULT_APP_ERROR; 129 rpc->result = NACL_SRPC_RESULT_APP_ERROR;
129 DebugPrintf("PPP_GetInterface(%s)\n", interface_name); 130 DebugPrintf("Plugin::PPP_GetInterface(%s)\n", interface_name);
130 // Since the proxy will make calls to proxied interfaces, we need simply 131 // Since the proxy will make calls to proxied interfaces, we need simply
131 // to know whether the plugin exports a given interface. 132 // to know whether the plugin exports a given interface.
132 const void* plugin_interface = ::PPP_GetInterface(interface_name); 133 const void* plugin_interface = ::PPP_GetInterface(interface_name);
133 *exports_interface_name = (plugin_interface != NULL); 134 *exports_interface_name = (plugin_interface != NULL);
134 rpc->result = NACL_SRPC_RESULT_OK; 135 rpc->result = NACL_SRPC_RESULT_OK;
135 } 136 }
OLDNEW
« no previous file with comments | « src/shared/ppapi_proxy/plugin_instance.cc ('k') | src/shared/ppapi_proxy/plugin_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698