OLD | NEW |
1 /* -*- c++ -*- */ | 1 /* -*- c++ -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 // A class containing information regarding a socket connection to a | 8 // A class containing information regarding a socket connection to a |
9 // service runtime instance. | 9 // service runtime instance. |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 void SignalStartSelLdrDone(); | 171 void SignalStartSelLdrDone(); |
172 | 172 |
173 // If starting the nexe from a background thread, wait for the nexe to | 173 // If starting the nexe from a background thread, wait for the nexe to |
174 // actually start. Returns |true| is the nexe started successfully. | 174 // actually start. Returns |true| is the nexe started successfully. |
175 bool WaitForNexeStart(); | 175 bool WaitForNexeStart(); |
176 | 176 |
177 // Signal to waiting threads that LoadNexeAndStart is complete (either | 177 // Signal to waiting threads that LoadNexeAndStart is complete (either |
178 // successfully or unsuccessfully). | 178 // successfully or unsuccessfully). |
179 void SignalNexeStarted(bool ok); | 179 void SignalNexeStarted(bool ok); |
180 | 180 |
181 // Establish an SrpcClient to the sel_ldr instance and load the nexe. | 181 // Establish an SrpcClient to the sel_ldr instance and start the nexe. |
182 // The nexe to be started is passed through |file_info|. | |
183 // This function must be called on the main thread. | 182 // This function must be called on the main thread. |
184 // This function must only be called once. | 183 // This function must only be called once. |
185 void LoadNexeAndStart(PP_NaClFileInfo file_info); | 184 void StartNexe(); |
186 | 185 |
187 // Starts the application channel to the nexe. | 186 // Starts the application channel to the nexe. |
188 SrpcClient* SetupAppChannel(); | 187 SrpcClient* SetupAppChannel(); |
189 | 188 |
190 bool RemoteLog(int severity, const nacl::string& msg); | 189 bool RemoteLog(int severity, const nacl::string& msg); |
191 Plugin* plugin() const { return plugin_; } | 190 Plugin* plugin() const { return plugin_; } |
192 void Shutdown(); | 191 void Shutdown(); |
193 | 192 |
194 // exit_status is -1 when invalid; when we set it, we will ensure | 193 // exit_status is -1 when invalid; when we set it, we will ensure |
195 // that it is non-negative (the portion of the exit status from the | 194 // that it is non-negative (the portion of the exit status from the |
196 // nexe that is transferred is the low 8 bits of the argument to the | 195 // nexe that is transferred is the low 8 bits of the argument to the |
197 // exit syscall). | 196 // exit syscall). |
198 int exit_status(); // const, but grabs mutex etc. | 197 int exit_status(); // const, but grabs mutex etc. |
199 void set_exit_status(int exit_status); | 198 void set_exit_status(int exit_status); |
200 | 199 |
201 nacl::string GetCrashLogOutput(); | 200 nacl::string GetCrashLogOutput(); |
202 | 201 |
203 bool main_service_runtime() const { return main_service_runtime_; } | 202 bool main_service_runtime() const { return main_service_runtime_; } |
204 | 203 |
205 private: | 204 private: |
206 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); | 205 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); |
207 bool LoadNexeAndStartInternal(const PP_NaClFileInfo& file_info); | 206 bool StartNexeInternal(); |
208 | 207 |
209 bool SetupCommandChannel(); | 208 bool SetupCommandChannel(); |
210 bool InitReverseService(); | 209 bool InitReverseService(); |
211 bool LoadModule(const PP_NaClFileInfo& file_info); | |
212 bool StartModule(); | 210 bool StartModule(); |
213 void ReapLogs(); | 211 void ReapLogs(); |
214 | 212 |
215 void ReportLoadError(const ErrorInfo& error_info); | 213 void ReportLoadError(const ErrorInfo& error_info); |
216 | 214 |
217 NaClSrpcChannel command_channel_; | 215 NaClSrpcChannel command_channel_; |
218 Plugin* plugin_; | 216 Plugin* plugin_; |
219 PP_Instance pp_instance_; | 217 PP_Instance pp_instance_; |
220 bool main_service_runtime_; | 218 bool main_service_runtime_; |
221 bool uses_nonsfi_mode_; | 219 bool uses_nonsfi_mode_; |
(...skipping 10 matching lines...) Expand all Loading... |
232 bool start_sel_ldr_done_; | 230 bool start_sel_ldr_done_; |
233 bool start_nexe_done_; | 231 bool start_nexe_done_; |
234 bool nexe_started_ok_; | 232 bool nexe_started_ok_; |
235 | 233 |
236 NaClHandle bootstrap_channel_; | 234 NaClHandle bootstrap_channel_; |
237 }; | 235 }; |
238 | 236 |
239 } // namespace plugin | 237 } // namespace plugin |
240 | 238 |
241 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 239 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
OLD | NEW |