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

Side by Side Diff: components/nacl/renderer/json_manifest.cc

Issue 649603004: Non-SFI NaCl: Batch-open resource files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/nacl/renderer/json_manifest.h" 5 #include "components/nacl/renderer/json_manifest.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/containers/scoped_ptr_hash_map.h" 9 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 error_info->string = 452 error_info->string =
453 "could not resolve url '" + nexe_url + 453 "could not resolve url '" + nexe_url +
454 "' relative to manifest base url '" + manifest_base_url_.c_str() + 454 "' relative to manifest base url '" + manifest_base_url_.c_str() +
455 "'."; 455 "'.";
456 return false; 456 return false;
457 } 457 }
458 *full_url = resolved_gurl.possibly_invalid_spec(); 458 *full_url = resolved_gurl.possibly_invalid_spec();
459 return true; 459 return true;
460 } 460 }
461 461
462 bool JsonManifest::GetFilesUrl(std::vector<std::string>* full_urls,
463 std::vector<std::string>* out_keys) const {
464 if (full_urls == NULL || out_keys == NULL)
465 return false;
466
467 const Json::Value& files = dictionary_[kFilesKey];
468 if (!files.isObject()) {
469 VLOG(1) << "ResolveKey failed: no \"files\" dictionary";
470 return false;
471 }
472
473 const std::vector<std::string>& keys = files.getMemberNames();
474 for (size_t i = 0; i < keys.size(); ++i) {
475 std::string full_url;
476 PP_PNaClOptions pnacl_options;
477 if (!GetKeyUrl(files, keys[i], &full_url, &pnacl_options))
478 return false;
479 full_urls->push_back(full_url);
480 out_keys->push_back(keys[i]);
481 }
482 return true;
483 }
484
462 bool JsonManifest::ResolveKey(const std::string& key, 485 bool JsonManifest::ResolveKey(const std::string& key,
463 std::string* full_url, 486 std::string* full_url,
464 PP_PNaClOptions* pnacl_options) const { 487 PP_PNaClOptions* pnacl_options) const {
465 // key must be one of kProgramKey or kFileKey '/' file-section-key 488 // key must be one of kProgramKey or kFileKey '/' file-section-key
466 if (full_url == NULL || pnacl_options == NULL) 489 if (full_url == NULL || pnacl_options == NULL)
467 return false; 490 return false;
468 491
469 if (key == kProgramKey) 492 if (key == kProgramKey)
470 return GetKeyUrl(dictionary_, key, full_url, pnacl_options); 493 return GetKeyUrl(dictionary_, key, full_url, pnacl_options);
471 494
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 } else { 685 } else {
663 // NaCl 686 // NaCl
664 *url = isa_spec[kUrlKey].asString(); 687 *url = isa_spec[kUrlKey].asString();
665 pnacl_options->translate = PP_FALSE; 688 pnacl_options->translate = PP_FALSE;
666 } 689 }
667 690
668 return true; 691 return true;
669 } 692 }
670 693
671 } // namespace nacl 694 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698