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

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

Issue 282683002: Pepper: Simplify LaunchSelLdr error reporting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 /* 1 /*
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Copyright (c) 2012 The Chromium 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 #define NACL_LOG_MODULE_NAME "Plugin_ServiceRuntime" 7 #define NACL_LOG_MODULE_NAME "Plugin_ServiceRuntime"
8 8
9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" 9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h"
10 10
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 if (main_service_runtime_) { 679 if (main_service_runtime_) {
680 ErrorInfo error_info; 680 ErrorInfo error_info;
681 error_info.SetReport( 681 error_info.SetReport(
682 PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER, 682 PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER,
683 "ServiceRuntime: failed to create sel_ldr launcher"); 683 "ServiceRuntime: failed to create sel_ldr launcher");
684 plugin_->ReportLoadError(error_info); 684 plugin_->ReportLoadError(error_info);
685 } 685 }
686 pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED); 686 pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED);
687 return; 687 return;
688 } 688 }
689 pp::CompletionCallback internal_callback =
690 callback_factory_.NewCallback(&ServiceRuntime::StartSelLdrContinuation,
691 callback);
692 689
693 ManifestService* manifest_service = 690 ManifestService* manifest_service =
694 new ManifestService(anchor_->Ref(), rev_interface_); 691 new ManifestService(anchor_->Ref(), rev_interface_);
695 tmp_subprocess->Start(plugin_->pp_instance(), 692 tmp_subprocess->Start(plugin_->pp_instance(),
693 main_service_runtime_,
696 params.url.c_str(), 694 params.url.c_str(),
697 params.uses_irt, 695 params.uses_irt,
698 params.uses_ppapi, 696 params.uses_ppapi,
699 params.uses_nonsfi_mode, 697 params.uses_nonsfi_mode,
700 params.enable_dev_interfaces, 698 params.enable_dev_interfaces,
701 params.enable_dyncode_syscalls, 699 params.enable_dyncode_syscalls,
702 params.enable_exception_handling, 700 params.enable_exception_handling,
703 params.enable_crash_throttling, 701 params.enable_crash_throttling,
704 &kManifestServiceVTable, 702 &kManifestServiceVTable,
705 manifest_service, 703 manifest_service,
706 &start_sel_ldr_error_message_, 704 callback);
707 internal_callback);
708 subprocess_.reset(tmp_subprocess.release()); 705 subprocess_.reset(tmp_subprocess.release());
709 } 706 }
710 707
711 void ServiceRuntime::StartSelLdrContinuation(int32_t pp_error,
712 pp::CompletionCallback callback) {
713 if (pp_error != PP_OK) {
714 NaClLog(LOG_ERROR, "ServiceRuntime::StartSelLdrContinuation "
715 " (start failed)\n");
716 if (main_service_runtime_) {
717 std::string error_message;
718 pp::Var var_error_message_cpp(pp::PASS_REF, start_sel_ldr_error_message_);
719 if (var_error_message_cpp.is_string()) {
720 error_message = var_error_message_cpp.AsString();
721 }
722 ErrorInfo error_info;
723 error_info.SetReportWithConsoleOnlyError(
724 PP_NACL_ERROR_SEL_LDR_LAUNCH,
725 "ServiceRuntime: failed to start",
726 error_message);
727 plugin_->ReportLoadError(error_info);
728 }
729 }
730 pp::Module::Get()->core()->CallOnMainThread(0, callback, pp_error);
731 }
732
733 bool ServiceRuntime::WaitForSelLdrStart() { 708 bool ServiceRuntime::WaitForSelLdrStart() {
734 // Time to wait on condvar (for browser to create a new sel_ldr process on 709 // Time to wait on condvar (for browser to create a new sel_ldr process on
735 // our behalf). Use 6 seconds to be *fairly* conservative. 710 // our behalf). Use 6 seconds to be *fairly* conservative.
736 // 711 //
737 // On surfaway, the CallOnMainThread above may never get scheduled 712 // On surfaway, the CallOnMainThread above may never get scheduled
738 // to unblock this condvar, or the IPC reply from the browser to renderer 713 // to unblock this condvar, or the IPC reply from the browser to renderer
739 // might get canceled/dropped. However, it is currently important to 714 // might get canceled/dropped. However, it is currently important to
740 // avoid waiting indefinitely because ~PnaclCoordinator will attempt to 715 // avoid waiting indefinitely because ~PnaclCoordinator will attempt to
741 // join() the PnaclTranslateThread, and the PnaclTranslateThread is waiting 716 // join() the PnaclTranslateThread, and the PnaclTranslateThread is waiting
742 // for the signal before exiting. 717 // for the signal before exiting.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 852
878 nacl::string ServiceRuntime::GetCrashLogOutput() { 853 nacl::string ServiceRuntime::GetCrashLogOutput() {
879 if (NULL != subprocess_.get()) { 854 if (NULL != subprocess_.get()) {
880 return subprocess_->GetCrashLogOutput(); 855 return subprocess_->GetCrashLogOutput();
881 } else { 856 } else {
882 return std::string(); 857 return std::string();
883 } 858 }
884 } 859 }
885 860
886 } // namespace plugin 861 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698