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

Side by Side Diff: gpu/tools/compositor_model_bench/render_tree.cc

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/tools/compositor_model_bench/render_tree.h" 5 #include "gpu/tools/compositor_model_bench/render_tree.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 RenderNode* BuildRenderTreeFromFile(const FilePath& path) { 454 RenderNode* BuildRenderTreeFromFile(const FilePath& path) {
455 LOG(INFO) << "Reading " << path.LossyDisplayName(); 455 LOG(INFO) << "Reading " << path.LossyDisplayName();
456 string contents; 456 string contents;
457 if (!ReadFileToString(path, &contents)) 457 if (!ReadFileToString(path, &contents))
458 return NULL; 458 return NULL;
459 459
460 scoped_ptr<Value> root; 460 scoped_ptr<Value> root;
461 int error_code = 0; 461 int error_code = 0;
462 string error_message; 462 string error_message;
463 root.reset(JSONReader::ReadAndReturnError(contents, 463 root.reset(JSONReader::ReadAndReturnError(contents,
464 true, 464 base::JSON_ALLOW_TRAILING_COMMAS,
465 &error_code, 465 &error_code,
466 &error_message)); 466 &error_message));
467 if (!root.get()) { 467 if (!root.get()) {
468 LOG(ERROR) << "Failed to parse JSON file " << path.LossyDisplayName() << 468 LOG(ERROR) << "Failed to parse JSON file " << path.LossyDisplayName() <<
469 "\n(" << error_message << ")"; 469 "\n(" << error_message << ")";
470 return NULL; 470 return NULL;
471 } 471 }
472 472
473 if (root->IsType(Value::TYPE_DICTIONARY)) { 473 if (root->IsType(Value::TYPE_DICTIONARY)) {
474 DictionaryValue* v = static_cast<DictionaryValue*>(root.get()); 474 DictionaryValue* v = static_cast<DictionaryValue*>(root.get());
475 RenderNode* tree = InterpretContentLayer(v); 475 RenderNode* tree = InterpretContentLayer(v);
476 return tree; 476 return tree;
477 } else { 477 } else {
478 LOG(ERROR) << path.LossyDisplayName() << 478 LOG(ERROR) << path.LossyDisplayName() <<
479 " doesn not encode a JSON dictionary."; 479 " doesn not encode a JSON dictionary.";
480 return NULL; 480 return NULL;
481 } 481 }
482 } 482 }
483 483
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698