| 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 "native_client/src/trusted/plugin/service_runtime.h" | 9 #include "native_client/src/trusted/plugin/service_runtime.h" |
| 10 | 10 |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 return false; | 621 return false; |
| 622 } | 622 } |
| 623 return true; | 623 return true; |
| 624 } | 624 } |
| 625 | 625 |
| 626 bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc, | 626 bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc, |
| 627 ErrorInfo* error_info, const nacl::string& url) { | 627 ErrorInfo* error_info, const nacl::string& url) { |
| 628 PLUGIN_PRINTF(("ServiceRuntime::Start (nacl_desc=%p)\n", | 628 PLUGIN_PRINTF(("ServiceRuntime::Start (nacl_desc=%p)\n", |
| 629 reinterpret_cast<void*>(nacl_desc))); | 629 reinterpret_cast<void*>(nacl_desc))); |
| 630 | 630 |
| 631 nacl::scoped_ptr<nacl::SelLdrLauncherBase> tmp_subprocess; | |
| 632 #ifdef NACL_STANDALONE | 631 #ifdef NACL_STANDALONE |
| 633 tmp_subprocess.reset(new nacl::SelLdrLauncherStandalone()); | 632 nacl::scoped_ptr<nacl::SelLdrLauncherStandalone> |
| 633 tmp_subprocess(new nacl::SelLdrLauncherStandalone()); |
| 634 #else | 634 #else |
| 635 tmp_subprocess.reset(new SelLdrLauncherChrome()); | 635 nacl::scoped_ptr<SelLdrLauncherChrome> |
| 636 tmp_subprocess(new SelLdrLauncherChrome()); |
| 636 #endif | 637 #endif |
| 637 if (NULL == tmp_subprocess.get()) { | 638 if (NULL == tmp_subprocess.get()) { |
| 638 PLUGIN_PRINTF(("ServiceRuntime::Start (subprocess create failed)\n")); | 639 PLUGIN_PRINTF(("ServiceRuntime::Start (subprocess create failed)\n")); |
| 639 error_info->SetReport(ERROR_SEL_LDR_CREATE_LAUNCHER, | 640 error_info->SetReport(ERROR_SEL_LDR_CREATE_LAUNCHER, |
| 640 "ServiceRuntime: failed to create sel_ldr launcher"); | 641 "ServiceRuntime: failed to create sel_ldr launcher"); |
| 641 return false; | 642 return false; |
| 642 } | 643 } |
| 643 if (!tmp_subprocess->Start(url.c_str())) { | 644 #ifdef NACL_STANDALONE |
| 645 bool started = tmp_subprocess->Start(url.c_str()); |
| 646 #else |
| 647 bool started = tmp_subprocess->Start(plugin_->pp_instance(), url.c_str()); |
| 648 #endif |
| 649 PP_Instance instance = plugin_->pp_instance(); |
| 650 if (!started) { |
| 644 PLUGIN_PRINTF(("ServiceRuntime::Start (start failed)\n")); | 651 PLUGIN_PRINTF(("ServiceRuntime::Start (start failed)\n")); |
| 645 error_info->SetReport(ERROR_SEL_LDR_LAUNCH, | 652 error_info->SetReport(ERROR_SEL_LDR_LAUNCH, |
| 646 "ServiceRuntime: failed to start"); | 653 "ServiceRuntime: failed to start"); |
| 647 return false; | 654 return false; |
| 648 } | 655 } |
| 649 | 656 |
| 650 subprocess_.reset(tmp_subprocess.release()); | 657 subprocess_.reset(tmp_subprocess.release()); |
| 651 if (!InitCommunication(nacl_desc, error_info)) { | 658 if (!InitCommunication(nacl_desc, error_info)) { |
| 652 subprocess_.reset(NULL); | 659 subprocess_.reset(NULL); |
| 653 return false; | 660 return false; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 nacl::MutexLocker take(&mu_); | 737 nacl::MutexLocker take(&mu_); |
| 731 return exit_status_; | 738 return exit_status_; |
| 732 } | 739 } |
| 733 | 740 |
| 734 void ServiceRuntime::set_exit_status(int exit_status) { | 741 void ServiceRuntime::set_exit_status(int exit_status) { |
| 735 nacl::MutexLocker take(&mu_); | 742 nacl::MutexLocker take(&mu_); |
| 736 exit_status_ = exit_status & 0xff; | 743 exit_status_ = exit_status & 0xff; |
| 737 } | 744 } |
| 738 | 745 |
| 739 } // namespace plugin | 746 } // namespace plugin |
| OLD | NEW |