Index: ppapi/native_client/src/trusted/plugin/service_runtime.h |
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h |
index 79ef7c2abd06956d3d0e141afc5067782bd77430..ab0bca2f60de80994d658fd76b04e2fe8ead25c2 100644 |
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.h |
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h |
@@ -87,13 +87,20 @@ struct OpenManifestEntryResource { |
public: |
OpenManifestEntryResource(const std::string& target_url, |
struct NaClFileInfo* finfo, |
- bool* op_complete) |
+ bool* op_complete, |
+ const pp::CompletionCallback& callback) |
: url(target_url), |
file_info(finfo), |
- op_complete_ptr(op_complete) {} |
+ op_complete_ptr(op_complete), |
+ callback(callback) {} |
+ ~OpenManifestEntryResource() { |
+ if (callback.pp_completion_callback().func) |
+ callback.RunAndClear(PP_ERROR_ABORTED); |
+ } |
std::string url; |
struct NaClFileInfo* file_info; |
bool* op_complete_ptr; |
+ pp::CompletionCallback callback; |
}; |
struct CloseManifestEntryResource { |
@@ -172,6 +179,15 @@ class PluginReverseInterface: public nacl::ReverseInterface { |
const pp::FileIO& file_io); |
void AddTempQuotaManagedFile(const nacl::string& file_id); |
+ // This is a sibling of OpenManifestEntry. While OpenManifestEntry is |
+ // sync function and must be called on a non-main thread, this must be |
+ // called on the main thread. Upon completion (even on error), callback will |
+ // be invoked. The caller has responsibility to keep the memory passed to |
+ // info until callback is invoked. |
+ void OpenManifestEntryAsync(const nacl::string& key, |
+ struct NaClFileInfo* info, |
+ const pp::CompletionCallback& callback); |
+ |
protected: |
virtual void PostMessage_MainThreadContinuation(PostMessageResource* p, |
int32_t err); |