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

Side by Side Diff: src/trusted/nonnacl_util/sel_ldr_launcher_base.cc

Issue 1085093002: Remove a couple of unused methods from sel_ldr_launcher_base. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" 7 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
8 8
9 #include "native_client/src/include/nacl_macros.h" 9 #include "native_client/src/include/nacl_macros.h"
10 #include "native_client/src/public/secure_service.h" 10 #include "native_client/src/public/secure_service.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (NACL_SRPC_RESULT_OK != rpc_result) { 120 if (NACL_SRPC_RESULT_OK != rpc_result) {
121 NaClLog(LOG_ERROR, "SelLdrLauncherBase::LoadModule: " 121 NaClLog(LOG_ERROR, "SelLdrLauncherBase::LoadModule: "
122 "rpc_result=%d is not successful\n", 122 "rpc_result=%d is not successful\n",
123 static_cast<int>(rpc_result)); 123 static_cast<int>(rpc_result));
124 NaClSrpcDtor(command); 124 NaClSrpcDtor(command);
125 return false; 125 return false;
126 } 126 }
127 return true; 127 return true;
128 } 128 }
129 129
130 bool SelLdrLauncherBase::SetupCommandAndLoad(NaClSrpcChannel* command,
131 DescWrapper* nexe) {
132 if (!SetupCommand(command)) {
133 return false;
134 }
135 if (nexe != NULL) {
136 if (!LoadModule(command, nexe)) {
137 return false;
138 }
139 }
140 return true;
141 }
142
143 bool SelLdrLauncherBase::StartModule(NaClSrpcChannel* command) { 130 bool SelLdrLauncherBase::StartModule(NaClSrpcChannel* command) {
144 // Start untrusted code module. 131 // Start untrusted code module.
145 int start_result; 132 int start_result;
146 NaClSrpcResultCodes rpc_result = NaClSrpcInvokeBySignature( 133 NaClSrpcResultCodes rpc_result = NaClSrpcInvokeBySignature(
147 command, 134 command,
148 NACL_SECURE_SERVICE_START_MODULE, 135 NACL_SECURE_SERVICE_START_MODULE,
149 &start_result); 136 &start_result);
150 NaClLog(4, "SelLdrLauncher::StartModule rpc result %d\n", 137 NaClLog(4, "SelLdrLauncherBase::StartModule rpc result %d\n",
151 static_cast<int>(rpc_result)); 138 static_cast<int>(rpc_result));
152 if (NACL_SRPC_RESULT_OK != rpc_result || LOAD_OK != start_result) { 139 if (NACL_SRPC_RESULT_OK != rpc_result || LOAD_OK != start_result) {
153 NaClSrpcDtor(command); 140 NaClSrpcDtor(command);
154 NaClLog(LOG_ERROR, "SelLdrLauncherBase::StartModule: " 141 NaClLog(LOG_ERROR, "SelLdrLauncherBase::StartModule: "
155 "start_module failed: rpc_result=%d, start_result=%d (%s)\n", 142 "start_module failed: rpc_result=%d, start_result=%d (%s)\n",
156 static_cast<int>(rpc_result), start_result, 143 static_cast<int>(rpc_result), start_result,
157 NaClErrorString(static_cast<NaClErrorCode>(start_result))); 144 NaClErrorString(static_cast<NaClErrorCode>(start_result)));
158 return false; 145 return false;
159 } 146 }
160 return true; 147 return true;
161 } 148 }
162 149
163 bool SelLdrLauncherBase::SetupAppChannel(NaClSrpcChannel* out_app_chan) { 150 bool SelLdrLauncherBase::SetupAppChannel(NaClSrpcChannel* out_app_chan) {
164 // Connect to the untrusted service itself. 151 // Connect to the untrusted service itself.
165 scoped_ptr<DescWrapper> untrusted_desc(socket_addr_->Connect()); 152 scoped_ptr<DescWrapper> untrusted_desc(socket_addr_->Connect());
166 if (untrusted_desc == NULL) { 153 if (untrusted_desc == NULL) {
167 NaClLog(LOG_ERROR, "SelLdrLauncher::StartModuleAndSetupAppChannel: " 154 NaClLog(LOG_ERROR, "SelLdrLauncherBase::SetupAppChannel: "
168 "Connect failed\n"); 155 "Connect failed\n");
169 return false; 156 return false;
170 } 157 }
171 // Start the SRPC client to communicate with the untrusted service 158 // Start the SRPC client to communicate with the untrusted service
172 // SRPC client takes an additional reference to untrusted_desc. 159 // SRPC client takes an additional reference to untrusted_desc.
173 if (!NaClSrpcClientCtor(out_app_chan, untrusted_desc->desc())) { 160 if (!NaClSrpcClientCtor(out_app_chan, untrusted_desc->desc())) {
174 NaClLog(LOG_ERROR, "SelLdrLauncherBase::SetupAppChannel: " 161 NaClLog(LOG_ERROR, "SelLdrLauncherBase::SetupAppChannel: "
175 "NaClSrpcClientCtor failed\n"); 162 "NaClSrpcClientCtor failed\n");
176 return false; 163 return false;
177 } 164 }
178 return true; 165 return true;
179 } 166 }
180 167
181 // Sends the SRPC to start the nexe over |command| and sets up the application
182 // SRPC chanel |out_app_chan|.
183 bool SelLdrLauncherBase::StartModuleAndSetupAppChannel(
184 NaClSrpcChannel* command,
185 NaClSrpcChannel* out_app_chan) {
186 if (!StartModule(command)) {
187 return false;
188 }
189 if (!SetupAppChannel(out_app_chan)) {
190 return false;
191 }
192 return true;
193 }
194
195 DescWrapper* SelLdrLauncherBase::Wrap(NaClDesc* raw_desc) {
196 CHECK(factory_ != NULL);
197 return factory_->MakeGeneric(raw_desc);
198 }
199
200 DescWrapper* SelLdrLauncherBase::WrapCleanup(NaClDesc* raw_desc) {
201 CHECK(factory_ != NULL);
202 return factory_->MakeGenericCleanup(raw_desc);
203 }
204
205 } // namespace nacl 168 } // namespace nacl
OLDNEW
« no previous file with comments | « src/trusted/nonnacl_util/sel_ldr_launcher.h ('k') | tests/sel_main_chrome/sel_main_chrome_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698