namespace plugin {
class ErrorInfo;
-class Manifest;
+class OpenManifestEntryAsyncCallback;
class Plugin;
class SrpcClient;
class ServiceRuntime;
public:
OpenManifestEntryResource(const std::string& target_url,
struct NaClFileInfo* finfo,
- bool* op_complete)
+ bool* op_complete,
+ OpenManifestEntryAsyncCallback* callback)
: url(target_url),
file_info(finfo),
- op_complete_ptr(op_complete) {}
+ op_complete_ptr(op_complete),
+ callback(callback) {}
+ ~OpenManifestEntryResource();
+ void MaybeRunCallback(int32_t pp_error);
+
std::string url;
struct NaClFileInfo* file_info;
bool* op_complete_ptr;
+ OpenManifestEntryAsyncCallback* callback;
};
struct CloseManifestEntryResource {
public:
PluginReverseInterface(nacl::WeakRefAnchor* anchor,
Plugin* plugin,
- const Manifest* manifest,
+ int32_t manifest_id,
ServiceRuntime* service_runtime,
pp::CompletionCallback init_done_cb,
pp::CompletionCallback crash_cb);
virtual void StartupInitializationComplete();
- virtual bool EnumerateManifestKeys(std::set<nacl::string>* out_keys);
-
virtual bool OpenManifestEntry(nacl::string url_key,
struct NaClFileInfo *info);
const pp::FileIO& file_io);
void AddTempQuotaManagedFile(const nacl::string& file_id);
+ // This is a sibling of OpenManifestEntry. While OpenManifestEntry is
+ // a sync function and must be called on a non-main thread,
+ // OpenManifestEntryAsync 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,
+ OpenManifestEntryAsyncCallback* callback);
+
protected:
virtual void PostMessage_MainThreadContinuation(PostMessageResource* p,
int32_t err);
nacl::WeakRefAnchor* anchor_; // holds a ref
Plugin* plugin_; // value may be copied, but should be used only in
// main thread in WeakRef-protected callbacks.
- const Manifest* manifest_;
+ int32_t manifest_id_;
ServiceRuntime* service_runtime_;
NaClMutex mu_;
NaClCondVar cv_;
// TODO(sehr): This class should also implement factory methods, using the
// Start method below.
ServiceRuntime(Plugin* plugin,
- const Manifest* manifest,
+ int32_t manifest_id,
bool main_service_runtime,
bool uses_nonsfi_mode,
pp::CompletionCallback init_done_cb,