| 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 return false; | 588 return false; |
| 589 } | 589 } |
| 590 out_conn_cap = NULL; // ownership passed | 590 out_conn_cap = NULL; // ownership passed |
| 591 reverse_service_ = new nacl::ReverseService(conn_cap, rev_interface_->Ref()); | 591 reverse_service_ = new nacl::ReverseService(conn_cap, rev_interface_->Ref()); |
| 592 if (!reverse_service_->Start()) { | 592 if (!reverse_service_->Start()) { |
| 593 error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE, | 593 error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE, |
| 594 "ServiceRuntime: starting reverse services failed"); | 594 "ServiceRuntime: starting reverse services failed"); |
| 595 return false; | 595 return false; |
| 596 } | 596 } |
| 597 | 597 |
| 598 #if NACL_WINDOWS && !defined(NACL_STANDALONE) | |
| 599 // Establish the communication for handle passing protocol | |
| 600 struct NaClDesc* desc = NaClHandlePassBrowserGetSocketAddress(); | |
| 601 | |
| 602 DWORD my_pid = GetCurrentProcessId(); | |
| 603 nacl::Handle my_handle = GetCurrentProcess(); | |
| 604 nacl::Handle my_handle_in_selldr; | |
| 605 | |
| 606 if (!DuplicateHandle(GetCurrentProcess(), | |
| 607 my_handle, | |
| 608 subprocess_->child_process(), | |
| 609 &my_handle_in_selldr, | |
| 610 PROCESS_DUP_HANDLE, | |
| 611 FALSE, | |
| 612 0)) { | |
| 613 error_info->SetReport(ERROR_SEL_LDR_HANDLE_PASSING, | |
| 614 "ServiceRuntime: failed handle passing protocol"); | |
| 615 return false; | |
| 616 } | |
| 617 | |
| 618 rpc_result = | |
| 619 NaClSrpcInvokeBySignature(&command_channel_, | |
| 620 "init_handle_passing:hii:", | |
| 621 desc, | |
| 622 my_pid, | |
| 623 reinterpret_cast<int>(my_handle_in_selldr)); | |
| 624 | |
| 625 if (NACL_SRPC_RESULT_OK != rpc_result) { | |
| 626 error_info->SetReport(ERROR_SEL_LDR_HANDLE_PASSING, | |
| 627 "ServiceRuntime: failed handle passing protocol"); | |
| 628 return false; | |
| 629 } | |
| 630 #endif | |
| 631 // start the module. otherwise we cannot connect for multimedia | 598 // start the module. otherwise we cannot connect for multimedia |
| 632 // subsystem since that is handled by user-level code (not secure!) | 599 // subsystem since that is handled by user-level code (not secure!) |
| 633 // in libsrpc. | 600 // in libsrpc. |
| 634 int load_status = -1; | 601 int load_status = -1; |
| 635 rpc_result = | 602 rpc_result = |
| 636 NaClSrpcInvokeBySignature(&command_channel_, | 603 NaClSrpcInvokeBySignature(&command_channel_, |
| 637 "start_module::i", | 604 "start_module::i", |
| 638 &load_status); | 605 &load_status); |
| 639 | 606 |
| 640 if (NACL_SRPC_RESULT_OK != rpc_result) { | 607 if (NACL_SRPC_RESULT_OK != rpc_result) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 nacl::MutexLocker take(&mu_); | 733 nacl::MutexLocker take(&mu_); |
| 767 return exit_status_; | 734 return exit_status_; |
| 768 } | 735 } |
| 769 | 736 |
| 770 void ServiceRuntime::set_exit_status(int exit_status) { | 737 void ServiceRuntime::set_exit_status(int exit_status) { |
| 771 nacl::MutexLocker take(&mu_); | 738 nacl::MutexLocker take(&mu_); |
| 772 exit_status_ = exit_status & 0xff; | 739 exit_status_ = exit_status & 0xff; |
| 773 } | 740 } |
| 774 | 741 |
| 775 } // namespace plugin | 742 } // namespace plugin |
| OLD | NEW |