#include "base/json/json_reader.h"
#include <string_view>
#include <utility>
#include "base/features.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/rust_buildflags.h"
#if BUILDFLAG(BUILD_RUST_JSON_READER)
#include "base/strings/string_view_rust.h"
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/functions.h"
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/lib.rs.h"
#endif
#include "base/json/json_parser.h"
namespace base {
#if BUILDFLAG(BUILD_RUST_JSON_READER)
namespace {
ContextPointer;
const char kSecurityJsonParsingTime[] = …;
ContextPointer& ListAppendList(ContextPointer& ctx, size_t reserve) { … }
ContextPointer& ListAppendDict(ContextPointer& ctx) { … }
void ListAppendNone(ContextPointer& ctx) { … }
template <class T, class As = T>
void ListAppendValue(ContextPointer& ctx, T v) { … }
ContextPointer& DictSetList(ContextPointer& ctx,
rust::Str key,
size_t reserve) { … }
ContextPointer& DictSetDict(ContextPointer& ctx, rust::Str key) { … }
void DictSetNone(ContextPointer& ctx, rust::Str key) { … }
template <class T, class As = T>
void DictSetValue(ContextPointer& ctx, rust::Str key, T v) { … }
JSONReader::Result DecodeJSONInRust(std::string_view json,
int options,
size_t max_depth) { … }
}
#endif
std::optional<Value> JSONReader::Read(std::string_view json,
int options,
size_t max_depth) { … }
std::optional<Value::Dict> JSONReader::ReadDict(std::string_view json,
int options,
size_t max_depth) { … }
JSONReader::Result JSONReader::ReadAndReturnValueWithError(
std::string_view json,
int options) { … }
bool JSONReader::UsingRust() { … }
}