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

Unified Diff: ppapi/native_client/src/trusted/plugin/service_runtime.cc

Issue 318463002: Revert of Pepper: Refactor OpenManifestEntry. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/c/private/ppb_nacl_private.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/trusted/plugin/service_runtime.cc
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index bd1cfe5e794134a429ca1090f3439f94ab51441a..6a7b9b52ffb641575b63ad3c861e48dc0507c50e 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -314,11 +314,57 @@
int32_t err) {
UNREFERENCED_PARAMETER(err);
// CallOnMainThread continuations always called with err == PP_OK.
+
NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n");
+
+ PP_Var pp_mapped_url;
+ PP_PNaClOptions pnacl_options = {PP_FALSE, PP_FALSE, 2};
+ if (!GetNaClInterface()->ManifestResolveKey(
+ plugin_->pp_instance(),
+ PP_FromBool(!service_runtime_->main_service_runtime()),
+ p->url.c_str(),
+ &pp_mapped_url,
+ &pnacl_options)) {
+ NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n");
+ // Failed, and error_info has the details on what happened. Wake
+ // up requesting thread -- we are done.
+ {
+ nacl::MutexLocker take(&mu_);
+ *p->op_complete_ptr = true; // done...
+ p->file_info->desc = -1; // but failed.
+ NaClXCondVarBroadcast(&cv_);
+ }
+ p->MaybeRunCallback(PP_OK);
+ return;
+ }
+ nacl::string mapped_url = pp::Var(pp_mapped_url).AsString();
+ NaClLog(4,
+ "OpenManifestEntry_MainThreadContinuation: "
+ "ResolveKey: %s -> %s (pnacl_translate(%d))\n",
+ p->url.c_str(), mapped_url.c_str(), pnacl_options.translate);
+
+ if (pnacl_options.translate) {
+ // Requires PNaCl translation, but that's not supported.
+ NaClLog(4,
+ "OpenManifestEntry_MainThreadContinuation: "
+ "Requires PNaCl translation -- not supported\n");
+ {
+ nacl::MutexLocker take(&mu_);
+ *p->op_complete_ptr = true; // done...
+ p->file_info->desc = -1; // but failed.
+ NaClXCondVarBroadcast(&cv_);
+ }
+ p->MaybeRunCallback(PP_OK);
+ return;
+ }
// Because p is owned by the callback of this invocation, so it is necessary
// to create another instance.
OpenManifestEntryResource* open_cont = new OpenManifestEntryResource(*p);
+ open_cont->url = mapped_url;
+ // Callback is now delegated from p to open_cont. So, here we manually clear
+ // complete callback.
+ p->callback = NULL;
pp::CompletionCallback stream_cc = WeakRefNewCallback(
anchor_,
@@ -326,12 +372,10 @@
&PluginReverseInterface::StreamAsFile_MainThreadContinuation,
open_cont);
- GetNaClInterface()->OpenManifestEntry(
- plugin_->pp_instance(),
- PP_FromBool(!service_runtime_->main_service_runtime()),
- p->url.c_str(),
- &open_cont->pp_file_info,
- stream_cc.pp_completion_callback());
+ GetNaClInterface()->DownloadFile(plugin_->pp_instance(),
+ mapped_url.c_str(),
+ &open_cont->pp_file_info,
+ stream_cc.pp_completion_callback());
// p is deleted automatically.
}
« no previous file with comments | « ppapi/c/private/ppb_nacl_private.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698