| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // invoke CallOnMainThread and then wait on a condvar for the task to | 89 // invoke CallOnMainThread and then wait on a condvar for the task to |
| 90 // complete: if invoked from the main thread, the main method not | 90 // complete: if invoked from the main thread, the main method not |
| 91 // returning (and thus unblocking the main thread) means that the | 91 // returning (and thus unblocking the main thread) means that the |
| 92 // main-thread continuation methods will never get called, and thus | 92 // main-thread continuation methods will never get called, and thus |
| 93 // we'd get a deadlock. | 93 // we'd get a deadlock. |
| 94 class PluginReverseInterface: public nacl::ReverseInterface { | 94 class PluginReverseInterface: public nacl::ReverseInterface { |
| 95 public: | 95 public: |
| 96 PluginReverseInterface(nacl::WeakRefAnchor* anchor, | 96 PluginReverseInterface(nacl::WeakRefAnchor* anchor, |
| 97 PP_Instance pp_instance, | 97 PP_Instance pp_instance, |
| 98 ServiceRuntime* service_runtime, | 98 ServiceRuntime* service_runtime, |
| 99 pp::CompletionCallback init_done_cb, | 99 pp::CompletionCallback init_done_cb); |
| 100 pp::CompletionCallback crash_cb); | |
| 101 | 100 |
| 102 virtual ~PluginReverseInterface(); | 101 virtual ~PluginReverseInterface(); |
| 103 | 102 |
| 104 void ShutDown(); | 103 void ShutDown(); |
| 105 | 104 |
| 106 virtual void DoPostMessage(nacl::string message); | 105 virtual void DoPostMessage(nacl::string message); |
| 107 | 106 |
| 108 virtual void StartupInitializationComplete(); | 107 virtual void StartupInitializationComplete(); |
| 109 | 108 |
| 110 virtual bool OpenManifestEntry(nacl::string url_key, | 109 virtual bool OpenManifestEntry(nacl::string url_key, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 132 private: | 131 private: |
| 133 nacl::WeakRefAnchor* anchor_; // holds a ref | 132 nacl::WeakRefAnchor* anchor_; // holds a ref |
| 134 // Should be used only in main thread in WeakRef-protected callbacks. | 133 // Should be used only in main thread in WeakRef-protected callbacks. |
| 135 PP_Instance pp_instance_; | 134 PP_Instance pp_instance_; |
| 136 ServiceRuntime* service_runtime_; | 135 ServiceRuntime* service_runtime_; |
| 137 NaClMutex mu_; | 136 NaClMutex mu_; |
| 138 NaClCondVar cv_; | 137 NaClCondVar cv_; |
| 139 bool shutting_down_; | 138 bool shutting_down_; |
| 140 | 139 |
| 141 pp::CompletionCallback init_done_cb_; | 140 pp::CompletionCallback init_done_cb_; |
| 142 pp::CompletionCallback crash_cb_; | |
| 143 }; | 141 }; |
| 144 | 142 |
| 145 // ServiceRuntime abstracts a NativeClient sel_ldr instance. | 143 // ServiceRuntime abstracts a NativeClient sel_ldr instance. |
| 146 class ServiceRuntime { | 144 class ServiceRuntime { |
| 147 public: | 145 public: |
| 148 // TODO(sehr): This class should also implement factory methods, using the | |
| 149 // Start method below. | |
| 150 ServiceRuntime(Plugin* plugin, | 146 ServiceRuntime(Plugin* plugin, |
| 151 PP_Instance pp_instance, | 147 PP_Instance pp_instance, |
| 152 bool main_service_runtime, | 148 bool main_service_runtime, |
| 153 bool uses_nonsfi_mode, | 149 bool uses_nonsfi_mode, |
| 154 pp::CompletionCallback init_done_cb, | 150 pp::CompletionCallback init_done_cb); |
| 155 pp::CompletionCallback crash_cb); | |
| 156 // The destructor terminates the sel_ldr process. | 151 // The destructor terminates the sel_ldr process. |
| 157 ~ServiceRuntime(); | 152 ~ServiceRuntime(); |
| 158 | 153 |
| 159 // Spawn the sel_ldr instance. | 154 // Spawn the sel_ldr instance. |
| 160 void StartSelLdr(const SelLdrStartParams& params, | 155 void StartSelLdr(const SelLdrStartParams& params, |
| 161 pp::CompletionCallback callback); | 156 pp::CompletionCallback callback); |
| 162 | 157 |
| 163 // If starting sel_ldr from a background thread, wait for sel_ldr to | 158 // If starting sel_ldr from a background thread, wait for sel_ldr to |
| 164 // actually start. Returns |false| if timed out waiting for the process | 159 // actually start. Returns |false| if timed out waiting for the process |
| 165 // to start. Otherwise, returns |true| if StartSelLdr is complete | 160 // to start. Otherwise, returns |true| if StartSelLdr is complete |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 bool start_sel_ldr_done_; | 216 bool start_sel_ldr_done_; |
| 222 bool start_nexe_done_; | 217 bool start_nexe_done_; |
| 223 bool nexe_started_ok_; | 218 bool nexe_started_ok_; |
| 224 | 219 |
| 225 NaClHandle bootstrap_channel_; | 220 NaClHandle bootstrap_channel_; |
| 226 }; | 221 }; |
| 227 | 222 |
| 228 } // namespace plugin | 223 } // namespace plugin |
| 229 | 224 |
| 230 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 225 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
| OLD | NEW |