From c551f43206405019121bd2b2c93714319a0a3300 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 23 Jan 2020 17:21:03 +0100 Subject: BASELINE: Update Chromium to 79.0.3945.139 Change-Id: I336b7182fab9bca80b709682489c07db112eaca5 Reviewed-by: Allan Sandfeld Jensen --- chromium/base/json/json_writer.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'chromium/base/json/json_writer.h') 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 #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); }; -- cgit v1.2.3