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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 430 |
431 // Because the ownership of data is taken by caller, we must clear it | 431 // Because the ownership of data is taken by caller, we must clear it |
432 // manually here. Otherwise, its dtor invokes callbacks again. | 432 // manually here. Otherwise, its dtor invokes callbacks again. |
433 data->Clear(); | 433 data->Clear(); |
434 } | 434 } |
435 | 435 |
436 bool ServiceRuntime::SetupCommandChannel() { | 436 bool ServiceRuntime::SetupCommandChannel() { |
437 NaClLog(4, "ServiceRuntime::SetupCommand (this=%p, subprocess=%p)\n", | 437 NaClLog(4, "ServiceRuntime::SetupCommand (this=%p, subprocess=%p)\n", |
438 static_cast<void*>(this), | 438 static_cast<void*>(this), |
439 static_cast<void*>(subprocess_.get())); | 439 static_cast<void*>(subprocess_.get())); |
| 440 if (uses_nonsfi_mode_) { |
| 441 // In non-SFI mode, no SRPC is used. Just skips and returns success. |
| 442 return true; |
| 443 } |
| 444 |
440 if (!subprocess_->SetupCommand(&command_channel_)) { | 445 if (!subprocess_->SetupCommand(&command_channel_)) { |
441 if (main_service_runtime_) { | 446 if (main_service_runtime_) { |
442 ErrorInfo error_info; | 447 ErrorInfo error_info; |
443 error_info.SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL, | 448 error_info.SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL, |
444 "ServiceRuntime: command channel creation failed"); | 449 "ServiceRuntime: command channel creation failed"); |
445 plugin_->ReportLoadError(error_info); | 450 plugin_->ReportLoadError(error_info); |
446 } | 451 } |
447 return false; | 452 return false; |
448 } | 453 } |
449 return true; | 454 return true; |
450 } | 455 } |
451 | 456 |
452 void ServiceRuntime::LoadModule(PP_NaClFileInfo file_info, | 457 void ServiceRuntime::LoadModule(PP_NaClFileInfo file_info, |
453 pp::CompletionCallback callback) { | 458 pp::CompletionCallback callback) { |
| 459 if (uses_nonsfi_mode_) { |
| 460 // In non-SFI mode, loading is done a part of LaunchSelLdr. |
| 461 DidLoadModule(callback, PP_OK); |
| 462 return; |
| 463 } |
| 464 |
454 NaClFileInfo nacl_file_info; | 465 NaClFileInfo nacl_file_info; |
455 nacl_file_info.desc = ConvertFileDescriptor(file_info.handle, true); | 466 nacl_file_info.desc = ConvertFileDescriptor(file_info.handle, true); |
456 nacl_file_info.file_token.lo = file_info.token_lo; | 467 nacl_file_info.file_token.lo = file_info.token_lo; |
457 nacl_file_info.file_token.hi = file_info.token_hi; | 468 nacl_file_info.file_token.hi = file_info.token_hi; |
458 NaClDesc* desc = NaClDescIoFromFileInfo(nacl_file_info, O_RDONLY); | 469 NaClDesc* desc = NaClDescIoFromFileInfo(nacl_file_info, O_RDONLY); |
459 if (desc == NULL) { | 470 if (desc == NULL) { |
460 DidLoadModule(callback, PP_ERROR_FAILED); | 471 DidLoadModule(callback, PP_ERROR_FAILED); |
461 return; | 472 return; |
462 } | 473 } |
463 | 474 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 } | 614 } |
604 | 615 |
605 ManifestService* manifest_service = | 616 ManifestService* manifest_service = |
606 new ManifestService(anchor_->Ref(), rev_interface_); | 617 new ManifestService(anchor_->Ref(), rev_interface_); |
607 bool enable_dev_interfaces = | 618 bool enable_dev_interfaces = |
608 GetNaClInterface()->DevInterfacesEnabled(plugin_->pp_instance()); | 619 GetNaClInterface()->DevInterfacesEnabled(plugin_->pp_instance()); |
609 | 620 |
610 tmp_subprocess->Start(plugin_->pp_instance(), | 621 tmp_subprocess->Start(plugin_->pp_instance(), |
611 main_service_runtime_, | 622 main_service_runtime_, |
612 params.url.c_str(), | 623 params.url.c_str(), |
| 624 ¶ms.file_info, |
613 params.uses_irt, | 625 params.uses_irt, |
614 params.uses_ppapi, | 626 params.uses_ppapi, |
615 uses_nonsfi_mode_, | 627 uses_nonsfi_mode_, |
616 enable_dev_interfaces, | 628 enable_dev_interfaces, |
617 params.enable_dyncode_syscalls, | 629 params.enable_dyncode_syscalls, |
618 params.enable_exception_handling, | 630 params.enable_exception_handling, |
619 params.enable_crash_throttling, | 631 params.enable_crash_throttling, |
620 &kManifestServiceVTable, | 632 &kManifestServiceVTable, |
621 manifest_service, | 633 manifest_service, |
622 callback); | 634 callback); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 | 781 |
770 nacl::string ServiceRuntime::GetCrashLogOutput() { | 782 nacl::string ServiceRuntime::GetCrashLogOutput() { |
771 if (NULL != subprocess_.get()) { | 783 if (NULL != subprocess_.get()) { |
772 return subprocess_->GetCrashLogOutput(); | 784 return subprocess_->GetCrashLogOutput(); |
773 } else { | 785 } else { |
774 return std::string(); | 786 return std::string(); |
775 } | 787 } |
776 } | 788 } |
777 | 789 |
778 } // namespace plugin | 790 } // namespace plugin |
OLD | NEW |