summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryusukes <yusukes@chromium.org>2015-04-16 16:27:00 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-16 23:27:42 +0000
commit7dd7f65010a485d31fb7660b0f47d36d4ac40a6c (patch)
tree177b000693b30363277ba1f17d3c7a60a85aff64
parent09e87de80df5c859ed6d61ff62764d17e43edbd9 (diff)
downloadchromium_src-7dd7f65010a485d31fb7660b0f47d36d4ac40a6c.zip
chromium_src-7dd7f65010a485d31fb7660b0f47d36d4ac40a6c.tar.gz
chromium_src-7dd7f65010a485d31fb7660b0f47d36d4ac40a6c.tar.bz2
Stop adding the "files/" prefix when sending open_resource IPC
This is for simplifying https://codereview.chromium.org/1010183002/ This also removes 'if (key == kProgramKey) ...' check from JsonManifest::ResolveKey. This is safe because kProgram key was never passed to the function before the change. BUG=nativeclient:3802 TEST=git cl try, manually checked that both ARC and PNaCl demo still work Review URL: https://codereview.chromium.org/1070233007 Cr-Commit-Position: refs/heads/master@{#325547}
-rw-r--r--components/nacl/renderer/json_manifest.cc22
-rw-r--r--components/nacl/renderer/ppb_nacl_private_impl.cc12
-rw-r--r--ppapi/nacl_irt/manifest_service.cc4
3 files changed, 4 insertions, 34 deletions
diff --git a/components/nacl/renderer/json_manifest.cc b/components/nacl/renderer/json_manifest.cc
index 15425a5..56a4b2a 100644
--- a/components/nacl/renderer/json_manifest.cc
+++ b/components/nacl/renderer/json_manifest.cc
@@ -463,38 +463,20 @@ void JsonManifest::GetPrefetchableFiles(
bool JsonManifest::ResolveKey(const std::string& key,
std::string* full_url,
PP_PNaClOptions* pnacl_options) const {
- // key must be one of kProgramKey or kFileKey '/' file-section-key
if (full_url == NULL || pnacl_options == NULL)
return false;
- if (key == kProgramKey)
- return GetKeyUrl(dictionary_, key, full_url, pnacl_options);
-
- std::string::const_iterator p = std::find(key.begin(), key.end(), '/');
- if (p == key.end()) {
- VLOG(1) << "ResolveKey failed: invalid key, no slash: " << key;
- return false;
- }
-
- // generalize to permit other sections?
- std::string prefix(key.begin(), p);
- if (prefix != kFilesKey) {
- VLOG(1) << "ResolveKey failed: invalid key, no \"files\" prefix: " << key;
- return false;
- }
-
const Json::Value& files = dictionary_[kFilesKey];
if (!files.isObject()) {
VLOG(1) << "ResolveKey failed: no \"files\" dictionary";
return false;
}
- std::string rest(p + 1, key.end());
- if (!files.isMember(rest)) {
+ if (!files.isMember(key)) {
VLOG(1) << "ResolveKey failed: no such \"files\" entry: " << key;
return false;
}
- return GetKeyUrl(files, rest, full_url, pnacl_options);
+ return GetKeyUrl(files, key, full_url, pnacl_options);
}
bool JsonManifest::MatchesSchema(ErrorInfo* error_info) {
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index e91c8ff..c879e48 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -1107,18 +1107,8 @@ bool ManifestResolveKey(PP_Instance instance,
// keys manually as there is no existing .nmf file to parse.
if (is_helper_process) {
pnacl_options->translate = PP_FALSE;
- // We can only resolve keys in the files/ namespace.
- const std::string kFilesPrefix = "files/";
- 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 false;
- }
- std::string key_basename = key.substr(kFilesPrefix.length());
*full_url = std::string(kPNaClTranslatorBaseUrl) + GetSandboxArch() + "/" +
- key_basename;
+ key;
return true;
}
diff --git a/ppapi/nacl_irt/manifest_service.cc b/ppapi/nacl_irt/manifest_service.cc
index 3c537b3..cc5a267 100644
--- a/ppapi/nacl_irt/manifest_service.cc
+++ b/ppapi/nacl_irt/manifest_service.cc
@@ -21,8 +21,6 @@
namespace ppapi {
-const char kFilePrefix[] = "files/";
-
// IPC channel is asynchronously set up. So, the NaCl process may try to
// send a OpenResource message to the host before the connection is
// established. In such a case, it is necessary to wait for the set up
@@ -101,7 +99,7 @@ bool ManifestService::OpenResource(const char* file, int* fd) {
uint64_t file_token_lo = 0;
uint64_t file_token_hi = 0;
if (!filter_->Send(new PpapiHostMsg_OpenResource(
- std::string(kFilePrefix) + file,
+ file,
&ipc_fd,
&file_token_lo,
&file_token_hi))) {