| 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.
|
| }
|
|
|
|
|