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

Unified Diff: base/json/json_parser.cc

Issue 10003001: Update JSONReader to take base::StringPiece instead of std::string (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sync with Parser changes Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/json/json_parser.h ('k') | base/json/json_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_parser.cc
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc
index 0fd5202817ec16278ca2bfb6a3d47fb2a5abfafc..738da473272273344c248a8c9baf52fe38d9baee 100644
--- a/base/json/json_parser.cc
+++ b/base/json/json_parser.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_number_conversions.h"
+#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/third_party/icu/icu_utf.h"
@@ -204,7 +205,7 @@ JSONParser::JSONParser(int options)
JSONParser::~JSONParser() {
}
-Value* JSONParser::Parse(const std::string& input) {
+Value* JSONParser::Parse(const StringPiece& input) {
// TODO(rsesek): Windows has problems with StringPiece/hidden roots. Fix
// <http://crbug.com/126107> when my Windows box arrives.
#if defined(OS_WIN)
@@ -216,7 +217,7 @@ Value* JSONParser::Parse(const std::string& input) {
// be used, so do not bother copying the input because StringPiece will not
// be used anywhere.
if (!(options_ & JSON_DETACHABLE_CHILDREN)) {
- input_copy = input;
+ input_copy = input.as_string();
start_pos_ = input_copy.data();
} else {
start_pos_ = input.data();
« no previous file with comments | « base/json/json_parser.h ('k') | base/json/json_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698