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

Side by Side Diff: base/json/json_writer.h

Issue 19642005: Make TracedValue lower overhead. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_JSON_JSON_WRITER_H_ 5 #ifndef BASE_JSON_JSON_WRITER_H_
6 #define BASE_JSON_JSON_WRITER_H_ 6 #define BASE_JSON_JSON_WRITER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 30 matching lines...) Expand all
41 // TODO(tc): Should we generate json if it would be invalid json (e.g., 41 // TODO(tc): Should we generate json if it would be invalid json (e.g.,
42 // |node| is not a DictionaryValue/ListValue or if there are inf/-inf float 42 // |node| is not a DictionaryValue/ListValue or if there are inf/-inf float
43 // values)? 43 // values)?
44 static void Write(const Value* const node, std::string* json); 44 static void Write(const Value* const node, std::string* json);
45 45
46 // Same as above but with |options| which is a bunch of JSONWriter::Options 46 // Same as above but with |options| which is a bunch of JSONWriter::Options
47 // bitwise ORed together. 47 // bitwise ORed together.
48 static void WriteWithOptions(const Value* const node, int options, 48 static void WriteWithOptions(const Value* const node, int options,
49 std::string* json); 49 std::string* json);
50 50
51 // Returns a JSON compliant string representation of a double value.
52 static std::string DoubleToFormattedString(double value,
53 bool omit_double_type_preservation);
54
51 // A static, constant JSON string representing an empty array. Useful 55 // A static, constant JSON string representing an empty array. Useful
52 // for empty JSON argument passing. 56 // for empty JSON argument passing.
53 static const char* kEmptyArray; 57 static const char* kEmptyArray;
54 58
55 private: 59 private:
56 JSONWriter(bool escape, bool omit_binary_values, 60 JSONWriter(bool escape, bool omit_binary_values,
57 bool omit_double_type_preservation, bool pretty_print, 61 bool omit_double_type_preservation, bool pretty_print,
58 std::string* json); 62 std::string* json);
59 63
60 // Called recursively to build the JSON string. Whe completed, value is 64 // Called recursively to build the JSON string. Whe completed, value is
(...skipping 13 matching lines...) Expand all
74 78
75 // Where we write JSON data as we generate it. 79 // Where we write JSON data as we generate it.
76 std::string* json_string_; 80 std::string* json_string_;
77 81
78 DISALLOW_COPY_AND_ASSIGN(JSONWriter); 82 DISALLOW_COPY_AND_ASSIGN(JSONWriter);
79 }; 83 };
80 84
81 } // namespace base 85 } // namespace base
82 86
83 #endif // BASE_JSON_JSON_WRITER_H_ 87 #endif // BASE_JSON_JSON_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698