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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc

Issue 23946004: PNaCl Coordinator: Run StreamEnd RPC even if StreamChunk fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « chrome/test/data/nacl/pnacl_error_handling/pnacl_error_handling.html ('k') | no next file » | 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) 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 #include "ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h" 5 #include "ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h"
6 6
7 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" 7 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
8 #include "ppapi/native_client/src/trusted/plugin/plugin.h" 8 #include "ppapi/native_client/src/trusted/plugin/plugin.h"
9 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" 9 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h"
10 #include "ppapi/native_client/src/trusted/plugin/pnacl_resources.h" 10 #include "ppapi/native_client/src/trusted/plugin/pnacl_resources.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 std::vector<char> data; 193 std::vector<char> data;
194 data.swap(data_buffers_.front()); 194 data.swap(data_buffers_.front());
195 data_buffers_.pop_front(); 195 data_buffers_.pop_front();
196 NaClXMutexUnlock(&cond_mu_); 196 NaClXMutexUnlock(&cond_mu_);
197 PLUGIN_PRINTF(("StreamChunk\n")); 197 PLUGIN_PRINTF(("StreamChunk\n"));
198 if (!llc_subprocess_->InvokeSrpcMethod("StreamChunk", 198 if (!llc_subprocess_->InvokeSrpcMethod("StreamChunk",
199 "C", 199 "C",
200 &params, 200 &params,
201 &data[0], 201 &data[0],
202 data.size())) { 202 data.size())) {
203 TranslateFailed(ERROR_PNACL_LLC_INTERNAL, 203 if (llc_subprocess_->srpc_client()->GetLastError() !=
204 "Compile stream chunk failed."); 204 NACL_SRPC_RESULT_APP_ERROR) {
205 return; 205 // If the error was reported by the translator, then we fall through
206 // and call StreamEnd, which returns a string describing the error,
207 // which we can then send to the Javascript console. Otherwise just
208 // fail here, since the translator has probably crashed or asserted.
209 TranslateFailed(ERROR_PNACL_LLC_INTERNAL,
210 "Compile stream chunk failed. "
211 "The PNaCl translator has probably crashed.");
212 return;
213 }
214 break;
215 } else {
216 PLUGIN_PRINTF(("StreamChunk Successful\n"));
217 core->CallOnMainThread(
218 0,
219 coordinator_->GetCompileProgressCallback(data.size()),
220 PP_OK);
206 } 221 }
207 PLUGIN_PRINTF(("StreamChunk Successful\n"));
208 core->CallOnMainThread(
209 0,
210 coordinator_->GetCompileProgressCallback(data.size()),
211 PP_OK);
212 } else { 222 } else {
213 NaClXMutexUnlock(&cond_mu_); 223 NaClXMutexUnlock(&cond_mu_);
214 } 224 }
215 } 225 }
216 PLUGIN_PRINTF(("PnaclTranslateThread done with chunks\n")); 226 PLUGIN_PRINTF(("PnaclTranslateThread done with chunks\n"));
217 // Finish llc. 227 // Finish llc.
218 if (!llc_subprocess_->InvokeSrpcMethod("StreamEnd", std::string(), &params)) { 228 if (!llc_subprocess_->InvokeSrpcMethod("StreamEnd", std::string(), &params)) {
219 PLUGIN_PRINTF(("PnaclTranslateThread StreamEnd failed\n")); 229 PLUGIN_PRINTF(("PnaclTranslateThread StreamEnd failed\n"));
220 if (llc_subprocess_->srpc_client()->GetLastError() == 230 if (llc_subprocess_->srpc_client()->GetLastError() ==
221 NACL_SRPC_RESULT_APP_ERROR) { 231 NACL_SRPC_RESULT_APP_ERROR) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 AbortSubprocesses(); 363 AbortSubprocesses();
354 if (translate_thread_ != NULL) 364 if (translate_thread_ != NULL)
355 NaClThreadJoin(translate_thread_.get()); 365 NaClThreadJoin(translate_thread_.get());
356 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); 366 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n"));
357 NaClCondVarDtor(&buffer_cond_); 367 NaClCondVarDtor(&buffer_cond_);
358 NaClMutexDtor(&cond_mu_); 368 NaClMutexDtor(&cond_mu_);
359 NaClMutexDtor(&subprocess_mu_); 369 NaClMutexDtor(&subprocess_mu_);
360 } 370 }
361 371
362 } // namespace plugin 372 } // namespace plugin
OLDNEW
« no previous file with comments | « chrome/test/data/nacl/pnacl_error_handling/pnacl_error_handling.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698