summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-03 15:02:34 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-03 15:02:34 +0000
commit007a844d0b6741f9382d22b3a5a238420de86560 (patch)
tree2bee1ecd14193137b794a9fc8f70f5299b62e3b3 /ppapi/native_client
parent83d09f9a5b65992f24595500c81761a5a7bfc7cb (diff)
downloadchromium_src-007a844d0b6741f9382d22b3a5a238420de86560.zip
chromium_src-007a844d0b6741f9382d22b3a5a238420de86560.tar.gz
chromium_src-007a844d0b6741f9382d22b3a5a238420de86560.tar.bz2
Pepper: Refactor OpenManifestEntry.
This change pulls out more OpenManifestEntry code from service_runtime, making PPB_NaCl_Private a smallter interface, and preparing for pulling all of that logic out of the trusted plugin. BUG=239656 R=dmichael@chromium.org Review URL: https://codereview.chromium.org/302093012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274530 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.cc56
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c14
2 files changed, 10 insertions, 60 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 6a7b9b52..bd1cfe5 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -314,57 +314,11 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation(
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_,
@@ -372,10 +326,12 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation(
&PluginReverseInterface::StreamAsFile_MainThreadContinuation,
open_cont);
- GetNaClInterface()->DownloadFile(plugin_->pp_instance(),
- mapped_url.c_str(),
- &open_cont->pp_file_info,
- stream_cc.pp_completion_callback());
+ 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());
// p is deleted automatically.
}
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index 6ca478a..6dc0e53 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -3386,9 +3386,9 @@ static PP_Bool Pnacl_M25_PPB_NaCl_Private_GetManifestProgramURL(PP_Instance inst
return iface->GetManifestProgramURL(instance, full_url, pnacl_options, uses_nonsfi_mode);
}
-static PP_Bool Pnacl_M25_PPB_NaCl_Private_ManifestResolveKey(PP_Instance instance, PP_Bool helper_process, const char* key, struct PP_Var* full_url, struct PP_PNaClOptions* pnacl_options) {
+static void Pnacl_M25_PPB_NaCl_Private_OpenManifestEntry(PP_Instance instance, PP_Bool is_helper_process, const char* key, struct PP_NaClFileInfo* file_info, struct PP_CompletionCallback* callback) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- return iface->ManifestResolveKey(instance, helper_process, key, full_url, pnacl_options);
+ iface->OpenManifestEntry(instance, is_helper_process, key, file_info, *callback);
}
static PP_Bool Pnacl_M25_PPB_NaCl_Private_GetPnaclResourceInfo(PP_Instance instance, const char* filename, struct PP_Var* llc_tool_name, struct PP_Var* ld_tool_name) {
@@ -3411,11 +3411,6 @@ static void Pnacl_M25_PPB_NaCl_Private_DownloadNexe(PP_Instance instance, const
iface->DownloadNexe(instance, url, file_info, *callback);
}
-static void Pnacl_M25_PPB_NaCl_Private_DownloadFile(PP_Instance instance, const char* url, struct PP_NaClFileInfo* file_info, struct PP_CompletionCallback* callback) {
- const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- iface->DownloadFile(instance, url, file_info, *callback);
-}
-
/* End wrapper methods for PPB_NaCl_Private_1_0 */
/* Begin wrapper methods for PPB_NetAddress_Private_0_1 */
@@ -5178,12 +5173,11 @@ static const struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
.GetManifestURLArgument = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_GetManifestURLArgument,
.DevInterfacesEnabled = (PP_Bool (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_DevInterfacesEnabled,
.GetManifestProgramURL = (PP_Bool (*)(PP_Instance instance, struct PP_Var* full_url, struct PP_PNaClOptions* pnacl_options, PP_Bool* uses_nonsfi_mode))&Pnacl_M25_PPB_NaCl_Private_GetManifestProgramURL,
- .ManifestResolveKey = (PP_Bool (*)(PP_Instance instance, PP_Bool helper_process, const char* key, struct PP_Var* full_url, struct PP_PNaClOptions* pnacl_options))&Pnacl_M25_PPB_NaCl_Private_ManifestResolveKey,
+ .OpenManifestEntry = (void (*)(PP_Instance instance, PP_Bool is_helper_process, const char* key, struct PP_NaClFileInfo* file_info, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_OpenManifestEntry,
.GetPnaclResourceInfo = (PP_Bool (*)(PP_Instance instance, const char* filename, struct PP_Var* llc_tool_name, struct PP_Var* ld_tool_name))&Pnacl_M25_PPB_NaCl_Private_GetPnaclResourceInfo,
.GetCpuFeatureAttrs = (struct PP_Var (*)(void))&Pnacl_M25_PPB_NaCl_Private_GetCpuFeatureAttrs,
.PostMessageToJavaScript = (void (*)(PP_Instance instance, const char* message))&Pnacl_M25_PPB_NaCl_Private_PostMessageToJavaScript,
- .DownloadNexe = (void (*)(PP_Instance instance, const char* url, struct PP_NaClFileInfo* file_info, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_DownloadNexe,
- .DownloadFile = (void (*)(PP_Instance instance, const char* url, struct PP_NaClFileInfo* file_info, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_DownloadFile
+ .DownloadNexe = (void (*)(PP_Instance instance, const char* url, struct PP_NaClFileInfo* file_info, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_DownloadNexe
};
static const struct PPB_NetAddress_Private_0_1 Pnacl_Wrappers_PPB_NetAddress_Private_0_1 = {