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

Unified Diff: base/json/json_reader.h

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/json/json_reader.cc » ('j') | chrome/browser/extensions/component_loader.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_reader.h
diff --git a/base/json/json_reader.h b/base/json/json_reader.h
index b1edfb07edd4c2bd7c736cb150e24e77703deab0..daa20c5575cc19c660be79f98f1c09b9a2ecf406 100644
--- a/base/json/json_reader.h
+++ b/base/json/json_reader.h
@@ -33,6 +33,7 @@
#include "base/base_export.h"
#include "base/basictypes.h"
+#include "base/string_piece.h"
// Chromium and Chromium OS check out gtest to different places, so we're
// unable to compile on both if we include gtest_prod.h here. Instead, include
@@ -121,13 +122,13 @@ class BASE_EXPORT JSONReader {
// instance. If |json| is not a properly formed JSON string, returns NULL.
// If |allow_trailing_comma| is true, we will ignore trailing commas in
// objects and arrays even though this goes against the RFC.
- static Value* Read(const std::string& json, bool allow_trailing_comma);
+ static Value* Read(const StringPiece& json, bool allow_trailing_comma);
// Reads and parses |json| like Read(). |error_code_out| and |error_msg_out|
// are optional. If specified and NULL is returned, they will be populated
// an error code and a formatted error message (including error location if
// appropriate). Otherwise, they will be unmodified.
- static Value* ReadAndReturnError(const std::string& json,
+ static Value* ReadAndReturnError(const StringPiece& json,
bool allow_trailing_comma,
int* error_code_out,
std::string* error_msg_out);
@@ -151,7 +152,7 @@ class BASE_EXPORT JSONReader {
// array. Otherwise, it can be any valid JSON type.
// If |allow_trailing_comma| is true, we will ignore trailing commas in
// objects and arrays even though this goes against the RFC.
- Value* JsonToValue(const std::string& json, bool check_root,
+ Value* JsonToValue(const StringPiece& json, bool check_root,
bool allow_trailing_comma);
private:
« no previous file with comments | « no previous file | base/json/json_reader.cc » ('j') | chrome/browser/extensions/component_loader.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698