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

Unified Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 329593002: Pepper: Make ManifestResolveKey resuable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/renderer/ppb_nacl_private_impl.cc
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index f85a51f3aaec899cc43635f2d2f458553c597f59..54e2cf0b8f8c6179a8577d84b15e6ba9069b388a 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -1043,39 +1043,48 @@ PP_Bool ManifestGetProgramURL(PP_Instance instance,
return PP_FALSE;
}
-PP_Bool ManifestResolveKey(PP_Instance instance,
- PP_Bool is_helper_process,
- const char* key,
- PP_Var* pp_full_url,
- PP_PNaClOptions* pnacl_options) {
+bool ManifestResolveKey(PP_Instance instance,
+ bool is_helper_process,
+ const std::string& key,
+ std::string* full_url,
+ PP_PNaClOptions* pnacl_options) {
// For "helper" processes (llc and ld), we resolve keys manually as there is
// no existing .nmf file to parse.
- if (PP_ToBool(is_helper_process)) {
+ if (is_helper_process) {
pnacl_options->translate = PP_FALSE;
// We can only resolve keys in the files/ namespace.
const std::string kFilesPrefix = "files/";
- std::string key_string(key);
- if (key_string.find(kFilesPrefix) == std::string::npos) {
+ if (key.find(kFilesPrefix) == std::string::npos) {
nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
if (load_manager)
load_manager->ReportLoadError(PP_NACL_ERROR_MANIFEST_RESOLVE_URL,
"key did not start with files/");
- return PP_FALSE;
+ return false;
}
- std::string key_basename = key_string.substr(kFilesPrefix.length());
- std::string pnacl_url =
- std::string(kPNaClTranslatorBaseUrl) + GetSandboxArch() + "/" +
- key_basename;
- *pp_full_url = ppapi::StringVar::StringToPPVar(pnacl_url);
- return PP_TRUE;
+ std::string key_basename = key.substr(kFilesPrefix.length());
+ *full_url = std::string(kPNaClTranslatorBaseUrl) + GetSandboxArch() + "/" +
+ key_basename;
+ return true;
}
JsonManifest* manifest = GetJsonManifest(instance);
if (manifest == NULL)
- return PP_FALSE;
+ return false;
+
+ return manifest->ResolveKey(key, full_url, pnacl_options);
+}
+PP_Bool ExternalManifestResolveKey(PP_Instance instance,
+ PP_Bool is_helper_process,
+ const char* key,
+ PP_Var* pp_full_url,
+ PP_PNaClOptions* pnacl_options) {
std::string full_url;
- bool ok = manifest->ResolveKey(key, &full_url, pnacl_options);
+ bool ok = ManifestResolveKey(instance,
+ PP_ToBool(is_helper_process),
+ std::string(key),
+ &full_url,
+ pnacl_options);
if (ok)
*pp_full_url = ppapi::StringVar::StringToPPVar(full_url);
return PP_FromBool(ok);
@@ -1542,7 +1551,7 @@ const PPB_NaCl_Private nacl_interface = {
&ProcessNaClManifest,
&DevInterfacesEnabled,
&ManifestGetProgramURL,
- &ManifestResolveKey,
+ &ExternalManifestResolveKey,
&GetPNaClResourceInfo,
&GetCpuFeatureAttrs,
&PostMessageToJavaScript,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698