| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |