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