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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 callback(callback) {} | 88 callback(callback) {} |
89 ~OpenManifestEntryResource(); | 89 ~OpenManifestEntryResource(); |
90 void MaybeRunCallback(int32_t pp_error); | 90 void MaybeRunCallback(int32_t pp_error); |
91 | 91 |
92 std::string url; | 92 std::string url; |
93 struct NaClFileInfo* file_info; | 93 struct NaClFileInfo* file_info; |
94 bool* op_complete_ptr; | 94 bool* op_complete_ptr; |
95 OpenManifestEntryAsyncCallback* callback; | 95 OpenManifestEntryAsyncCallback* callback; |
96 }; | 96 }; |
97 | 97 |
98 struct CloseManifestEntryResource { | |
99 public: | |
100 CloseManifestEntryResource(int32_t desc_to_close, | |
101 bool* op_complete, | |
102 bool* op_result) | |
103 : desc(desc_to_close), | |
104 op_complete_ptr(op_complete), | |
105 op_result_ptr(op_result) {} | |
106 | |
107 int32_t desc; | |
108 bool* op_complete_ptr; | |
109 bool* op_result_ptr; | |
110 }; | |
111 | |
112 struct QuotaRequest { | |
113 public: | |
114 QuotaRequest(PP_Resource pp_resource, | |
115 int64_t start_offset, | |
116 int64_t quota_bytes_requested, | |
117 int64_t* quota_bytes_granted, | |
118 bool* op_complete) | |
119 : resource(pp_resource), | |
120 offset(start_offset), | |
121 bytes_requested(quota_bytes_requested), | |
122 bytes_granted(quota_bytes_granted), | |
123 op_complete_ptr(op_complete) { } | |
124 | |
125 PP_Resource resource; | |
126 int64_t offset; | |
127 int64_t bytes_requested; | |
128 int64_t* bytes_granted; | |
129 bool* op_complete_ptr; | |
130 }; | |
131 | |
132 // Do not invoke from the main thread, since the main methods will | 98 // Do not invoke from the main thread, since the main methods will |
133 // invoke CallOnMainThread and then wait on a condvar for the task to | 99 // invoke CallOnMainThread and then wait on a condvar for the task to |
134 // complete: if invoked from the main thread, the main method not | 100 // complete: if invoked from the main thread, the main method not |
135 // returning (and thus unblocking the main thread) means that the | 101 // returning (and thus unblocking the main thread) means that the |
136 // main-thread continuation methods will never get called, and thus | 102 // main-thread continuation methods will never get called, and thus |
137 // we'd get a deadlock. | 103 // we'd get a deadlock. |
138 class PluginReverseInterface: public nacl::ReverseInterface { | 104 class PluginReverseInterface: public nacl::ReverseInterface { |
139 public: | 105 public: |
140 PluginReverseInterface(nacl::WeakRefAnchor* anchor, | 106 PluginReverseInterface(nacl::WeakRefAnchor* anchor, |
141 Plugin* plugin, | 107 Plugin* plugin, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 146 |
181 protected: | 147 protected: |
182 virtual void OpenManifestEntry_MainThreadContinuation( | 148 virtual void OpenManifestEntry_MainThreadContinuation( |
183 OpenManifestEntryResource* p, | 149 OpenManifestEntryResource* p, |
184 int32_t err); | 150 int32_t err); |
185 | 151 |
186 virtual void StreamAsFile_MainThreadContinuation( | 152 virtual void StreamAsFile_MainThreadContinuation( |
187 OpenManifestEntryResource* p, | 153 OpenManifestEntryResource* p, |
188 int32_t result); | 154 int32_t result); |
189 | 155 |
190 virtual void CloseManifestEntry_MainThreadContinuation( | |
191 CloseManifestEntryResource* cls, | |
192 int32_t err); | |
193 | |
194 private: | 156 private: |
195 nacl::WeakRefAnchor* anchor_; // holds a ref | 157 nacl::WeakRefAnchor* anchor_; // holds a ref |
196 Plugin* plugin_; // value may be copied, but should be used only in | 158 Plugin* plugin_; // value may be copied, but should be used only in |
197 // main thread in WeakRef-protected callbacks. | 159 // main thread in WeakRef-protected callbacks. |
198 int32_t manifest_id_; | 160 int32_t manifest_id_; |
199 ServiceRuntime* service_runtime_; | 161 ServiceRuntime* service_runtime_; |
200 NaClMutex mu_; | 162 NaClMutex mu_; |
201 NaClCondVar cv_; | 163 NaClCondVar cv_; |
202 std::set<int64_t> quota_files_; | 164 std::set<int64_t> quota_files_; |
203 bool shutting_down_; | 165 bool shutting_down_; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 int exit_status_; | 252 int exit_status_; |
291 bool start_sel_ldr_done_; | 253 bool start_sel_ldr_done_; |
292 | 254 |
293 PP_Var start_sel_ldr_error_message_; | 255 PP_Var start_sel_ldr_error_message_; |
294 pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_; | 256 pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_; |
295 }; | 257 }; |
296 | 258 |
297 } // namespace plugin | 259 } // namespace plugin |
298 | 260 |
299 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 261 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
OLD | NEW |