Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/service_runtime.h

Issue 249183004: Implement open_resource in non-SFI mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 public: 80 public:
81 explicit PostMessageResource(std::string msg) 81 explicit PostMessageResource(std::string msg)
82 : message(msg) {} 82 : message(msg) {}
83 std::string message; 83 std::string message;
84 }; 84 };
85 85
86 struct OpenManifestEntryResource { 86 struct OpenManifestEntryResource {
87 public: 87 public:
88 OpenManifestEntryResource(const std::string& target_url, 88 OpenManifestEntryResource(const std::string& target_url,
89 struct NaClFileInfo* finfo, 89 struct NaClFileInfo* finfo,
90 bool* op_complete) 90 bool* op_complete,
91 const pp::CompletionCallback& callback)
91 : url(target_url), 92 : url(target_url),
92 file_info(finfo), 93 file_info(finfo),
93 op_complete_ptr(op_complete) {} 94 op_complete_ptr(op_complete),
95 callback(callback) {}
96 ~OpenManifestEntryResource() {
97 if (callback.pp_completion_callback().func)
98 callback.RunAndClear(PP_ERROR_ABORTED);
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 pp::CompletionCallback 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 virtual void ReportExitStatus(int exit_status); 172 virtual void ReportExitStatus(int exit_status);
166 173
167 virtual int64_t RequestQuotaForWrite(nacl::string file_id, 174 virtual int64_t RequestQuotaForWrite(nacl::string file_id,
168 int64_t offset, 175 int64_t offset,
169 int64_t bytes_to_write); 176 int64_t bytes_to_write);
170 177
171 void AddQuotaManagedFile(const nacl::string& file_id, 178 void AddQuotaManagedFile(const nacl::string& file_id,
172 const pp::FileIO& file_io); 179 const pp::FileIO& file_io);
173 void AddTempQuotaManagedFile(const nacl::string& file_id); 180 void AddTempQuotaManagedFile(const nacl::string& file_id);
174 181
182 // This is a sibling of OpenManifestEntry. While OpenManifestEntry is
183 // sync function and must be called on a non-main thread, this must be
184 // called on the main thread. Upon completion (even on error), callback will
185 // be invoked. The caller has responsibility to keep the memory passed to
186 // info until callback is invoked.
187 void OpenManifestEntryAsync(const nacl::string& key,
188 struct NaClFileInfo* info,
189 const pp::CompletionCallback& callback);
190
175 protected: 191 protected:
176 virtual void PostMessage_MainThreadContinuation(PostMessageResource* p, 192 virtual void PostMessage_MainThreadContinuation(PostMessageResource* p,
177 int32_t err); 193 int32_t err);
178 194
179 virtual void OpenManifestEntry_MainThreadContinuation( 195 virtual void OpenManifestEntry_MainThreadContinuation(
180 OpenManifestEntryResource* p, 196 OpenManifestEntryResource* p,
181 int32_t err); 197 int32_t err);
182 198
183 virtual void StreamAsFile_MainThreadContinuation( 199 virtual void StreamAsFile_MainThreadContinuation(
184 OpenManifestEntryResource* p, 200 OpenManifestEntryResource* p,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 int exit_status_; 303 int exit_status_;
288 bool start_sel_ldr_done_; 304 bool start_sel_ldr_done_;
289 305
290 PP_Var start_sel_ldr_error_message_; 306 PP_Var start_sel_ldr_error_message_;
291 pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_; 307 pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_;
292 }; 308 };
293 309
294 } // namespace plugin 310 } // namespace plugin
295 311
296 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_ 312 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SERVICE_RUNTIME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698