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

Side by Side Diff: base/json/json_parser.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « base/json/json_parser.h ('k') | base/json/json_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/json/json_parser.h" 5 #include "base/json/json_parser.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 437 }
438 438
439 return std::move(list); 439 return std::move(list);
440 } 440 }
441 441
442 std::unique_ptr<Value> JSONParser::ConsumeString() { 442 std::unique_ptr<Value> JSONParser::ConsumeString() {
443 StringBuilder string; 443 StringBuilder string;
444 if (!ConsumeStringRaw(&string)) 444 if (!ConsumeStringRaw(&string))
445 return nullptr; 445 return nullptr;
446 446
447 return base::MakeUnique<StringValue>(string.DestructiveAsString()); 447 return base::MakeUnique<Value>(string.DestructiveAsString());
448 } 448 }
449 449
450 bool JSONParser::ConsumeStringRaw(StringBuilder* out) { 450 bool JSONParser::ConsumeStringRaw(StringBuilder* out) {
451 if (*pos_ != '"') { 451 if (*pos_ != '"') {
452 ReportError(JSONReader::JSON_UNEXPECTED_TOKEN, 1); 452 ReportError(JSONReader::JSON_UNEXPECTED_TOKEN, 1);
453 return false; 453 return false;
454 } 454 }
455 455
456 // StringBuilder will internally build a StringPiece unless a UTF-16 456 // StringBuilder will internally build a StringPiece unless a UTF-16
457 // conversion occurs, at which point it will perform a copy into a 457 // conversion occurs, at which point it will perform a copy into a
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 const std::string& description) { 829 const std::string& description) {
830 if (line || column) { 830 if (line || column) {
831 return StringPrintf("Line: %i, column: %i, %s", 831 return StringPrintf("Line: %i, column: %i, %s",
832 line, column, description.c_str()); 832 line, column, description.c_str());
833 } 833 }
834 return description; 834 return description;
835 } 835 }
836 836
837 } // namespace internal 837 } // namespace internal
838 } // namespace base 838 } // namespace base
OLDNEW
« no previous file with comments | « base/json/json_parser.h ('k') | base/json/json_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698