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 23 matching lines...) Expand all Loading... |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 namespace pp { | 36 namespace pp { |
37 class FileIO; | 37 class FileIO; |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 namespace plugin { | 40 namespace plugin { |
41 | 41 |
42 class ErrorInfo; | 42 class ErrorInfo; |
43 class Manifest; | 43 class Manifest; |
| 44 class OpenManifestEntryAsyncCallback; |
44 class Plugin; | 45 class Plugin; |
45 class SrpcClient; | 46 class SrpcClient; |
46 class ServiceRuntime; | 47 class ServiceRuntime; |
47 | 48 |
48 // Struct of params used by StartSelLdr. Use a struct so that callback | 49 // Struct of params used by StartSelLdr. Use a struct so that callback |
49 // creation templates aren't overwhelmed with too many parameters. | 50 // creation templates aren't overwhelmed with too many parameters. |
50 struct SelLdrStartParams { | 51 struct SelLdrStartParams { |
51 SelLdrStartParams(const nacl::string& url, | 52 SelLdrStartParams(const nacl::string& url, |
52 bool uses_irt, | 53 bool uses_irt, |
53 bool uses_ppapi, | 54 bool uses_ppapi, |
(...skipping 26 matching lines...) Expand all Loading... |
80 public: | 81 public: |
81 explicit PostMessageResource(std::string msg) | 82 explicit PostMessageResource(std::string msg) |
82 : message(msg) {} | 83 : message(msg) {} |
83 std::string message; | 84 std::string message; |
84 }; | 85 }; |
85 | 86 |
86 struct OpenManifestEntryResource { | 87 struct OpenManifestEntryResource { |
87 public: | 88 public: |
88 OpenManifestEntryResource(const std::string& target_url, | 89 OpenManifestEntryResource(const std::string& target_url, |
89 struct NaClFileInfo* finfo, | 90 struct NaClFileInfo* finfo, |
90 bool* op_complete) | 91 bool* op_complete, |
| 92 OpenManifestEntryAsyncCallback* callback) |
91 : url(target_url), | 93 : url(target_url), |
92 file_info(finfo), | 94 file_info(finfo), |
93 op_complete_ptr(op_complete) {} | 95 op_complete_ptr(op_complete), |
| 96 callback(callback) {} |
| 97 ~OpenManifestEntryResource(); |
| 98 void MaybeRunCallback(int32_t pp_error); |
| 99 |
94 std::string url; | 100 std::string url; |
95 struct NaClFileInfo* file_info; | 101 struct NaClFileInfo* file_info; |
96 bool* op_complete_ptr; | 102 bool* op_complete_ptr; |
| 103 OpenManifestEntryAsyncCallback* callback; |
97 }; | 104 }; |
98 | 105 |
99 struct CloseManifestEntryResource { | 106 struct CloseManifestEntryResource { |
100 public: | 107 public: |
101 CloseManifestEntryResource(int32_t desc_to_close, | 108 CloseManifestEntryResource(int32_t desc_to_close, |
102 bool* op_complete, | 109 bool* op_complete, |
103 bool* op_result) | 110 bool* op_result) |
104 : desc(desc_to_close), | 111 : desc(desc_to_close), |
105 op_complete_ptr(op_complete), | 112 op_complete_ptr(op_complete), |
106 op_result_ptr(op_result) {} | 113 op_result_ptr(op_result) {} |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 virtual void ReportExitStatus(int exit_status); | 170 virtual void ReportExitStatus(int exit_status); |
164 | 171 |
165 virtual int64_t RequestQuotaForWrite(nacl::string file_id, | 172 virtual int64_t RequestQuotaForWrite(nacl::string file_id, |
166 int64_t offset, | 173 int64_t offset, |
167 int64_t bytes_to_write); | 174 int64_t bytes_to_write); |
168 | 175 |
169 void AddQuotaManagedFile(const nacl::string& file_id, | 176 void AddQuotaManagedFile(const nacl::string& file_id, |
170 const pp::FileIO& file_io); | 177 const pp::FileIO& file_io); |
171 void AddTempQuotaManagedFile(const nacl::string& file_id); | 178 void AddTempQuotaManagedFile(const nacl::string& file_id); |
172 | 179 |
| 180 // This is a sibling of OpenManifestEntry. While OpenManifestEntry is |
| 181 // a sync function and must be called on a non-main thread, |
| 182 // OpenManifestEntryAsync must be called on the main thread. Upon completion |
| 183 // (even on error), callback will be invoked. The caller has responsibility |
| 184 // to keep the memory passed to info until callback is invoked. |
| 185 void OpenManifestEntryAsync(const nacl::string& key, |
| 186 struct NaClFileInfo* info, |
| 187 OpenManifestEntryAsyncCallback* callback); |
| 188 |
173 protected: | 189 protected: |
174 virtual void PostMessage_MainThreadContinuation(PostMessageResource* p, | 190 virtual void PostMessage_MainThreadContinuation(PostMessageResource* p, |
175 int32_t err); | 191 int32_t err); |
176 | 192 |
177 virtual void OpenManifestEntry_MainThreadContinuation( | 193 virtual void OpenManifestEntry_MainThreadContinuation( |
178 OpenManifestEntryResource* p, | 194 OpenManifestEntryResource* p, |
179 int32_t err); | 195 int32_t err); |
180 | 196 |
181 virtual void StreamAsFile_MainThreadContinuation( | 197 virtual void StreamAsFile_MainThreadContinuation( |
182 OpenManifestEntryResource* p, | 198 OpenManifestEntryResource* p, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 int exit_status_; | 301 int exit_status_; |
286 bool start_sel_ldr_done_; | 302 bool start_sel_ldr_done_; |
287 | 303 |
288 PP_Var start_sel_ldr_error_message_; | 304 PP_Var start_sel_ldr_error_message_; |
289 pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_; | 305 pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_; |
290 }; | 306 }; |
291 | 307 |
292 } // namespace plugin | 308 } // namespace plugin |
293 | 309 |
294 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ | 310 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ |
OLD | NEW |