| 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 16 matching lines...) Expand all Loading... |
| 27 #include "ppapi/native_client/src/trusted/plugin/utility.h" | 27 #include "ppapi/native_client/src/trusted/plugin/utility.h" |
| 28 | 28 |
| 29 struct NaClFileInfo; | 29 struct NaClFileInfo; |
| 30 | 30 |
| 31 namespace nacl { | 31 namespace nacl { |
| 32 class DescWrapper; | 32 class DescWrapper; |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 namespace plugin { | 35 namespace plugin { |
| 36 | 36 |
| 37 class OpenManifestEntryAsyncCallback; | |
| 38 class Plugin; | 37 class Plugin; |
| 39 class SrpcClient; | 38 class SrpcClient; |
| 40 class ServiceRuntime; | 39 class ServiceRuntime; |
| 41 | 40 |
| 42 // Struct of params used by StartSelLdr. Use a struct so that callback | 41 // Struct of params used by StartSelLdr. Use a struct so that callback |
| 43 // creation templates aren't overwhelmed with too many parameters. | 42 // creation templates aren't overwhelmed with too many parameters. |
| 44 struct SelLdrStartParams { | 43 struct SelLdrStartParams { |
| 45 SelLdrStartParams(const nacl::string& url, | 44 SelLdrStartParams(const nacl::string& url, |
| 46 bool uses_irt, | 45 bool uses_irt, |
| 47 bool uses_ppapi, | 46 bool uses_ppapi, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 bool enable_dyncode_syscalls; | 64 bool enable_dyncode_syscalls; |
| 66 bool enable_exception_handling; | 65 bool enable_exception_handling; |
| 67 bool enable_crash_throttling; | 66 bool enable_crash_throttling; |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 // Callback resources are essentially our continuation state. | 69 // Callback resources are essentially our continuation state. |
| 71 struct OpenManifestEntryResource { | 70 struct OpenManifestEntryResource { |
| 72 public: | 71 public: |
| 73 OpenManifestEntryResource(const std::string& target_url, | 72 OpenManifestEntryResource(const std::string& target_url, |
| 74 struct NaClFileInfo* finfo, | 73 struct NaClFileInfo* finfo, |
| 75 bool* op_complete, | 74 bool* op_complete) |
| 76 OpenManifestEntryAsyncCallback* callback) | |
| 77 : url(target_url), | 75 : url(target_url), |
| 78 file_info(finfo), | 76 file_info(finfo), |
| 79 op_complete_ptr(op_complete), | 77 op_complete_ptr(op_complete) {} |
| 80 callback(callback) {} | |
| 81 ~OpenManifestEntryResource(); | 78 ~OpenManifestEntryResource(); |
| 82 void MaybeRunCallback(int32_t pp_error); | |
| 83 | 79 |
| 84 std::string url; | 80 std::string url; |
| 85 struct NaClFileInfo* file_info; | 81 struct NaClFileInfo* file_info; |
| 86 PP_NaClFileInfo pp_file_info; | 82 PP_NaClFileInfo pp_file_info; |
| 87 bool* op_complete_ptr; | 83 bool* op_complete_ptr; |
| 88 OpenManifestEntryAsyncCallback* callback; | |
| 89 }; | 84 }; |
| 90 | 85 |
| 91 // Do not invoke from the main thread, since the main methods will | 86 // Do not invoke from the main thread, since the main methods will |
| 92 // invoke CallOnMainThread and then wait on a condvar for the task to | 87 // invoke CallOnMainThread and then wait on a condvar for the task to |
| 93 // complete: if invoked from the main thread, the main method not | 88 // complete: if invoked from the main thread, the main method not |
| 94 // returning (and thus unblocking the main thread) means that the | 89 // returning (and thus unblocking the main thread) means that the |
| 95 // main-thread continuation methods will never get called, and thus | 90 // main-thread continuation methods will never get called, and thus |
| 96 // we'd get a deadlock. | 91 // we'd get a deadlock. |
| 97 class PluginReverseInterface: public nacl::ReverseInterface { | 92 class PluginReverseInterface: public nacl::ReverseInterface { |
| 98 public: | 93 public: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 118 virtual void ReportCrash(); | 113 virtual void ReportCrash(); |
| 119 | 114 |
| 120 virtual void ReportExitStatus(int exit_status); | 115 virtual void ReportExitStatus(int exit_status); |
| 121 | 116 |
| 122 // TODO(teravest): Remove this method once it's gone from | 117 // TODO(teravest): Remove this method once it's gone from |
| 123 // nacl::ReverseInterface. | 118 // nacl::ReverseInterface. |
| 124 virtual int64_t RequestQuotaForWrite(nacl::string file_id, | 119 virtual int64_t RequestQuotaForWrite(nacl::string file_id, |
| 125 int64_t offset, | 120 int64_t offset, |
| 126 int64_t bytes_to_write); | 121 int64_t bytes_to_write); |
| 127 | 122 |
| 128 // This is a sibling of OpenManifestEntry. While OpenManifestEntry is | |
| 129 // a sync function and must be called on a non-main thread, | |
| 130 // OpenManifestEntryAsync must be called on the main thread. Upon completion | |
| 131 // (even on error), callback will be invoked. The caller has responsibility | |
| 132 // to keep the memory passed to info until callback is invoked. | |
| 133 void OpenManifestEntryAsync(const nacl::string& key, | |
| 134 struct NaClFileInfo* info, | |
| 135 OpenManifestEntryAsyncCallback* callback); | |
| 136 | |
| 137 protected: | 123 protected: |
| 138 virtual void OpenManifestEntry_MainThreadContinuation( | 124 virtual void OpenManifestEntry_MainThreadContinuation( |
| 139 OpenManifestEntryResource* p, | 125 OpenManifestEntryResource* p, |
| 140 int32_t err); | 126 int32_t err); |
| 141 | 127 |
| 142 virtual void StreamAsFile_MainThreadContinuation( | 128 virtual void StreamAsFile_MainThreadContinuation( |
| 143 OpenManifestEntryResource* p, | 129 OpenManifestEntryResource* p, |
| 144 int32_t result); | 130 int32_t result); |
| 145 | 131 |
| 146 private: | 132 private: |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // Mutex and CondVar to protect start_sel_ldr_done_ and nexe_started_. | 230 // Mutex and CondVar to protect start_sel_ldr_done_ and nexe_started_. |
| 245 NaClMutex mu_; | 231 NaClMutex mu_; |
| 246 NaClCondVar cond_; | 232 NaClCondVar cond_; |
| 247 bool start_sel_ldr_done_; | 233 bool start_sel_ldr_done_; |
| 248 bool nexe_started_; | 234 bool nexe_started_; |
| 249 }; | 235 }; |
| 250 | 236 |
| 251 } // namespace plugin | 237 } // namespace plugin |
| 252 | 238 |
| 253 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 239 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
| OLD | NEW |