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

Unified Diff: base/json/json_reader.h

Issue 9801007: Improve JSONReader performance by up to 55% by using std::string instead of wstring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass Windows tests Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/json/json_reader.cc » ('j') | base/json/json_reader.cc » ('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 be3aef2c4e73abf4b173773f99fbc7974c8a2cd9..949559d8a1cf27ed0c5190f7c8227634d85e8d0a 100644
--- a/base/json/json_reader.h
+++ b/base/json/json_reader.h
@@ -71,11 +71,11 @@ class BASE_EXPORT JSONReader {
INVALID_TOKEN,
};
- Token(Type t, const wchar_t* b, int len)
+ Token(Type t, const char* b, int len)
: type(t), begin(b), length(len) {}
// Get the character that's one past the end of this token.
- wchar_t NextChar() {
+ char NextChar() {
return *(begin + length);
}
@@ -86,7 +86,7 @@ class BASE_EXPORT JSONReader {
Type type;
// A pointer into JSONReader::json_pos_ that's the beginning of this token.
- const wchar_t* begin;
+ const char* begin;
// End should be one char past the end of the token.
int length;
@@ -198,17 +198,20 @@ class BASE_EXPORT JSONReader {
bool EatComment();
// Checks if |json_pos_| matches str.
- bool NextStringMatch(const wchar_t* str, size_t length);
+ bool NextStringMatch(const char* str, size_t length);
// Sets the error code that will be returned to the caller. The current
// line and column are determined and added into the final message.
- void SetErrorCode(const JsonParseError error, const wchar_t* error_pos);
+ void SetErrorCode(const JsonParseError error, const char* error_pos);
// Pointer to the starting position in the input string.
- const wchar_t* start_pos_;
+ const char* start_pos_;
// Pointer to the current position in the input string.
- const wchar_t* json_pos_;
+ const char* json_pos_;
+
+ // Pointer to the last position in the input string.
+ const char* end_pos_;
// Used to keep track of how many nested lists/dicts there are.
int stack_depth_;
« no previous file with comments | « no previous file | base/json/json_reader.cc » ('j') | base/json/json_reader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698