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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 | 47 |
48 // Struct of params used by StartSelLdr. Use a struct so that callback | 48 // Struct of params used by StartSelLdr. Use a struct so that callback |
49 // creation templates aren't overwhelmed with too many parameters. | 49 // creation templates aren't overwhelmed with too many parameters. |
50 struct SelLdrStartParams { | 50 struct SelLdrStartParams { |
51 SelLdrStartParams(const nacl::string& url, | 51 SelLdrStartParams(const nacl::string& url, |
52 bool uses_irt, | 52 bool uses_irt, |
53 bool uses_ppapi, | 53 bool uses_ppapi, |
54 bool enable_dev_interfaces, | 54 bool enable_dev_interfaces, |
55 bool enable_dyncode_syscalls, | 55 bool enable_dyncode_syscalls, |
56 bool enable_exception_handling, | 56 bool enable_exception_handling, |
57 bool enable_crash_throttling) | 57 bool enable_crash_throttling, |
58 bool enable_nonsfi) | |
58 : url(url), | 59 : url(url), |
59 uses_irt(uses_irt), | 60 uses_irt(uses_irt), |
60 uses_ppapi(uses_ppapi), | 61 uses_ppapi(uses_ppapi), |
61 enable_dev_interfaces(enable_dev_interfaces), | 62 enable_dev_interfaces(enable_dev_interfaces), |
62 enable_dyncode_syscalls(enable_dyncode_syscalls), | 63 enable_dyncode_syscalls(enable_dyncode_syscalls), |
63 enable_exception_handling(enable_exception_handling), | 64 enable_exception_handling(enable_exception_handling), |
64 enable_crash_throttling(enable_crash_throttling) { | 65 enable_crash_throttling(enable_crash_throttling), |
66 enable_nonsfi(enable_nonsfi) { | |
65 } | 67 } |
66 nacl::string url; | 68 nacl::string url; |
67 bool uses_irt; | 69 bool uses_irt; |
68 bool uses_ppapi; | 70 bool uses_ppapi; |
69 bool enable_dev_interfaces; | 71 bool enable_dev_interfaces; |
70 bool enable_dyncode_syscalls; | 72 bool enable_dyncode_syscalls; |
71 bool enable_exception_handling; | 73 bool enable_exception_handling; |
72 bool enable_crash_throttling; | 74 bool enable_crash_throttling; |
75 bool enable_nonsfi; | |
73 }; | 76 }; |
74 | 77 |
75 // Callback resources are essentially our continuation state. | 78 // Callback resources are essentially our continuation state. |
76 struct PostMessageResource { | 79 struct PostMessageResource { |
77 public: | 80 public: |
78 explicit PostMessageResource(std::string msg) | 81 explicit PostMessageResource(std::string msg) |
79 : message(msg) {} | 82 : message(msg) {} |
80 std::string message; | 83 std::string message; |
81 }; | 84 }; |
82 | 85 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 pp::CompletionCallback crash_cb_; | 206 pp::CompletionCallback crash_cb_; |
204 }; | 207 }; |
205 | 208 |
206 // ServiceRuntime abstracts a NativeClient sel_ldr instance. | 209 // ServiceRuntime abstracts a NativeClient sel_ldr instance. |
207 class ServiceRuntime { | 210 class ServiceRuntime { |
208 public: | 211 public: |
209 // TODO(sehr): This class should also implement factory methods, using the | 212 // TODO(sehr): This class should also implement factory methods, using the |
210 // Start method below. | 213 // Start method below. |
211 ServiceRuntime(Plugin* plugin, | 214 ServiceRuntime(Plugin* plugin, |
212 const Manifest* manifest, | 215 const Manifest* manifest, |
213 bool should_report_uma, | 216 bool main_service_runtime, |
Mark Seaborn
2014/02/27 17:10:22
Renaming this should be commented in the commit me
hidehiko
2014/02/28 06:41:54
Ok, reverted.
Mark Seaborn
2014/03/04 04:03:32
Would you mind preparing a separate change to fix
hidehiko
2014/03/04 15:06:33
Sure, done. crrev.com/177353007.
On 2014/03/04 04
| |
217 bool nonsfi_enabled, | |
214 pp::CompletionCallback init_done_cb, | 218 pp::CompletionCallback init_done_cb, |
215 pp::CompletionCallback crash_cb); | 219 pp::CompletionCallback crash_cb); |
216 // The destructor terminates the sel_ldr process. | 220 // The destructor terminates the sel_ldr process. |
217 ~ServiceRuntime(); | 221 ~ServiceRuntime(); |
218 | 222 |
219 // Spawn the sel_ldr instance. | 223 // Spawn the sel_ldr instance. |
220 void StartSelLdr(const SelLdrStartParams& params, | 224 void StartSelLdr(const SelLdrStartParams& params, |
221 pp::CompletionCallback callback); | 225 pp::CompletionCallback callback); |
222 | 226 |
223 // If starting sel_ldr from a background thread, wait for sel_ldr to | 227 // If starting sel_ldr from a background thread, wait for sel_ldr to |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); | 263 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); |
260 bool LoadModule(nacl::DescWrapper* shm, ErrorInfo* error_info); | 264 bool LoadModule(nacl::DescWrapper* shm, ErrorInfo* error_info); |
261 bool InitReverseService(ErrorInfo* error_info); | 265 bool InitReverseService(ErrorInfo* error_info); |
262 bool StartModule(ErrorInfo* error_info); | 266 bool StartModule(ErrorInfo* error_info); |
263 void StartSelLdrContinuation(int32_t pp_error, | 267 void StartSelLdrContinuation(int32_t pp_error, |
264 pp::CompletionCallback callback); | 268 pp::CompletionCallback callback); |
265 | 269 |
266 NaClSrpcChannel command_channel_; | 270 NaClSrpcChannel command_channel_; |
267 Plugin* plugin_; | 271 Plugin* plugin_; |
268 bool main_service_runtime_; | 272 bool main_service_runtime_; |
273 bool nonsfi_enabled_; | |
269 nacl::ReverseService* reverse_service_; | 274 nacl::ReverseService* reverse_service_; |
270 nacl::scoped_ptr<nacl::SelLdrLauncherBase> subprocess_; | 275 nacl::scoped_ptr<nacl::SelLdrLauncherBase> subprocess_; |
271 | 276 |
272 nacl::WeakRefAnchor* anchor_; | 277 nacl::WeakRefAnchor* anchor_; |
273 | 278 |
274 PluginReverseInterface* rev_interface_; | 279 PluginReverseInterface* rev_interface_; |
275 | 280 |
276 // Mutex to protect exit_status_. | 281 // Mutex to protect exit_status_. |
277 // Also, in conjunction with cond_ it is used to signal when | 282 // Also, in conjunction with cond_ it is used to signal when |
278 // StartSelLdr is complete with either success or error. | 283 // StartSelLdr is complete with either success or error. |
279 NaClMutex mu_; | 284 NaClMutex mu_; |
280 NaClCondVar cond_; | 285 NaClCondVar cond_; |
281 int exit_status_; | 286 int exit_status_; |
282 bool start_sel_ldr_done_; | 287 bool start_sel_ldr_done_; |
283 | 288 |
284 PP_Var start_sel_ldr_error_message_; | 289 PP_Var start_sel_ldr_error_message_; |
285 pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_; | 290 pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_; |
286 }; | 291 }; |
287 | 292 |
288 } // namespace plugin | 293 } // namespace plugin |
289 | 294 |
290 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 295 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
OLD | NEW |