Files
brave-core/patches/third_party-rust-serde_json_lenient-v0_2-wrapper-BUILD.gn.patch
T
cdesouza-chromium 51fb253a7c [json64] Adding hooks to serde_json_lenient's visitor (#29768)
This PR is the first of a couple of changes to allow us to parse, and
carry over JSON content 64bit integer representation. This is currently
not possible, as Chromium's `base::Value` only support a range of
integer values that is valid to be represented JS.

This work aims to store integer values outside the allowed boundaries as
binary data into `base::Value`. This will be done through customisations
to `base::JSONReader`, and `base::JSONWriter`. Additionally, most of the
complexity will hopefully be hidden away by code generators in the
json-schema-compiler.

This first PR adds hooks into the visitor for `serde_json_lenient` that
will allow us to provide the special conversions to binary blob data for
large 64bit values that fall outside of what can be represented as
double without loss.

This PR is also introducing a build flag, namely,
`enable_json_64bit_int_support`, to allow us to have some compile time
control over to switch this feature off. This is necessary, as
`redirect_cc` cannot build `//brave/chromium_src` files the same way a
normal Brave build does, and therefore it is necessary to be able to
switch of these customisations in that mode.

Resolves https://github.com/brave/brave-browser/issues/47119
2025-07-15 16:51:26 +01:00

13 lines
957 B
Diff

diff --git a/third_party/rust/serde_json_lenient/v0_2/wrapper/BUILD.gn b/third_party/rust/serde_json_lenient/v0_2/wrapper/BUILD.gn
index c1642f6b2d12e9aa0cb4661f6c4b9581e2ad4650..46eed9552f2489fd35c07348db7c5c8b9c06b90f 100644
--- a/third_party/rust/serde_json_lenient/v0_2/wrapper/BUILD.gn
+++ b/third_party/rust/serde_json_lenient/v0_2/wrapper/BUILD.gn
@@ -19,6 +19,7 @@ rust_static_library("wrapper") {
"//third_party/rust/serde/v1:lib",
"//third_party/rust/serde_json_lenient/v0_2:lib",
]
+ import("//brave/components/json/buildflags/features.gni") public_deps += [ "//brave/components/json/buildflags" ] if (enable_json_64bit_int_support) { features = [ "json_64bit_int_support" ] } sources += [ "//brave/chromium_src/third_party/rust/serde_json_lenient/v0_2/wrapper/large_integers.rs" ] cxx_bindings += [ "//brave/chromium_src/third_party/rust/serde_json_lenient/v0_2/wrapper/large_integers.rs" ]
}
source_set("wrapper_functions") {