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

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: Fix ChromeOS page encodings 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
« no previous file with comments | « base/json/json_value_serializer_unittest.cc ('k') | base/json/json_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_writer.h
diff --git a/base/json/json_writer.h b/base/json/json_writer.h
index 94052c8034321dd28e6adf4699029e287eb93a6f..e4a143c77807e78bf84b4804b3bae988c86533bd 100644
--- a/base/json/json_writer.h
+++ b/base/json/json_writer.h
@@ -17,24 +17,19 @@ 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).
- OPTIONS_DO_NOT_ESCAPE = 1 << 0,
-
// For values of binary type, the value (and key if within a dictionary)
// will be omitted from the output.
- OPTIONS_OMIT_BINARY_VALUES = 1 << 1,
+ OPTIONS_OMIT_BINARY_VALUES = 1 << 0,
// This option instructs the writer to write doubles that have no fractional
// part as a normal integer (i.e., without using exponential notation
// or appending a '.0') as long as the value is within the range of a
// 64-bit int.
- OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION = 1 << 2,
+ OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION = 1 << 1,
// Return a slightly nicer formatted json string (pads with whitespace to
// help with readability).
- OPTIONS_PRETTY_PRINT = 1 << 3
+ OPTIONS_PRETTY_PRINT = 1 << 2,
};
// Given a root node, generates a JSON string and puts it into |json|.
@@ -48,12 +43,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 +52,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_;
« no previous file with comments | « base/json/json_value_serializer_unittest.cc ('k') | base/json/json_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698