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

Unified Diff: base/json/json_writer.h

Issue 100823007: Stop doing unnecessary UTF-8 to UTF-16 conversions in JSONWriter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years 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
Index: base/json/json_writer.h
diff --git a/base/json/json_writer.h b/base/json/json_writer.h
index 94052c8034321dd28e6adf4699029e287eb93a6f..d4d8600a5c4cda800460bb3c3419056d39172d50 100644
--- a/base/json/json_writer.h
+++ b/base/json/json_writer.h
@@ -17,9 +17,7 @@ class Value;
class BASE_EXPORT JSONWriter {
public:
enum Options {
- // Do not escape the string, preserving its UTF8 characters. It is useful
- // if you can pass the resulting string to the JSON parser in binary form
- // (as UTF8).
+ // Deprecated. Has no effect.
Mark Mentovai 2013/12/06 15:35:12 Can you remove it totally, and fix the CL descript
Robert Sesek 2013/12/09 19:52:09 Done.
OPTIONS_DO_NOT_ESCAPE = 1 << 0,
// For values of binary type, the value (and key if within a dictionary)
@@ -34,7 +32,7 @@ class BASE_EXPORT JSONWriter {
// Return a slightly nicer formatted json string (pads with whitespace to
// help with readability).
- OPTIONS_PRETTY_PRINT = 1 << 3
+ OPTIONS_PRETTY_PRINT = 1 << 3,
};
// Given a root node, generates a JSON string and puts it into |json|.
@@ -48,12 +46,8 @@ class BASE_EXPORT JSONWriter {
static void WriteWithOptions(const Value* const node, int options,
std::string* json);
- // A static, constant JSON string representing an empty array. Useful
- // for empty JSON argument passing.
- static const char* kEmptyArray;
-
private:
- JSONWriter(bool escape, bool omit_binary_values,
+ JSONWriter(bool omit_binary_values,
bool omit_double_type_preservation, bool pretty_print,
std::string* json);
@@ -61,13 +55,9 @@ class BASE_EXPORT JSONWriter {
// json_string_ will contain the JSON.
void BuildJSONString(const Value* const node, int depth);
- // Appends a quoted, escaped, version of (UTF-8) str to json_string_.
- void AppendQuotedString(const std::string& str);
-
// Adds space to json_string_ for the indent level.
void IndentLine(int depth);
- bool escape_;
bool omit_binary_values_;
bool omit_double_type_preservation_;
bool pretty_print_;

Powered by Google App Engine
This is Rietveld 408576698