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

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

Issue 1085583005: Refactor params of NaClProcessMsg_Start. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 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/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/nacl/common/nacl_types.h"
11 #include "components/nacl/renderer/nexe_load_manager.h" 12 #include "components/nacl/renderer/nexe_load_manager.h"
12 #include "third_party/jsoncpp/source/include/json/reader.h" 13 #include "third_party/jsoncpp/source/include/json/reader.h"
13 #include "third_party/jsoncpp/source/include/json/value.h" 14 #include "third_party/jsoncpp/source/include/json/value.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 namespace nacl { 17 namespace nacl {
17 18
18 namespace { 19 namespace {
19 // Top-level section name keys 20 // Top-level section name keys
20 const char* const kProgramKey = "program"; 21 const char* const kProgramKey = "program";
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 "could not resolve url '" + nexe_url + 437 "could not resolve url '" + nexe_url +
437 "' relative to manifest base url '" + manifest_base_url_.c_str() + 438 "' relative to manifest base url '" + manifest_base_url_.c_str() +
438 "'."; 439 "'.";
439 return false; 440 return false;
440 } 441 }
441 *full_url = resolved_gurl.possibly_invalid_spec(); 442 *full_url = resolved_gurl.possibly_invalid_spec();
442 return true; 443 return true;
443 } 444 }
444 445
445 void JsonManifest::GetPrefetchableFiles( 446 void JsonManifest::GetPrefetchableFiles(
446 std::vector<std::pair<std::string, std::string> >* out_files) const { 447 std::vector<NaClResourcePrefetchRequest>* out_files) const {
447 const Json::Value& files = dictionary_[kFilesKey]; 448 const Json::Value& files = dictionary_[kFilesKey];
448 if (!files.isObject()) 449 if (!files.isObject())
449 return; 450 return;
450 451
451 Json::Value::Members keys = files.getMemberNames(); 452 Json::Value::Members keys = files.getMemberNames();
452 for (size_t i = 0; i < keys.size(); ++i) { 453 for (size_t i = 0; i < keys.size(); ++i) {
453 std::string full_url; 454 std::string full_url;
454 PP_PNaClOptions unused_pnacl_options; // pnacl does not support "files". 455 PP_PNaClOptions unused_pnacl_options; // pnacl does not support "files".
455 // We skip invalid entries in "files". 456 // We skip invalid entries in "files".
456 if (GetKeyUrl(files, keys[i], &full_url, &unused_pnacl_options)) { 457 if (GetKeyUrl(files, keys[i], &full_url, &unused_pnacl_options)) {
457 if (GURL(full_url).SchemeIs("chrome-extension")) 458 if (GURL(full_url).SchemeIs("chrome-extension"))
458 out_files->push_back(std::make_pair(keys[i], full_url)); 459 out_files->push_back(NaClResourcePrefetchRequest(keys[i], full_url));
459 } 460 }
460 } 461 }
461 } 462 }
462 463
463 bool JsonManifest::ResolveKey(const std::string& key, 464 bool JsonManifest::ResolveKey(const std::string& key,
464 std::string* full_url, 465 std::string* full_url,
465 PP_PNaClOptions* pnacl_options) const { 466 PP_PNaClOptions* pnacl_options) const {
466 if (full_url == NULL || pnacl_options == NULL) 467 if (full_url == NULL || pnacl_options == NULL)
467 return false; 468 return false;
468 469
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 } else { 646 } else {
646 // NaCl 647 // NaCl
647 *url = isa_spec[kUrlKey].asString(); 648 *url = isa_spec[kUrlKey].asString();
648 pnacl_options->translate = PP_FALSE; 649 pnacl_options->translate = PP_FALSE;
649 } 650 }
650 651
651 return true; 652 return true;
652 } 653 }
653 654
654 } // namespace nacl 655 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698