diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 17:21:03 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 16:25:15 +0000 |
commit | c551f43206405019121bd2b2c93714319a0a3300 (patch) | |
tree | 1f48c30631c421fd4bbb3c36da20183c8a2ed7d7 /chromium/base/json/json_writer.h | |
parent | 7961cea6d1041e3e454dae6a1da660b453efd238 (diff) |
BASELINE: Update Chromium to 79.0.3945.139
Change-Id: I336b7182fab9bca80b709682489c07db112eaca5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/base/json/json_writer.h')
-rw-r--r-- | chromium/base/json/json_writer.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/chromium/base/json/json_writer.h b/chromium/base/json/json_writer.h index 57cb8c16a29..d66b46f2863 100644 --- a/chromium/base/json/json_writer.h +++ b/chromium/base/json/json_writer.h @@ -10,6 +10,7 @@ #include <string> #include "base/base_export.h" +#include "base/json/json_common.h" #include "base/macros.h" namespace base { @@ -42,16 +43,21 @@ class BASE_EXPORT JSONWriter { // TODO(tc): Should we generate json if it would be invalid json (e.g., // |node| is not a DictionaryValue/ListValue or if there are inf/-inf float // values)? Return true on success and false on failure. - static bool Write(const Value& node, std::string* json); + static bool Write(const Value& node, + std::string* json, + size_t max_depth = internal::kAbsoluteMaxDepth); // Same as above but with |options| which is a bunch of JSONWriter::Options // bitwise ORed together. Return true on success and false on failure. static bool WriteWithOptions(const Value& node, int options, - std::string* json); + std::string* json, + size_t max_depth = internal::kAbsoluteMaxDepth); private: - JSONWriter(int options, std::string* json); + JSONWriter(int options, + std::string* json, + size_t max_depth = internal::kAbsoluteMaxDepth); // Called recursively to build the JSON string. When completed, // |json_string_| will contain the JSON. @@ -67,6 +73,12 @@ class BASE_EXPORT JSONWriter { // Where we write JSON data as we generate it. std::string* json_string_; + // Maximum depth to write. + const size_t max_depth_; + + // The number of times the writer has recursed (current stack depth). + size_t stack_depth_; + DISALLOW_COPY_AND_ASSIGN(JSONWriter); }; |