| 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 |
| 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
| 12 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 12 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
| 13 | 13 |
| 14 #include "native_client/src/include/nacl_macros.h" | 14 #include "native_client/src/include/nacl_macros.h" |
| 15 #include "native_client/src/include/nacl_scoped_ptr.h" | 15 #include "native_client/src/include/nacl_scoped_ptr.h" |
| 16 #include "native_client/src/include/nacl_string.h" | 16 #include "native_client/src/include/nacl_string.h" |
| 17 #include "native_client/src/shared/imc/nacl_imc.h" | |
| 18 #include "native_client/src/shared/platform/nacl_sync.h" | 17 #include "native_client/src/shared/platform/nacl_sync.h" |
| 19 #include "native_client/src/shared/srpc/nacl_srpc.h" | 18 #include "native_client/src/shared/srpc/nacl_srpc.h" |
| 19 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
| 20 #include "native_client/src/trusted/plugin/utility.h" |
| 20 #include "native_client/src/trusted/reverse_service/reverse_service.h" | 21 #include "native_client/src/trusted/reverse_service/reverse_service.h" |
| 21 #include "native_client/src/trusted/plugin/utility.h" | |
| 22 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | |
| 23 #include "native_client/src/trusted/weak_ref/weak_ref.h" | 22 #include "native_client/src/trusted/weak_ref/weak_ref.h" |
| 24 | 23 |
| 25 #include "ppapi/cpp/completion_callback.h" | 24 #include "ppapi/cpp/completion_callback.h" |
| 26 | 25 |
| 27 namespace nacl { | 26 namespace nacl { |
| 28 class DescWrapper; | 27 class DescWrapper; |
| 29 struct SelLdrLauncher; | 28 struct SelLdrLauncher; |
| 30 } // namespace | 29 } // namespace |
| 31 | 30 |
| 32 namespace plugin { | 31 namespace plugin { |
| 33 | 32 |
| 34 class BrowserInterface; | |
| 35 class ErrorInfo; | 33 class ErrorInfo; |
| 36 class Manifest; | 34 class Manifest; |
| 37 class Plugin; | 35 class Plugin; |
| 38 class SrpcClient; | 36 class SrpcClient; |
| 39 class ServiceRuntime; | 37 class ServiceRuntime; |
| 40 | 38 |
| 41 // Callback resources are essentially our continuation state. | 39 // Callback resources are essentially our continuation state. |
| 42 | 40 |
| 43 struct LogToJavaScriptConsoleResource { | 41 struct LogToJavaScriptConsoleResource { |
| 44 public: | 42 public: |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 Plugin* plugin() const { return plugin_; } | 180 Plugin* plugin() const { return plugin_; } |
| 183 void Shutdown(); | 181 void Shutdown(); |
| 184 | 182 |
| 185 // exit_status is -1 when invalid; when we set it, we will ensure | 183 // exit_status is -1 when invalid; when we set it, we will ensure |
| 186 // that it is non-negative (the portion of the exit status from the | 184 // that it is non-negative (the portion of the exit status from the |
| 187 // nexe that is transferred is the low 8 bits of the argument to the | 185 // nexe that is transferred is the low 8 bits of the argument to the |
| 188 // exit syscall). | 186 // exit syscall). |
| 189 int exit_status(); // const, but grabs mutex etc. | 187 int exit_status(); // const, but grabs mutex etc. |
| 190 void set_exit_status(int exit_status); | 188 void set_exit_status(int exit_status); |
| 191 | 189 |
| 192 nacl::DescWrapper* async_receive_desc() { return async_receive_desc_.get(); } | |
| 193 nacl::DescWrapper* async_send_desc() { return async_send_desc_.get(); } | |
| 194 | |
| 195 private: | 190 private: |
| 196 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); | 191 NACL_DISALLOW_COPY_AND_ASSIGN(ServiceRuntime); |
| 197 bool InitCommunication(nacl::DescWrapper* shm, ErrorInfo* error_info); | 192 bool InitCommunication(nacl::DescWrapper* shm, ErrorInfo* error_info); |
| 198 | 193 |
| 199 NaClSrpcChannel command_channel_; | 194 NaClSrpcChannel command_channel_; |
| 200 Plugin* plugin_; | 195 Plugin* plugin_; |
| 201 bool should_report_uma_; | 196 bool should_report_uma_; |
| 202 BrowserInterface* browser_interface_; | |
| 203 nacl::ReverseService* reverse_service_; | 197 nacl::ReverseService* reverse_service_; |
| 204 nacl::scoped_ptr<nacl::SelLdrLauncher> subprocess_; | 198 nacl::scoped_ptr<nacl::SelLdrLauncher> subprocess_; |
| 205 | 199 |
| 206 // We need two IMC sockets rather than one because IMC sockets are | |
| 207 // not full-duplex on Windows. | |
| 208 // See http://code.google.com/p/nativeclient/issues/detail?id=690. | |
| 209 // TODO(mseaborn): We should not have to work around this. | |
| 210 nacl::scoped_ptr<nacl::DescWrapper> async_receive_desc_; | |
| 211 nacl::scoped_ptr<nacl::DescWrapper> async_send_desc_; | |
| 212 | |
| 213 nacl::WeakRefAnchor* anchor_; | 200 nacl::WeakRefAnchor* anchor_; |
| 214 | 201 |
| 215 PluginReverseInterface* rev_interface_; | 202 PluginReverseInterface* rev_interface_; |
| 216 | 203 |
| 217 NaClMutex mu_; | 204 NaClMutex mu_; |
| 218 int exit_status_; | 205 int exit_status_; |
| 219 }; | 206 }; |
| 220 | 207 |
| 221 } // namespace plugin | 208 } // namespace plugin |
| 222 | 209 |
| 223 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 210 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
| OLD | NEW |