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

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

Issue 17336002: Make the PNaCl is not-yet-installed error messages easier to read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new use of report Created 7 years, 6 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 | « no previous file | 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 "native_client/src/trusted/plugin/pnacl_coordinator.h" 5 #include "native_client/src/trusted/plugin/pnacl_coordinator.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "native_client/src/include/checked_cast.h" 10 #include "native_client/src/include/checked_cast.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // running from the main thread, and by the time it exits, callback_factory_ 295 // running from the main thread, and by the time it exits, callback_factory_
296 // will have been destroyed. This will result in the cancellation of 296 // will have been destroyed. This will result in the cancellation of
297 // translation_complete_callback_, so no notification will be delivered. 297 // translation_complete_callback_, so no notification will be delivered.
298 if (translate_thread_.get() != NULL) { 298 if (translate_thread_.get() != NULL) {
299 translate_thread_->AbortSubprocesses(); 299 translate_thread_->AbortSubprocesses();
300 } 300 }
301 } 301 }
302 302
303 void PnaclCoordinator::ReportNonPpapiError(enum PluginErrorCode err_code, 303 void PnaclCoordinator::ReportNonPpapiError(enum PluginErrorCode err_code,
304 const nacl::string& message) { 304 const nacl::string& message) {
305 error_info_.SetReport(err_code, 305 error_info_.SetReport(err_code, message);
306 nacl::string("PnaclCoordinator: ") + message);
307 ExitWithError(); 306 ExitWithError();
308 } 307 }
309 308
310 void PnaclCoordinator::ReportPpapiError(enum PluginErrorCode err_code, 309 void PnaclCoordinator::ReportPpapiError(enum PluginErrorCode err_code,
311 int32_t pp_error, 310 int32_t pp_error,
312 const nacl::string& message) { 311 const nacl::string& message) {
313 nacl::stringstream ss; 312 nacl::stringstream ss;
314 ss << "PnaclCoordinator: " << message << " (pp_error=" << pp_error << ")."; 313 ss << "PnaclCoordinator: " << message << " (pp_error=" << pp_error << ").";
315 error_info_.SetReport(err_code, ss.str()); 314 error_info_.SetReport(err_code, ss.str());
316 ExitWithError(); 315 ExitWithError();
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 // Now open the pexe stream. 771 // Now open the pexe stream.
773 streaming_downloader_.reset(new FileDownloader()); 772 streaming_downloader_.reset(new FileDownloader());
774 streaming_downloader_->Initialize(plugin_); 773 streaming_downloader_->Initialize(plugin_);
775 774
776 // Even though we haven't started downloading, create the translation 775 // Even though we haven't started downloading, create the translation
777 // thread object immediately. This ensures that any pieces of the file 776 // thread object immediately. This ensures that any pieces of the file
778 // that get downloaded before the compilation thread is accepting 777 // that get downloaded before the compilation thread is accepting
779 // SRPCs won't get dropped. 778 // SRPCs won't get dropped.
780 translate_thread_.reset(new PnaclTranslateThread()); 779 translate_thread_.reset(new PnaclTranslateThread());
781 if (translate_thread_ == NULL) { 780 if (translate_thread_ == NULL) {
782 ReportNonPpapiError(ERROR_PNACL_THREAD_CREATE, 781 ReportNonPpapiError(
783 "could not allocate translation thread."); 782 ERROR_PNACL_THREAD_CREATE,
783 "PnaclCoordinator: could not allocate translation thread.");
784 return; 784 return;
785 } 785 }
786 if (!use_new_cache_) { 786 if (!use_new_cache_) {
787 // We also want to open the object file now so the 787 // We also want to open the object file now so the
788 // translator can start writing to it during streaming translation. 788 // translator can start writing to it during streaming translation.
789 obj_file_.reset(new TempFile(plugin_)); 789 obj_file_.reset(new TempFile(plugin_));
790 pp::CompletionCallback obj_cb = 790 pp::CompletionCallback obj_cb =
791 callback_factory_.NewCallback(&PnaclCoordinator::ObjectFileDidOpen); 791 callback_factory_.NewCallback(&PnaclCoordinator::ObjectFileDidOpen);
792 obj_file_->Open(obj_cb, true); 792 obj_file_->Open(obj_cb, true);
793 } 793 }
794 794
795 pp::CompletionCallback cb = 795 pp::CompletionCallback cb =
796 callback_factory_.NewCallback(&PnaclCoordinator::BitcodeStreamDidOpen); 796 callback_factory_.NewCallback(&PnaclCoordinator::BitcodeStreamDidOpen);
797 if (!streaming_downloader_->OpenStream(pexe_url_, cb, this)) { 797 if (!streaming_downloader_->OpenStream(pexe_url_, cb, this)) {
798 ReportNonPpapiError(ERROR_PNACL_PEXE_FETCH_OTHER, 798 ReportNonPpapiError(
799 nacl::string("failed to open stream ") + pexe_url_); 799 ERROR_PNACL_PEXE_FETCH_OTHER,
800 nacl::string("PnaclCoordinator: failed to open stream ") + pexe_url_);
801 return;
800 } 802 }
801 } 803 }
802 804
803 void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) { 805 void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) {
804 if (pp_error != PP_OK) { 806 if (pp_error != PP_OK) {
805 BitcodeStreamDidFinish(pp_error); 807 BitcodeStreamDidFinish(pp_error);
806 return; 808 return;
807 } 809 }
808 810
809 if (!off_the_record_) { 811 if (!off_the_record_) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 nexe_handle_)); 865 nexe_handle_));
864 if (pp_error < PP_OK) { 866 if (pp_error < PP_OK) {
865 ReportPpapiError(ERROR_PNACL_CREATE_TEMP, pp_error, 867 ReportPpapiError(ERROR_PNACL_CREATE_TEMP, pp_error,
866 nacl::string("GetNexeFd failed")); 868 nacl::string("GetNexeFd failed"));
867 return; 869 return;
868 } 870 }
869 temp_nexe_file_.reset(new TempFile(plugin_)); 871 temp_nexe_file_.reset(new TempFile(plugin_));
870 if (!temp_nexe_file_->SetExistingFd(nexe_handle_)) { 872 if (!temp_nexe_file_->SetExistingFd(nexe_handle_)) {
871 ReportNonPpapiError( 873 ReportNonPpapiError(
872 ERROR_PNACL_CREATE_TEMP, 874 ERROR_PNACL_CREATE_TEMP,
873 nacl::string("Got bad temp file handle from GetNexeFd")); 875 nacl::string(
876 "PnaclCoordinator: Got bad temp file handle from GetNexeFd"));
874 return; 877 return;
875 } 878 }
876 if (is_cache_hit_ == PP_TRUE) { 879 if (is_cache_hit_ == PP_TRUE) {
877 // Cache hit -- no need to stream the rest of the file. 880 // Cache hit -- no need to stream the rest of the file.
878 streaming_downloader_.reset(NULL); 881 streaming_downloader_.reset(NULL);
879 // TODO(dschuff): update UMA stats for hit/miss once there could actually 882 // TODO(dschuff): update UMA stats for hit/miss once there could actually
880 // be hits/misses. 883 // be hits/misses.
881 // Open it for reading as the cached nexe file. 884 // Open it for reading as the cached nexe file.
882 pp::CompletionCallback cb = 885 pp::CompletionCallback cb =
883 callback_factory_.NewCallback(&PnaclCoordinator::NexeReadDidOpen); 886 callback_factory_.NewCallback(&PnaclCoordinator::NexeReadDidOpen);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 obj_file_.get(), 1043 obj_file_.get(),
1041 temp_nexe_file_.get(), 1044 temp_nexe_file_.get(),
1042 &error_info_, 1045 &error_info_,
1043 resources_.get(), 1046 resources_.get(),
1044 &pnacl_options_, 1047 &pnacl_options_,
1045 this, 1048 this,
1046 plugin_); 1049 plugin_);
1047 } 1050 }
1048 1051
1049 } // namespace plugin 1052 } // namespace plugin
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698