| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 520 |
| 521 // Because the ownership of data is taken by caller, we must clear it | 521 // Because the ownership of data is taken by caller, we must clear it |
| 522 // manually here. Otherwise, its dtor invokes callbacks again. | 522 // manually here. Otherwise, its dtor invokes callbacks again. |
| 523 data->Clear(); | 523 data->Clear(); |
| 524 } | 524 } |
| 525 | 525 |
| 526 bool ServiceRuntime::SetupCommandChannel() { | 526 bool ServiceRuntime::SetupCommandChannel() { |
| 527 NaClLog(4, "ServiceRuntime::SetupCommand (this=%p, subprocess=%p)\n", | 527 NaClLog(4, "ServiceRuntime::SetupCommand (this=%p, subprocess=%p)\n", |
| 528 static_cast<void*>(this), | 528 static_cast<void*>(this), |
| 529 static_cast<void*>(subprocess_.get())); | 529 static_cast<void*>(subprocess_.get())); |
| 530 if (uses_nonsfi_mode_) { |
| 531 // In non-SFI mode, no SRPC is used. Just skips and returns success. |
| 532 return true; |
| 533 } |
| 534 |
| 530 if (!subprocess_->SetupCommand(&command_channel_)) { | 535 if (!subprocess_->SetupCommand(&command_channel_)) { |
| 531 if (main_service_runtime_) { | 536 if (main_service_runtime_) { |
| 532 ErrorInfo error_info; | 537 ErrorInfo error_info; |
| 533 error_info.SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL, | 538 error_info.SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL, |
| 534 "ServiceRuntime: command channel creation failed"); | 539 "ServiceRuntime: command channel creation failed"); |
| 535 plugin_->ReportLoadError(error_info); | 540 plugin_->ReportLoadError(error_info); |
| 536 } | 541 } |
| 537 return false; | 542 return false; |
| 538 } | 543 } |
| 539 return true; | 544 return true; |
| 540 } | 545 } |
| 541 | 546 |
| 542 void ServiceRuntime::LoadModule(PP_NaClFileInfo file_info, | 547 void ServiceRuntime::LoadModule(PP_NaClFileInfo file_info, |
| 543 pp::CompletionCallback callback) { | 548 pp::CompletionCallback callback) { |
| 549 if (uses_nonsfi_mode_) { |
| 550 // In non-SFI mode, loading is done a part of LaunchSelLdr. |
| 551 DidLoadModule(callback, PP_OK); |
| 552 return; |
| 553 } |
| 554 |
| 544 NaClFileInfo nacl_file_info; | 555 NaClFileInfo nacl_file_info; |
| 545 nacl_file_info.desc = ConvertFileDescriptor(file_info.handle, true); | 556 nacl_file_info.desc = ConvertFileDescriptor(file_info.handle, true); |
| 546 nacl_file_info.file_token.lo = file_info.token_lo; | 557 nacl_file_info.file_token.lo = file_info.token_lo; |
| 547 nacl_file_info.file_token.hi = file_info.token_hi; | 558 nacl_file_info.file_token.hi = file_info.token_hi; |
| 548 NaClDesc* desc = NaClDescIoFromFileInfo(nacl_file_info, O_RDONLY); | 559 NaClDesc* desc = NaClDescIoFromFileInfo(nacl_file_info, O_RDONLY); |
| 549 if (desc == NULL) { | 560 if (desc == NULL) { |
| 550 DidLoadModule(callback, PP_ERROR_FAILED); | 561 DidLoadModule(callback, PP_ERROR_FAILED); |
| 551 return; | 562 return; |
| 552 } | 563 } |
| 553 | 564 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 } | 704 } |
| 694 | 705 |
| 695 ManifestService* manifest_service = | 706 ManifestService* manifest_service = |
| 696 new ManifestService(anchor_->Ref(), rev_interface_); | 707 new ManifestService(anchor_->Ref(), rev_interface_); |
| 697 bool enable_dev_interfaces = | 708 bool enable_dev_interfaces = |
| 698 GetNaClInterface()->DevInterfacesEnabled(plugin_->pp_instance()); | 709 GetNaClInterface()->DevInterfacesEnabled(plugin_->pp_instance()); |
| 699 | 710 |
| 700 tmp_subprocess->Start(plugin_->pp_instance(), | 711 tmp_subprocess->Start(plugin_->pp_instance(), |
| 701 main_service_runtime_, | 712 main_service_runtime_, |
| 702 params.url.c_str(), | 713 params.url.c_str(), |
| 714 ¶ms.file_info, |
| 703 params.uses_irt, | 715 params.uses_irt, |
| 704 params.uses_ppapi, | 716 params.uses_ppapi, |
| 705 uses_nonsfi_mode_, | 717 uses_nonsfi_mode_, |
| 706 enable_dev_interfaces, | 718 enable_dev_interfaces, |
| 707 params.enable_dyncode_syscalls, | 719 params.enable_dyncode_syscalls, |
| 708 params.enable_exception_handling, | 720 params.enable_exception_handling, |
| 709 params.enable_crash_throttling, | 721 params.enable_crash_throttling, |
| 710 &kManifestServiceVTable, | 722 &kManifestServiceVTable, |
| 711 manifest_service, | 723 manifest_service, |
| 712 callback); | 724 callback); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 | 871 |
| 860 nacl::string ServiceRuntime::GetCrashLogOutput() { | 872 nacl::string ServiceRuntime::GetCrashLogOutput() { |
| 861 if (NULL != subprocess_.get()) { | 873 if (NULL != subprocess_.get()) { |
| 862 return subprocess_->GetCrashLogOutput(); | 874 return subprocess_->GetCrashLogOutput(); |
| 863 } else { | 875 } else { |
| 864 return std::string(); | 876 return std::string(); |
| 865 } | 877 } |
| 866 } | 878 } |
| 867 | 879 |
| 868 } // namespace plugin | 880 } // namespace plugin |
| OLD | NEW |