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

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

Issue 11881038: Refine PNaCl pexe fetch UMA errors to know if the user aborted, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort Created 7 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 #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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 pp::CompletionCallback obj_cb = 696 pp::CompletionCallback obj_cb =
697 callback_factory_.NewCallback(&PnaclCoordinator::ObjectFileDidOpen); 697 callback_factory_.NewCallback(&PnaclCoordinator::ObjectFileDidOpen);
698 obj_file_->Open(obj_cb); 698 obj_file_->Open(obj_cb);
699 699
700 streaming_downloader_.reset(new FileDownloader()); 700 streaming_downloader_.reset(new FileDownloader());
701 streaming_downloader_->Initialize(plugin_); 701 streaming_downloader_->Initialize(plugin_);
702 pp::CompletionCallback cb = 702 pp::CompletionCallback cb =
703 callback_factory_.NewCallback( 703 callback_factory_.NewCallback(
704 &PnaclCoordinator::BitcodeStreamDidFinish); 704 &PnaclCoordinator::BitcodeStreamDidFinish);
705 705
706 // TODO(dschuff): need to use url_util_->ResolveRelativeToURL?
707 if (!streaming_downloader_->OpenStream(pexe_url_, cb, this)) { 706 if (!streaming_downloader_->OpenStream(pexe_url_, cb, this)) {
708 ReportNonPpapiError(ERROR_PNACL_PEXE_FETCH, 707 ReportNonPpapiError(ERROR_PNACL_PEXE_FETCH_OTHER,
709 nacl::string("failed to open stream ") + pexe_url_); 708 nacl::string("failed to open stream ") + pexe_url_);
710 } 709 }
711 } 710 }
712 711
713 void PnaclCoordinator::BitcodeStreamDidFinish(int32_t pp_error) { 712 void PnaclCoordinator::BitcodeStreamDidFinish(int32_t pp_error) {
714 PLUGIN_PRINTF(("PnaclCoordinator::BitcodeStreamDidFinish (pp_error=%" 713 PLUGIN_PRINTF(("PnaclCoordinator::BitcodeStreamDidFinish (pp_error=%"
715 NACL_PRId32")\n", pp_error)); 714 NACL_PRId32")\n", pp_error));
716 if (pp_error != PP_OK) { 715 if (pp_error != PP_OK) {
717 // Defer reporting the error and cleanup until after the translation 716 // Defer reporting the error and cleanup until after the translation
718 // thread returns, because it may be accessing the coordinator's 717 // thread returns, because it may be accessing the coordinator's
719 // objects or writing to the files. 718 // objects or writing to the files.
720 // TODO(dschuff,jvoung): If this is a PP_ERROR_ABORTED, we probably
721 // want the UMA stat to show that the user aborted the action
722 // (vs a network error).
723 // We also want to track the total number of bytes of the pexe
724 // to know the typical application sizes.
725 translate_finish_error_ = pp_error; 719 translate_finish_error_ = pp_error;
726 nacl::stringstream ss; 720 if (pp_error == PP_ERROR_ABORTED) {
727 ss << "PnaclCoordinator: pexe load failed (pp_error=" << pp_error << ")."; 721 error_info_.SetReport(ERROR_PNACL_PEXE_FETCH_ABORTED,
728 error_info_.SetReport(ERROR_PNACL_PEXE_FETCH, ss.str()); 722 "PnaclCoordinator: pexe load failed. Aborted.");
Nick Bray (chromium) 2013/01/15 23:12:49 No french spacing. I'd suggesting making it a sin
jvoung (off chromium) 2013/01/16 01:31:24 Pardon my french spacing. Done. I mean... done.
723 }
724 if (pp_error == PP_ERROR_NOACCESS) {
725 error_info_.SetReport(ERROR_PNACL_PEXE_FETCH_NOACCESS,
726 "PnaclCoordinator: pexe load failed. No access.");
Nick Bray (chromium) 2013/01/15 23:12:49 Ditto.
jvoung (off chromium) 2013/01/16 01:31:24 Done -- cleaned up some of the other instances whi
727 } else {
728 nacl::stringstream ss;
729 ss << "PnaclCoordinator: pexe load failed (pp_error=" << pp_error << ").";
730 error_info_.SetReport(ERROR_PNACL_PEXE_FETCH_OTHER, ss.str());
731 }
729 translate_thread_->AbortSubprocesses(); 732 translate_thread_->AbortSubprocesses();
730 } 733 }
731 } 734 }
732 735
733 void PnaclCoordinator::BitcodeStreamGotData(int32_t pp_error, 736 void PnaclCoordinator::BitcodeStreamGotData(int32_t pp_error,
734 FileStreamData data) { 737 FileStreamData data) {
735 PLUGIN_PRINTF(("PnaclCoordinator::BitcodeStreamGotData (pp_error=%" 738 PLUGIN_PRINTF(("PnaclCoordinator::BitcodeStreamGotData (pp_error=%"
736 NACL_PRId32", data=%p)\n", pp_error, data ? &(*data)[0] : 0)); 739 NACL_PRId32", data=%p)\n", pp_error, data ? &(*data)[0] : 0));
737 DCHECK(translate_thread_.get()); 740 DCHECK(translate_thread_.get());
738 translate_thread_->PutBytes(data, pp_error); 741 translate_thread_->PutBytes(data, pp_error);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 manifest_.get(), 776 manifest_.get(),
774 ld_manifest_.get(), 777 ld_manifest_.get(),
775 obj_file_.get(), 778 obj_file_.get(),
776 temp_nexe_file_.get(), 779 temp_nexe_file_.get(),
777 &error_info_, 780 &error_info_,
778 resources_.get(), 781 resources_.get(),
779 plugin_); 782 plugin_);
780 } 783 }
781 784
782 } // namespace plugin 785 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698