| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 PP_Instance pp_instance, | 49 PP_Instance pp_instance, |
| 50 bool main_service_runtime, | 50 bool main_service_runtime, |
| 51 bool uses_nonsfi_mode); | 51 bool uses_nonsfi_mode); |
| 52 // The destructor terminates the sel_ldr process. | 52 // The destructor terminates the sel_ldr process. |
| 53 ~ServiceRuntime(); | 53 ~ServiceRuntime(); |
| 54 | 54 |
| 55 // Spawn the sel_ldr instance. | 55 // Spawn the sel_ldr instance. |
| 56 void StartSelLdr(const SelLdrStartParams& params, | 56 void StartSelLdr(const SelLdrStartParams& params, |
| 57 pp::CompletionCallback callback); | 57 pp::CompletionCallback callback); |
| 58 | 58 |
| 59 // If starting sel_ldr from a background thread, wait for sel_ldr to | |
| 60 // actually start. Returns |false| if timed out waiting for the process | |
| 61 // to start. Otherwise, returns |true| if StartSelLdr is complete | |
| 62 // (either successfully or unsuccessfully). | |
| 63 bool WaitForSelLdrStart(); | |
| 64 | |
| 65 // Signal to waiting threads that StartSelLdr is complete (either | |
| 66 // successfully or unsuccessfully). | |
| 67 void SignalStartSelLdrDone(); | |
| 68 | |
| 69 // If starting the nexe from a background thread, wait for the nexe to | |
| 70 // actually start. Returns |true| is the nexe started successfully. | |
| 71 bool WaitForNexeStart(); | |
| 72 | |
| 73 // Returns |true| if WaitForSelLdrStart() timed out. | |
| 74 bool SelLdrWaitTimedOut(); | |
| 75 | |
| 76 // Signal to waiting threads that LoadNexeAndStart is complete (either | |
| 77 // successfully or unsuccessfully). | |
| 78 void SignalNexeStarted(bool ok); | |
| 79 | |
| 80 // Establish an SrpcClient to the sel_ldr instance and start the nexe. | 59 // Establish an SrpcClient to the sel_ldr instance and start the nexe. |
| 81 // This function must be called on the main thread. | 60 // This function must be called on the main thread. |
| 82 // This function must only be called once. | 61 // This function must only be called once. |
| 83 void StartNexe(); | 62 void StartNexe(); |
| 84 | 63 |
| 85 // Starts the application channel to the nexe. | 64 // Starts the application channel to the nexe. |
| 86 SrpcClient* SetupAppChannel(); | 65 SrpcClient* SetupAppChannel(); |
| 87 | 66 |
| 88 Plugin* plugin() const { return plugin_; } | 67 Plugin* plugin() const { return plugin_; } |
| 89 void Shutdown(); | 68 void Shutdown(); |
| 90 | 69 |
| 91 bool main_service_runtime() const { return main_service_runtime_; } | 70 bool main_service_runtime() const { return main_service_runtime_; } |
| 92 | 71 |
| 93 private: | 72 private: |
| 94 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); | 73 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); |
| 95 | 74 |
| 96 bool SetupCommandChannel(); | 75 bool SetupCommandChannel(); |
| 97 | 76 |
| 98 void ReportLoadError(const ErrorInfo& error_info); | 77 void ReportLoadError(const ErrorInfo& error_info); |
| 99 | 78 |
| 100 NaClSrpcChannel command_channel_; | 79 NaClSrpcChannel command_channel_; |
| 101 Plugin* plugin_; | 80 Plugin* plugin_; |
| 102 PP_Instance pp_instance_; | 81 PP_Instance pp_instance_; |
| 103 bool main_service_runtime_; | 82 bool main_service_runtime_; |
| 104 bool uses_nonsfi_mode_; | 83 bool uses_nonsfi_mode_; |
| 105 nacl::scoped_ptr<SelLdrLauncherChrome> subprocess_; | 84 nacl::scoped_ptr<SelLdrLauncherChrome> subprocess_; |
| 106 | 85 |
| 107 // Mutex and CondVar to protect start_sel_ldr_done_ and nexe_started_. | |
| 108 NaClMutex mu_; | |
| 109 NaClCondVar cond_; | |
| 110 bool start_sel_ldr_done_; | |
| 111 bool sel_ldr_wait_timed_out_; | |
| 112 bool start_nexe_done_; | |
| 113 bool nexe_started_ok_; | |
| 114 | |
| 115 NaClHandle bootstrap_channel_; | 86 NaClHandle bootstrap_channel_; |
| 116 }; | 87 }; |
| 117 | 88 |
| 118 } // namespace plugin | 89 } // namespace plugin |
| 119 | 90 |
| 120 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_SERVICE_RUNTIME_H_ | 91 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_SERVICE_RUNTIME_H_ |
| OLD | NEW |