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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 // actually start. Returns |false| if timed out waiting for the process | 174 // actually start. Returns |false| if timed out waiting for the process |
175 // to start. Otherwise, returns |true| if StartSelLdr is complete | 175 // to start. Otherwise, returns |true| if StartSelLdr is complete |
176 // (either successfully or unsuccessfully). | 176 // (either successfully or unsuccessfully). |
177 bool WaitForSelLdrStart(); | 177 bool WaitForSelLdrStart(); |
178 | 178 |
179 // Signal to waiting threads that StartSelLdr is complete (either | 179 // Signal to waiting threads that StartSelLdr is complete (either |
180 // successfully or unsuccessfully). | 180 // successfully or unsuccessfully). |
181 void SignalStartSelLdrDone(); | 181 void SignalStartSelLdrDone(); |
182 | 182 |
183 // If starting the nexe from a background thread, wait for the nexe to | 183 // If starting the nexe from a background thread, wait for the nexe to |
184 // actually start. | 184 // actually start. Returns |true| is the nexe started successfully. |
185 void WaitForNexeStart(); | 185 bool WaitForNexeStart(); |
186 | 186 |
187 // Signal to waiting threads that LoadNexeAndStart is complete (either | 187 // Signal to waiting threads that LoadNexeAndStart is complete (either |
188 // successfully or unsuccessfully). | 188 // successfully or unsuccessfully). |
189 void SignalNexeStarted(); | 189 void SignalNexeStarted(bool ok); |
190 | 190 |
191 // Establish an SrpcClient to the sel_ldr instance and load the nexe. | 191 // Establish an SrpcClient to the sel_ldr instance and load the nexe. |
192 // The nexe to be started is passed through |file_info|. | 192 // The nexe to be started is passed through |file_info|. |
193 // Upon completion |callback| is invoked with status code. | |
194 // This function must be called on the main thread. | 193 // This function must be called on the main thread. |
195 void LoadNexeAndStart(PP_NaClFileInfo file_info, | 194 void LoadNexeAndStart(PP_NaClFileInfo file_info); |
hidehiko
2014/06/20 04:21:38
nit: Could you also add short comment that this fu
Nick Bray (chromium)
2014/06/20 17:10:42
Done.
| |
196 const pp::CompletionCallback& callback); | |
197 | 195 |
198 // Starts the application channel to the nexe. | 196 // Starts the application channel to the nexe. |
199 SrpcClient* SetupAppChannel(); | 197 SrpcClient* SetupAppChannel(); |
200 | 198 |
201 bool Log(int severity, const nacl::string& msg); | 199 bool RemoteLog(int severity, const nacl::string& msg); |
202 Plugin* plugin() const { return plugin_; } | 200 Plugin* plugin() const { return plugin_; } |
203 void Shutdown(); | 201 void Shutdown(); |
204 | 202 |
205 // exit_status is -1 when invalid; when we set it, we will ensure | 203 // exit_status is -1 when invalid; when we set it, we will ensure |
206 // that it is non-negative (the portion of the exit status from the | 204 // that it is non-negative (the portion of the exit status from the |
207 // nexe that is transferred is the low 8 bits of the argument to the | 205 // nexe that is transferred is the low 8 bits of the argument to the |
208 // exit syscall). | 206 // exit syscall). |
209 int exit_status(); // const, but grabs mutex etc. | 207 int exit_status(); // const, but grabs mutex etc. |
210 void set_exit_status(int exit_status); | 208 void set_exit_status(int exit_status); |
211 | 209 |
212 nacl::string GetCrashLogOutput(); | 210 nacl::string GetCrashLogOutput(); |
213 | 211 |
214 bool main_service_runtime() const { return main_service_runtime_; } | 212 bool main_service_runtime() const { return main_service_runtime_; } |
215 | 213 |
216 private: | 214 private: |
217 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); | 215 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); |
218 struct LoadNexeAndStartData; | 216 bool LoadNexeAndStartInternal(PP_NaClFileInfo file_info); |
hidehiko
2014/06/20 04:21:38
nit: "const PP_NaClFileInfo&".
Nick Bray (chromium)
2014/06/20 17:10:42
Done.
| |
219 void LoadNexeAndStartAfterLoadModule( | |
220 LoadNexeAndStartData* data, int32_t pp_error); | |
221 void DidLoadNexeAndStart(LoadNexeAndStartData* data, int32_t pp_error); | |
222 | 217 |
223 bool SetupCommandChannel(); | 218 bool SetupCommandChannel(); |
224 bool InitReverseService(); | 219 bool InitReverseService(); |
225 void LoadModule(PP_NaClFileInfo file_info, | 220 bool LoadModule(PP_NaClFileInfo file_info); |
hidehiko
2014/06/20 04:21:38
nit: "const PP_NaClFileInfo&".
Nick Bray (chromium)
2014/06/20 17:10:42
Done.
| |
226 pp::CompletionCallback callback); | |
227 void DidLoadModule(pp::CompletionCallback callback, int32_t pp_error); | |
228 bool StartModule(); | 221 bool StartModule(); |
222 void ReapLogs(); | |
229 | 223 |
230 NaClSrpcChannel command_channel_; | 224 NaClSrpcChannel command_channel_; |
231 Plugin* plugin_; | 225 Plugin* plugin_; |
232 bool main_service_runtime_; | 226 bool main_service_runtime_; |
233 bool uses_nonsfi_mode_; | 227 bool uses_nonsfi_mode_; |
234 nacl::ReverseService* reverse_service_; | 228 nacl::ReverseService* reverse_service_; |
235 nacl::scoped_ptr<nacl::SelLdrLauncherBase> subprocess_; | 229 nacl::scoped_ptr<nacl::SelLdrLauncherBase> subprocess_; |
236 | 230 |
237 nacl::WeakRefAnchor* anchor_; | 231 nacl::WeakRefAnchor* anchor_; |
238 | 232 |
239 PluginReverseInterface* rev_interface_; | 233 PluginReverseInterface* rev_interface_; |
240 | 234 |
241 // Mutex and CondVar to protect start_sel_ldr_done_ and nexe_started_. | 235 // Mutex and CondVar to protect start_sel_ldr_done_ and nexe_started_. |
242 NaClMutex mu_; | 236 NaClMutex mu_; |
243 NaClCondVar cond_; | 237 NaClCondVar cond_; |
244 bool start_sel_ldr_done_; | 238 bool start_sel_ldr_done_; |
245 bool nexe_started_; | 239 bool start_nexe_done_; |
240 bool nexe_started_ok_; | |
246 }; | 241 }; |
247 | 242 |
248 } // namespace plugin | 243 } // namespace plugin |
249 | 244 |
250 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 245 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
OLD | NEW |