| 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 #include "components/nacl/renderer/plugin/service_runtime.h" | 7 #include "components/nacl/renderer/plugin/service_runtime.h" |
| 8 | 8 |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 namespace plugin { | 31 namespace plugin { |
| 32 | 32 |
| 33 ServiceRuntime::ServiceRuntime(Plugin* plugin, | 33 ServiceRuntime::ServiceRuntime(Plugin* plugin, |
| 34 PP_Instance pp_instance, | 34 PP_Instance pp_instance, |
| 35 bool main_service_runtime, | 35 bool main_service_runtime, |
| 36 bool uses_nonsfi_mode) | 36 bool uses_nonsfi_mode) |
| 37 : plugin_(plugin), | 37 : plugin_(plugin), |
| 38 pp_instance_(pp_instance), | 38 pp_instance_(pp_instance), |
| 39 main_service_runtime_(main_service_runtime), | 39 main_service_runtime_(main_service_runtime), |
| 40 uses_nonsfi_mode_(uses_nonsfi_mode), | 40 uses_nonsfi_mode_(uses_nonsfi_mode), |
| 41 bootstrap_channel_(NACL_INVALID_HANDLE) { | 41 bootstrap_channel_(NACL_INVALID_HANDLE), |
| 42 process_id_(base::kNullProcessId) { |
| 42 } | 43 } |
| 43 | 44 |
| 44 bool ServiceRuntime::SetupCommandChannel() { | 45 bool ServiceRuntime::SetupCommandChannel() { |
| 45 // Set up the bootstrap channel in our subprocess so that we can establish | 46 // Set up the bootstrap channel in our subprocess so that we can establish |
| 46 // SRPC. | 47 // SRPC. |
| 47 subprocess_->set_channel(bootstrap_channel_); | 48 subprocess_->set_channel(bootstrap_channel_); |
| 48 | 49 |
| 49 if (uses_nonsfi_mode_) { | 50 if (uses_nonsfi_mode_) { |
| 50 // In non-SFI mode, no SRPC is used. Just skips and returns success. | 51 // In non-SFI mode, no SRPC is used. Just skips and returns success. |
| 51 return true; | 52 return true; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 85 } |
| 85 | 86 |
| 86 GetNaClInterface()->LaunchSelLdr( | 87 GetNaClInterface()->LaunchSelLdr( |
| 87 pp_instance_, | 88 pp_instance_, |
| 88 PP_FromBool(main_service_runtime_), | 89 PP_FromBool(main_service_runtime_), |
| 89 params.url.c_str(), | 90 params.url.c_str(), |
| 90 ¶ms.file_info, | 91 ¶ms.file_info, |
| 91 PP_FromBool(uses_nonsfi_mode_), | 92 PP_FromBool(uses_nonsfi_mode_), |
| 92 params.process_type, | 93 params.process_type, |
| 93 &bootstrap_channel_, | 94 &bootstrap_channel_, |
| 95 &translator_channel_, |
| 96 &process_id_, |
| 94 callback.pp_completion_callback()); | 97 callback.pp_completion_callback()); |
| 95 subprocess_.reset(tmp_subprocess.release()); | 98 subprocess_.reset(tmp_subprocess.release()); |
| 96 } | 99 } |
| 97 | 100 |
| 98 void ServiceRuntime::StartNexe() { | 101 void ServiceRuntime::StartNexe() { |
| 99 SetupCommandChannel(); | 102 SetupCommandChannel(); |
| 100 } | 103 } |
| 101 | 104 |
| 102 void ServiceRuntime::ReportLoadError(const ErrorInfo& error_info) { | 105 void ServiceRuntime::ReportLoadError(const ErrorInfo& error_info) { |
| 103 if (main_service_runtime_) { | 106 if (main_service_runtime_) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 128 // Note that this does waitpid() to get rid of any zombie subprocess. | 131 // Note that this does waitpid() to get rid of any zombie subprocess. |
| 129 subprocess_.reset(NULL); | 132 subprocess_.reset(NULL); |
| 130 } | 133 } |
| 131 | 134 |
| 132 ServiceRuntime::~ServiceRuntime() { | 135 ServiceRuntime::~ServiceRuntime() { |
| 133 // We do this just in case Shutdown() was not called. | 136 // We do this just in case Shutdown() was not called. |
| 134 subprocess_.reset(NULL); | 137 subprocess_.reset(NULL); |
| 135 } | 138 } |
| 136 | 139 |
| 137 } // namespace plugin | 140 } // namespace plugin |
| OLD | NEW |