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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // This is here due to a Windows API collision; plugin.h through | 39 // This is here due to a Windows API collision; plugin.h through |
40 // file_downloader.h transitively includes Instance.h which defines a | 40 // file_downloader.h transitively includes Instance.h which defines a |
41 // PostMessage method, so this undef must appear before any of those. | 41 // PostMessage method, so this undef must appear before any of those. |
42 #ifdef PostMessage | 42 #ifdef PostMessage |
43 #undef PostMessage | 43 #undef PostMessage |
44 #endif | 44 #endif |
45 #include "native_client/src/trusted/plugin/plugin.h" | 45 #include "native_client/src/trusted/plugin/plugin.h" |
46 #include "native_client/src/trusted/plugin/plugin_error.h" | 46 #include "native_client/src/trusted/plugin/plugin_error.h" |
47 #include "native_client/src/trusted/plugin/pnacl_coordinator.h" | 47 #include "native_client/src/trusted/plugin/pnacl_coordinator.h" |
| 48 #include "native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" |
48 #include "native_client/src/trusted/plugin/srpc_client.h" | 49 #include "native_client/src/trusted/plugin/srpc_client.h" |
49 #include "native_client/src/trusted/plugin/utility.h" | 50 #include "native_client/src/trusted/plugin/utility.h" |
50 | 51 |
51 #include "native_client/src/trusted/weak_ref/call_on_main_thread.h" | 52 #include "native_client/src/trusted/weak_ref/call_on_main_thread.h" |
52 | 53 |
53 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" | 54 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" |
54 #include "native_client/src/trusted/service_runtime/include/sys/nacl_imc_api.h" | 55 #include "native_client/src/trusted/service_runtime/include/sys/nacl_imc_api.h" |
55 | 56 |
56 #include "ppapi/c/pp_errors.h" | 57 #include "ppapi/c/pp_errors.h" |
57 #include "ppapi/c/trusted/ppb_file_io_trusted.h" | 58 #include "ppapi/c/trusted/ppb_file_io_trusted.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 return false; | 621 return false; |
621 } | 622 } |
622 return true; | 623 return true; |
623 } | 624 } |
624 | 625 |
625 bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc, | 626 bool ServiceRuntime::Start(nacl::DescWrapper* nacl_desc, |
626 ErrorInfo* error_info, const nacl::string& url) { | 627 ErrorInfo* error_info, const nacl::string& url) { |
627 PLUGIN_PRINTF(("ServiceRuntime::Start (nacl_desc=%p)\n", | 628 PLUGIN_PRINTF(("ServiceRuntime::Start (nacl_desc=%p)\n", |
628 reinterpret_cast<void*>(nacl_desc))); | 629 reinterpret_cast<void*>(nacl_desc))); |
629 | 630 |
630 nacl::scoped_ptr<nacl::SelLdrLauncher> | 631 nacl::scoped_ptr<nacl::SelLdrLauncherBase> tmp_subprocess; |
631 tmp_subprocess(new nacl::SelLdrLauncher()); | 632 #ifdef NACL_STANDALONE |
| 633 tmp_subprocess.reset(new nacl::SelLdrLauncherStandalone()); |
| 634 #else |
| 635 tmp_subprocess.reset(new SelLdrLauncherChrome()); |
| 636 #endif |
632 if (NULL == tmp_subprocess.get()) { | 637 if (NULL == tmp_subprocess.get()) { |
633 PLUGIN_PRINTF(("ServiceRuntime::Start (subprocess create failed)\n")); | 638 PLUGIN_PRINTF(("ServiceRuntime::Start (subprocess create failed)\n")); |
634 error_info->SetReport(ERROR_SEL_LDR_CREATE_LAUNCHER, | 639 error_info->SetReport(ERROR_SEL_LDR_CREATE_LAUNCHER, |
635 "ServiceRuntime: failed to create sel_ldr launcher"); | 640 "ServiceRuntime: failed to create sel_ldr launcher"); |
636 return false; | 641 return false; |
637 } | 642 } |
638 if (!tmp_subprocess->Start(url.c_str())) { | 643 if (!tmp_subprocess->Start(url.c_str())) { |
639 PLUGIN_PRINTF(("ServiceRuntime::Start (start failed)\n")); | 644 PLUGIN_PRINTF(("ServiceRuntime::Start (start failed)\n")); |
640 error_info->SetReport(ERROR_SEL_LDR_LAUNCH, | 645 error_info->SetReport(ERROR_SEL_LDR_LAUNCH, |
641 "ServiceRuntime: failed to start"); | 646 "ServiceRuntime: failed to start"); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 nacl::MutexLocker take(&mu_); | 730 nacl::MutexLocker take(&mu_); |
726 return exit_status_; | 731 return exit_status_; |
727 } | 732 } |
728 | 733 |
729 void ServiceRuntime::set_exit_status(int exit_status) { | 734 void ServiceRuntime::set_exit_status(int exit_status) { |
730 nacl::MutexLocker take(&mu_); | 735 nacl::MutexLocker take(&mu_); |
731 exit_status_ = exit_status & 0xff; | 736 exit_status_ = exit_status & 0xff; |
732 } | 737 } |
733 | 738 |
734 } // namespace plugin | 739 } // namespace plugin |
OLD | NEW |