Also, verbose param has been removed from the print_rust_log function
signature.
Chromium changes:
https://chromium.googlesource.com/chromium/src.git/+/fafff21
commit fafff21030e1c11d6bbb1acccd6b28013cfd887f
Author: Lukasz Anforowicz <lukasza@chromium.org>
Date: Tue Apr 7 17:28:03 2026 -0700
[rust] Split the `rust_logger` crate into smaller modules.
This helps to hide some implementation details as private items of
the new, smaller modules. In addition to moving the new modules into
`//base/logging/rust_logger` subdirectory, this CL also moves tests
into the same directory. Summary of the changes/moves:
* `base/logging/logger.rs` has been split into 4 modules:
- `base/logging/rust_logger/lib.rs` (entry point via C API)
- `base/logging/rust_logger/log_crate_integration.rs` and
`base/logging/rust_logger/custom_panic_hook.rs`
- `base/logging/rust_logger/print_rust_log.rs` (low-level
implementation for invoking `LOG(...)` from Rust).
* `base/logging/rust_log_integration.h/.cc` has been moved to
`base/logging/rust_logger/print_rust_log_ffi.h/.cc`
* `base/test/logging/test_rust_logger_consumer.rs` has been moved to
`base/logging/rust_logger/test_support.rs`
* `base/logging/rust_log_integration_unittest.cc` has been moved to
`base/logging/rust_logger/unittests.cc`
Bug: 495537792
https://chromium.googlesource.com/chromium/src.git/+/750f91c315307c59cb4f4b2445642e97187e620f
commit 750f91c315307c59cb4f4b2445642e97187e620f
Author: Lukasz Anforowicz <lukasza@chromium.org>
Date: Wed Apr 8 16:25:46 2026 -0700
[rust] Delete unfinished `VLOG(INFO)` <=> Rust integration.
Bug: 495537792
This reverts commit 8333633c07.
Because it is DISABLED at cr148 since
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/23394958348e169660fe01722f985b2f8cdb81c6
commit 23394958348e169660fe01722f985b2f8cdb81c6
Author: Selma Bensaid <bselma@google.com>
Date: Sun Mar 29 18:33:14 2026 -0700
Revert "[PA] Roll out FreeWithSize to default-enabled"
This reverts commit f32e2dd081a35717d7d6b9566df96a63d071c939.
Reason for revert: b/495493036
Original change's description:
> [PA] Roll out FreeWithSize to default-enabled
>
> 1. Enable FreeWithSize by default with strict checks enabled, given
> 100% stable launch for that configuration is approved.
> 2. In fieldtrial, disable the strict checks for the next phase of
> experiment.
>
> Bug: 410190984
> Change-Id: I1717e3d37f52387441cf4dadaa6d6267bd503b56
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7613331
> Commit-Queue: Mikihito Matsuura <mikt@google.com>
> Reviewed-by: Takashi Sakamoto <tasak@google.com>
> Cr-Commit-Position: refs/heads/main@{#1592223}
Bug: 410190984
Change-Id: I5ba5e22d14685dc86dde302a2206107e65ed1ca5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7707531
Commit-Queue: Takashi Sakamoto <tasak@google.com>
Reviewed-by: Nathan Hebert <nhebert@chromium.org>
Reviewed-by: Takashi Sakamoto <tasak@google.com>
Cr-Commit-Position: refs/heads/main@{#1606858}
* Changes check_chromium_src warning into an error.
Changes the warning that catches use of defined symbols in the override,
but not in the original file into an error. All uses of such symbols
should be marked with // CHROMIUM_SRC_INTERNAL_USE comment.
* Removes symbol exclusions section of the config file.
All symbols that don't conform to check_chromium_src rules should be marked with // CHROMIUM_SRC_NOLINT comment.
[CodeHealth] `base::Contains()` to be deleted
The remaining cases of `base::Contains` in the codebase can be just
`std::ranges::contains`.
This change was done mechanically, with the following script
```bash
files_using_header="$(git grep -l base::Contains | tr '\n' ' ')"
sed -i 's/base::Contains/std::ranges::contains/g' \
${files_using_header}
../tools/add_header.py --header '<algorithm>' ${files_using_header}
files_including_header="$(git grep -l base/containers/contains.h | tr '\n' ' ')"
../tools/add_header.py --header '"base/containers/contains.h"' \
--remove ${files_including_header}
git cl format
```
This CL also cherry-picks the contents of https://crrev.com/c/7380987 to
permit the use of certain range operations.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/4e6249c911b515cc237707ba751290c6dbe9970f
commit 4e6249c911b515cc237707ba751290c6dbe9970f
Author: Victor Hugo Vianna Silva <victorvianna@google.com>
Date: Sun Jan 18 11:32:26 2026 -0800
Reland "Delete unused base::Contains()"
This is a reland of commit 15af921783afac76cfc7d5beb04e4816ac0ffac7
Original change's description:
> Delete unused base::Contains()
>
> All callers were migrated.
>
> Fixed: 470391351
> Change-Id: I404da9186a45c2c47669592242fac972ef70dfa3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7459699
> Auto-Submit: Victor Vianna <victorvianna@google.com>
> Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
> Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1570540}
Bug: 470391351
Change-Id: I858f7880bf8cb1857085eb44836dee4a0becf7ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7490440
Owners-Override: Matthew Denton <mpdenton@chromium.org>
Commit-Queue: Victor Vianna <victorvianna@google.com>
Reviewed-by: Victor Vianna <victorvianna@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1570926}
These classes were hoisted and renamed. This has been replaced in
Chromium as well. This is a mechanical change for Brave, done with the
following script.
```
git grep -lw 'Value::List' | xargs sed -i 's/\bValue::List\b/ListValue/g'
git grep -lw 'Value::Dict' | xargs sed -i 's/\bValue::Dict\b/DictValue/g'
git cl format
```
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/6bc468d481835992696083e99e556516fb7f5f80
```
commit 6bc468d481835992696083e99e556516fb7f5f80
Author: Avi Drissman <avi@chromium.org>
Date: Thu Jan 29 22:14:50 2026 -0800
Remove aliases for base::DictValue and base::ListValue
This removes a few last stragglers as well.
Fixed: 478100525
Cq-Include-Trybots: luci.chromium.try:win-official,mac-official,linux-official,android-official,android-desktop-x64-official
Change-Id: If92142b8ab0562a82c609b71c6b2a7665cea6ec6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7513889
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1577038}
```
Issue: https://github.com/brave/brave-browser/issues/52435
This change anchors our additions to this enum way down the line, as it
doesn't seem to matter if there are gaps in this enum value, as these
metrics are for histograms that go unreported.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/18b67dedd72300694aa987f92de09fd4e505af29
commit 18b67dedd72300694aa987f92de09fd4e505af29
Author: Patrick Monette <pmonette@chromium.org>
Date: Fri Nov 7 12:52:49 2025 -0800
Make a MemoryPressureListener for MemoryReclaimer
The goal of this change is to separate all the memory pressure
interventions in RenderThreadImpl::OnMemoryPressure so that they can
be invoked separately.
This is a necessary change for migrating all MemoryPressureListeners
to the base::MemoryConsumer interface, where each intervention is
tagged with different properties.
Bug: 436324601
Change-Id: Ie6c3fe4ae2f6ce36612a913ef181d5d478fef1d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7127962
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1541975}
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/2517b26f8677a7e51f36b3c10ed3acb61e0777b7
Cleanup Android.FrameTimeLineJank.* histograms and related code.
The histograms are not being used actively to derive any investigations.
Histogram emission was guarded behind feature flag which hasn't been
enabled in any for some time.
OBSOLETE_HISTOGRAMS: Patterned histograms
Android.FrameTimelineJank.Duration{JankScenario},
Android.FrameTimelineJank.FrameJankStatus{JankScenario},
Android.FrameTimelineJank.{Scenario}.DelayedFramesPercentage.PerScroll{Length},
Android.FrameTimelineJank.{Scenario}.MissedVsyncs{Operator}.PerScroll{Length}
haven't been emitted in more than an year.
Bug: 408388498
Change-Id: Ice1d88847eef4a8a765d4886a25aba9428961e90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6434049
This change updates how brave/chromium_src overrides can reference original files: it adds ability to use #include <...> along with #include "src/...". This is enabled by replacing -I../../brave/chromium_src with -iquote../../brave_chromium_src, which adds an include search path only for #include "..." directives.
With this approach, other files in the build tree can reference brave/chromium_src overrides using #include "...", while the overrides themselves can reference original Chromium files using #include <...>. Since Chromium uses #include "..." for all in-tree files, we can leverage this convention and configure our overrides so that we can drop support for #include "src/" later by removing -I../../.. and making rbe_exec_root modification obsolete (the main goal).
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
[chromium_src] Allow overrides to reference original files with #include <...>
This change updates the include path handling for brave/chromium_src overrides:
- Adds support for referencing original Chromium files using #include <...> in
overrides.
- Enables this by replacing -I../../brave/chromium_src with
-iquote../../brave/chromium_src, so the path is only used for #include "..."
directives.
With this, other files in the build tree can reference brave/chromium_src
overrides using #include "...", while the overrides themselves can reference
original Chromium files using #include <...>. Since Chromium uses #include "..."
for all in-tree files, we can leverage this convention and eventually drop
support for #include "src/" by removing -I../../.. and making rbe_exec_root
modification obsolete.
That check is not required, and it was also removed from the upstream
version.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/fed5d5a5726a7e2b2501eb49b8bebcb8cc71fdc0
commit fed5d5a5726a7e2b2501eb49b8bebcb8cc71fdc0
Author: Cliff Smolinsky <cliffsmo@microsoft.com>
Date: Mon Mar 24 11:03:26 2025 -0700
Move AllowCheckIsTestForTesting to be before NetworkServiceTestHelper
In some test libraries (browser_tests, chromeos browser_tests, and
headless_browsertests, along with anything that inherits from them), the
NetworkServiceTestHelper is created prior to the call to
content::LaunchTests(). NetworkServiceTestHelper is test-specific code
but currently cannot reference anything that uses CHECK_IS_TEST()
because AllowCheckIsTestForTesting() is not called until LaunchTests().
This change adds calls to AllowCheckIsTestForTesting() in these three
locations. It also removes the reentrancy CHECK in
AllowCheckIsTestForTesting() as it isn't really necessary. There are
linter checks to prevent production code from reference *ForTesting
methods.
Bug: 404286909
This change change the versbose path to use the overriden function for
the logging implementation, as the implementation could change
regardless.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/f0fd42efd9fdb4f04acc6e4d0699a34700b41cbc
commit f0fd42efd9fdb4f04acc6e4d0699a34700b41cbc
Author: Collin Baker <collinbaker@chromium.org>
Date: Fri Mar 21 09:47:39 2025 -0700
Format Rust log message body without intermediate allocation
The Rust log adapter can avoid a heap allocation for each log record:
instead of turning the provided std::fmt::Arguments into a CString,
the former can be passed oqauely to C++ code. Then, the C++ side can
call back with the formatter and an interface to the LogMessage
The allocation for the filename can be removed once
crrev.com/c/5765705 is in.
Bug: 371112531
This is a simple change to the function signature itself to once again
be matching with the one in the override. The type changes are pretty
much analogous to what was there before.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/7cbc0d17f2eceb8ef0eb928fe8f8dd6d0163d3d0
commit 7cbc0d17f2eceb8ef0eb928fe8f8dd6d0163d3d0
Author: Collin Baker <collinbaker@chromium.org>
Date: Wed Mar 19 14:02:01 2025 -0700
Use cxx for FFI between Rust and C++ logging code
Instead of bindgen, use cxx to generate binding for the C++
print_rust_log fn called from Rust. This will make it possible to use
cxx types such as rust::Str.
Bindgen is still used to generate LogSeverity bindings, since that is
the only way to have non-opaque bindings while keeping C++ as the
source of truth.
Bug: 371112531
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/7cbc0d17f2eceb8ef0eb928fe8f8dd6d0163d3d0
commit 7cbc0d17f2eceb8ef0eb928fe8f8dd6d0163d3d0
Author: Collin Baker <collinbaker@chromium.org>
Date: Wed Mar 19 14:02:01 2025 -0700
Use cxx for FFI between Rust and C++ logging code
Instead of bindgen, use cxx to generate binding for the C++
print_rust_log fn called from Rust. This will make it possible to use
cxx types such as rust::Str.
Bindgen is still used to generate LogSeverity bindings, since that is
the only way to have non-opaque bindings while keeping C++ as the
source of truth.
Bug: 371112531
Since the base logger was modified to include full file paths, we now are
bumping up against the "excessive output" error again due to certain Rust
crates' over-reliance on logging warnings. To avoid that, just map warnings to
VLOG as well.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/d2a02a7a2cde885a3e1ddc624f3f17f0b3a63bd8
commit d2a02a7a2cde885a3e1ddc624f3f17f0b3a63bd8
Author: Peter Boström <pbos@chromium.org>
Date: Wed Mar 5 15:39:22 2025 -0800
Log path/to/filename:line
Our codebase is large, finding which `version.h` is being logged from is
tedious. The format changes from foo.cc(10) to path/to/foo.cc:10 (or
path\to\foo.cc:10). The non-Windows format can be directly pasted into
codesearch.
Bug: None
This override had to be update as the category declaration has been
updated for all those listed.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/32b001c89dc2f186bfebe1d19a85fc74c61750eb
commit 32b001c89dc2f186bfebe1d19a85fc74c61750eb
Author: Etienne Pierre-doray <etiennep@chromium.org>
Date: Tue Jan 7 07:44:42 2025 -0800
[tracing] Update builtin categories to use perfetto API
This CL simplifies builtin categories definition, and uses
SetDescription to declare existing category descriptions.
Drive-by: remove some (non-exhaustive) unused categories.
Bug: 343404899
This CL had been cherry-picked into brave to help with the unsafe
buffers fixes, but now it is available in chromium's master.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/e4c7665bcd2e1f8b5f480bfd937beed994633f50
commit e4c7665bcd2e1f8b5f480bfd937beed994633f50
Author: Claudio DeSouza <cdesouza@chromium.org>
Date: Wed Nov 13 04:28:00 2024 +0000
Add a for-range loop `zip` adapter
This CL adds a `zip` helper to base utility types to allows us to do
basic `zip` operations in lockstep with different ranges.
```cxx
std::vector<int> a = {1, 2, 3};
std::vector<double> b = {4.5, 5.5, 6.5};
std::vector<std::string> c = {"x", "y", "z"};
for (auto [x, y, z] : zip(a, b, c)) {
LOG(INFO) << x << " " << y << " " << z;
}
```
Bug: 377940847
Upstream has moved the logic to determine log serverity/verbosity into
rust code. This change corrects our own overrides for `TRACE`/`DEBUG`
logs accordingly.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/191a4d32cef75f93eef5637ddce77263c9c87f36
commit 191a4d32cef75f93eef5637ddce77263c9c87f36
Author: Lukasz Anforowicz <lukasza@chromium.org>
Date: Tue Nov 12 01:48:08 2024 +0000
Reland2 "Use logging::LogSeverity directly in Rust log crate plumbing"
This reverts commit ac4d0fcfec323209945a283d9b64d5688adb8517 and makes a
few extra tweaks to ensure all the dependencies are represented in the
build graph. Original CL description follows below.
Instead of making a new macro that duplicates the LogSeverity, move the
LogSeverity into its own header, generate bindgen from it, and use it
directly from the Rust logger implementation.
We add the `verbose` flag which is true for `trace!` macros, as we
intend to only include those logs when verbose logging is enabled. For
now, they are logged equally as `debug!`.
R=pbos@chromium.org
Fixed: 372907698
There were some overrides in place to enforce the use of the rust parser
for `APIRequestHelper` and similar APIs. However, the rust parser is now
switched by default in upstream. This change does away with the
overrides that were added, and uses the regular `JSONReader` interface.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/9ddc1624637c8cfa8ef50a95abd779e0ba4d67f6
commit 9ddc1624637c8cfa8ef50a95abd779e0ba4d67f6
Author: danakj <danakj@chromium.org>
Date: Thu Nov 7 22:14:14 2024 +0000
Make rust toolchain non-optional in chromium and move flags out of build
The //build dir should contain things that apply to all projects using
the directly. Moving the gn args for specific chromium projects out of
//build/config/rust.gni into the Chromium tree next to the features they
are flags for.
Removed the flags that now default to on. They were gated on enable_rust
but enable_rust is always true in Chromium, so in Chromium code we can
just assume it's true. Thus the features are always enabled. Removed
buildflags etc for these removed GN args.
Gating Rust in //base on IS_NACL rather than rust-specific toolchain
flags, as Rust is always available in Chromium in all of our build
configurations except NaCl (and it will be going away in under a year
now).
This change has been necessary as `html5ever` was spamming the logger
with every single tokenised character, which was causing error failures
in the CI.
An issue[1] was opened with the authors, however it is better to have
these logs guarded as `VLOG`s.
[1] https://github.com/servo/html5ever/issues/561
Chromium change:
https://chromium.googlesource.com/chromium/src/+/7ea0a5e831dd5f98f24b4403e9eb238e061c5808
commit 7ea0a5e831dd5f98f24b4403e9eb238e061c5808
Author: Thirumurugan <thiruak1024@gmail.com>
Date: Wed Oct 16 15:44:03 2024 +0000
Connect the Rust log crate to the //base logging implementation
Bug: 339678662, 40278279
* Alias settings_client internals to see in a memory dump.
* Prevent few optimizations to keep the object on stack.
* Keep ExecutionContext type in the dump.
This function used to have two variants, one taking a string value, and
another taking a pointer. The two variants are now a single one using a
string view arg. This dispenses of two overrides for each variant, and
this change corrects that.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/bb5cb56e8987de4ee255ae9f67ed83009e24ed04
commit bb5cb56e8987de4ee255ae9f67ed83009e24ed04
Author: Alex Turner <alexmt@chromium.org>
Date: Mon Aug 12 17:12:42 2024 +0000
Add std::string_view versions of base::UmaHistogram* functions
Defines an additional overload of these functions that uses
std::string_view. We keep the existing const char* and const
std::string& versions to avoid code bloat, but move some to a separate
header. Introduces linting to keep those two versions synchronized.
Also makes consequential changes to histogram classes to permit these
new overloads. (Note that these changes cannot be easily moved to a
separate header so are kept in the main class declarations.)
Bug: 358538894
The UmaHistogramEnumeration functions perform static assertion checks on their
types using uintmax_t, but we've added to the types using negative numbers so we
need to allow for those.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/1be087741feee0d0558405ffb0ac12bec48059ec
commit 1be087741feee0d0558405ffb0ac12bec48059ec
Author: Brian White <bcwhite@chromium.org>
Date: Tue May 28 18:51:44 2019 +0000
Have histogram-functions take native char* names.
Without this, the compiler emits ctor/dtor code to convert constant
strings to std::string making the call about 100x larger in size and
almost 2x the size of a caching macro instantiation.
According to the Android binary-size try-bot, saves about 4K...
Specifics:
-4,096 bytes main lib size
-4,738 bytes normalized apk size
InstallSize:
-4,122 bytes APK size
-4,122 bytes Estimated installed size (Android Go)
-4,122 bytes Estimated installed size
InstallBreakdown (-4,066 bytes):
+28 bytes unwind_cfi (dev and canary only) size
-4,096 bytes Native code size
+2 bytes Package metadata size
Bug: 94484