OLD | NEW |
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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 if (main_service_runtime_) { | 643 if (main_service_runtime_) { |
644 ErrorInfo error_info; | 644 ErrorInfo error_info; |
645 error_info.SetReport( | 645 error_info.SetReport( |
646 PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER, | 646 PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER, |
647 "ServiceRuntime: failed to create sel_ldr launcher"); | 647 "ServiceRuntime: failed to create sel_ldr launcher"); |
648 plugin_->ReportLoadError(error_info); | 648 plugin_->ReportLoadError(error_info); |
649 } | 649 } |
650 pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED); | 650 pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED); |
651 return; | 651 return; |
652 } | 652 } |
653 pp::CompletionCallback internal_callback = | |
654 callback_factory_.NewCallback(&ServiceRuntime::StartSelLdrContinuation, | |
655 callback); | |
656 | 653 |
657 ManifestService* manifest_service = | 654 ManifestService* manifest_service = |
658 new ManifestService(anchor_->Ref(), rev_interface_); | 655 new ManifestService(anchor_->Ref(), rev_interface_); |
659 tmp_subprocess->Start(plugin_->pp_instance(), | 656 tmp_subprocess->Start(plugin_->pp_instance(), |
| 657 main_service_runtime_, |
660 params.url.c_str(), | 658 params.url.c_str(), |
661 params.uses_irt, | 659 params.uses_irt, |
662 params.uses_ppapi, | 660 params.uses_ppapi, |
663 params.uses_nonsfi_mode, | 661 params.uses_nonsfi_mode, |
664 params.enable_dev_interfaces, | 662 params.enable_dev_interfaces, |
665 params.enable_dyncode_syscalls, | 663 params.enable_dyncode_syscalls, |
666 params.enable_exception_handling, | 664 params.enable_exception_handling, |
667 params.enable_crash_throttling, | 665 params.enable_crash_throttling, |
668 &kManifestServiceVTable, | 666 &kManifestServiceVTable, |
669 manifest_service, | 667 manifest_service, |
670 &start_sel_ldr_error_message_, | 668 callback); |
671 internal_callback); | |
672 subprocess_.reset(tmp_subprocess.release()); | 669 subprocess_.reset(tmp_subprocess.release()); |
673 } | 670 } |
674 | 671 |
675 void ServiceRuntime::StartSelLdrContinuation(int32_t pp_error, | |
676 pp::CompletionCallback callback) { | |
677 if (pp_error != PP_OK) { | |
678 NaClLog(LOG_ERROR, "ServiceRuntime::StartSelLdrContinuation " | |
679 " (start failed)\n"); | |
680 if (main_service_runtime_) { | |
681 std::string error_message; | |
682 pp::Var var_error_message_cpp(pp::PASS_REF, start_sel_ldr_error_message_); | |
683 if (var_error_message_cpp.is_string()) { | |
684 error_message = var_error_message_cpp.AsString(); | |
685 } | |
686 ErrorInfo error_info; | |
687 error_info.SetReportWithConsoleOnlyError( | |
688 PP_NACL_ERROR_SEL_LDR_LAUNCH, | |
689 "ServiceRuntime: failed to start", | |
690 error_message); | |
691 plugin_->ReportLoadError(error_info); | |
692 } | |
693 } | |
694 pp::Module::Get()->core()->CallOnMainThread(0, callback, pp_error); | |
695 } | |
696 | |
697 bool ServiceRuntime::WaitForSelLdrStart() { | 672 bool ServiceRuntime::WaitForSelLdrStart() { |
698 // Time to wait on condvar (for browser to create a new sel_ldr process on | 673 // Time to wait on condvar (for browser to create a new sel_ldr process on |
699 // our behalf). Use 6 seconds to be *fairly* conservative. | 674 // our behalf). Use 6 seconds to be *fairly* conservative. |
700 // | 675 // |
701 // On surfaway, the CallOnMainThread above may never get scheduled | 676 // On surfaway, the CallOnMainThread above may never get scheduled |
702 // to unblock this condvar, or the IPC reply from the browser to renderer | 677 // to unblock this condvar, or the IPC reply from the browser to renderer |
703 // might get canceled/dropped. However, it is currently important to | 678 // might get canceled/dropped. However, it is currently important to |
704 // avoid waiting indefinitely because ~PnaclCoordinator will attempt to | 679 // avoid waiting indefinitely because ~PnaclCoordinator will attempt to |
705 // join() the PnaclTranslateThread, and the PnaclTranslateThread is waiting | 680 // join() the PnaclTranslateThread, and the PnaclTranslateThread is waiting |
706 // for the signal before exiting. | 681 // for the signal before exiting. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 | 816 |
842 nacl::string ServiceRuntime::GetCrashLogOutput() { | 817 nacl::string ServiceRuntime::GetCrashLogOutput() { |
843 if (NULL != subprocess_.get()) { | 818 if (NULL != subprocess_.get()) { |
844 return subprocess_->GetCrashLogOutput(); | 819 return subprocess_->GetCrashLogOutput(); |
845 } else { | 820 } else { |
846 return std::string(); | 821 return std::string(); |
847 } | 822 } |
848 } | 823 } |
849 | 824 |
850 } // namespace plugin | 825 } // namespace plugin |
OLD | NEW |