Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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::GetFiles( | |
|
Mark Seaborn
2015/02/02 23:21:50
This returns a bool but the caller ignores the ret
Yusuke Sato
2015/02/04 02:00:29
Done.
| |
| 463 std::vector<std::pair<std::string, std::string> >* out_files) const { | |
| 464 if (out_files == NULL) | |
|
Mark Seaborn
2015/02/02 23:21:50
Nit: no need to check for this.
Yusuke Sato
2015/02/04 02:00:29
Done.
| |
| 465 return false; | |
| 466 | |
| 467 const Json::Value& files = dictionary_[kFilesKey]; | |
| 468 if (!files.isObject()) { | |
| 469 VLOG(1) << "ResolveKey failed: no \"files\" dictionary"; | |
|
Mark Seaborn
2015/02/02 23:21:50
It's valid to have no "files" dict, so drop this l
Yusuke Sato
2015/02/04 02:00:29
Done.
| |
| 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; | |
|
hidehiko
2015/01/28 09:05:20
unused prefix? Maybe short comment why it is unuse
Yusuke Sato
2015/02/04 02:00:29
Done.
| |
| 477 if (!GetKeyUrl(files, keys[i], &full_url, &pnacl_options)) | |
| 478 return false; | |
|
hidehiko
2015/01/28 09:05:20
logging, too?
Mark Seaborn
2015/02/02 23:21:50
Does this "return" mean that if one entry in "file
Yusuke Sato
2015/02/04 02:00:29
Done.
Yusuke Sato
2015/02/04 02:00:29
Done.
| |
| 479 out_files->push_back(std::make_pair(full_url, keys[i])); | |
| 480 } | |
| 481 return true; | |
| 482 } | |
| 483 | |
| 462 bool JsonManifest::ResolveKey(const std::string& key, | 484 bool JsonManifest::ResolveKey(const std::string& key, |
| 463 std::string* full_url, | 485 std::string* full_url, |
| 464 PP_PNaClOptions* pnacl_options) const { | 486 PP_PNaClOptions* pnacl_options) const { |
| 465 // key must be one of kProgramKey or kFileKey '/' file-section-key | 487 // key must be one of kProgramKey or kFileKey '/' file-section-key |
| 466 if (full_url == NULL || pnacl_options == NULL) | 488 if (full_url == NULL || pnacl_options == NULL) |
| 467 return false; | 489 return false; |
| 468 | 490 |
| 469 if (key == kProgramKey) | 491 if (key == kProgramKey) |
| 470 return GetKeyUrl(dictionary_, key, full_url, pnacl_options); | 492 return GetKeyUrl(dictionary_, key, full_url, pnacl_options); |
| 471 | 493 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 662 } else { | 684 } else { |
| 663 // NaCl | 685 // NaCl |
| 664 *url = isa_spec[kUrlKey].asString(); | 686 *url = isa_spec[kUrlKey].asString(); |
| 665 pnacl_options->translate = PP_FALSE; | 687 pnacl_options->translate = PP_FALSE; |
| 666 } | 688 } |
| 667 | 689 |
| 668 return true; | 690 return true; |
| 669 } | 691 } |
| 670 | 692 |
| 671 } // namespace nacl | 693 } // namespace nacl |
| OLD | NEW |