This PR is the run of `gn format` on all `gn` files. This is a
mechanical change done with:
```sh
git ls-files -- "*.gn" | xargs gn format
git ls-files -- "*.gni" | xargs gn format
```
This change has been motivated primarily by an improvement to the
formatters privided by `gn` correcting cases of redundant target naming,
i.e cases where `//foo:foo` is used, and should just be `//foo`.
For this particular `gn` change, see:
https://chromium.googlesource.com/chromium/src/+/c822490a82cdb6ad479159683a92858f7c6f0a58
Resolves https://github.com/brave/brave-browser/issues/48161
All uses of `CHECK(false)` are incorrect and should be either a
`NOTREACHED`, `LOG(ERROR)`, or higher `CHECK` that removed the enclosing
conditional code path.
Resolves https://github.com/brave/brave-browser/issues/42331
This change fixes several instances where use-after-move is possible in
our codebase. For potential use-after-move cases involving
`OnceCallback` instances, those are potential crahes in the application.
Additionally, this PR corrects the use of moved-from std containers. It
is valid to use a moved-from container, but it is expected that the
container is cleared before being used again.
Resolves https://github.com/brave/brave-browser/issues/42264
Changing to DCHECK to avoid crash dump uploading as this is spamming our
Backtrace system at the moment.
Generally, if we get here, it means that `BraveBrowserProcessImpl::Init`
hasn't been called yet and so we don't need to apply our filters in this
case.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/cd23b8b9d212daf06dde638488dbaa355d6651fa
commit cd23b8b9d212daf06dde638488dbaa355d6651fa
Author: Daniel Cheng <dcheng@chromium.org>
Date: Fri Sep 16 17:16:24 2022 +0000
Move bind.h, callback{,_forward,_helpers}.h into //base/functional
Forwarding headers remain in the old locations to ease migration.
Include paths for files in //base/functional/ are also fixed up to the
new canonical path; remaining fixups are deferred until followups to
minimize the risk of conflicts.
Bug: 1364441
This change corrects the constructors of several classes under
browser/, using clang-tidy's modernize-use-equals-default. Additionally,
this commit includes a few additional straggler files.
//chrome/browser/net/system_network_context_manager.cc is wrongly using
network::ResourceRequest without including it first, which is causing
a build failure on Brave due to overrides, so let's make sure that such
header is included before using that type.
base::{Bind,Callback,Closure}() have been deprecatedfor a while now,
are finally gone on Chromium 92, so it would be good to migrate all
current instances in the code (and stop introducing new ones) to the
Once/Repeating variants instead to easy further rebases.
This patch changes ALL instances of those old definitions and move
to using the Once variants whenever possible (as they are preferred)
and Repeating variants in every other case.
Last, this patch also makes some changes in brave_rewards_api.{h,cc}
to use weak pointers instead of base::Unretained() when binding
callbacks, for extra safety (and consistency with existing code).
[1] https://chromium-review.googlesource.com/c/chromium/src/+/2867526
Resolves https://github.com/brave/brave-browser/issues/15855
This is the very first step towards a clearer way to organize and
state dependencies between targets: for now we just remove this
target and fold everything into //chrome/browser via a massive
dump into browser/sources.gni with no further changes, plus the
necessary adaptations wherever the old target was referenced.
Once this is in place, next steps will extract different subsets
of the sources dumped in there into separate .gni files, so that
it can be more clearly stated which dependencies are actually
related to which subset of source files, instead of having the
giant merge of dependencies we had until now in a single target.
Once those separate .gni files are in place, and each of them
with their own clear set of dependencies, we should be in a much
better position to reorganize things and see what can be moved
around into independent GN targets instead of being part of the
//chrome/browser main target.
Finally, this change also makes the //brave/browser target a group
instead of a source_set and adjust visibility rules in a more
precise way, so that we can still reference //brave/browser from
different places in Brave (vs having to reference //chrome/browser).
Due to a collision with another target:
ERROR at //build/config/BUILDCONFIG.gn:570:5: Duplicate output file.
target(_target_type, _target_name) {
^-----------------------------------
Two or more targets generate the same output:
cpp.dll
This is can often be fixed by changing one of the target names, or by
setting an output_name on one of them.
Collisions:
//brave/services/network/public/cpp:cpp
//media/learning/mojo/public/cpp:cpp
Chromium change:
https://chromium.googlesource.com/chromium/src/+/96665a836d2b2ffab4951167fbf3230dbe3aec30
commit 96665a836d2b2ffab4951167fbf3230dbe3aec30
Author: liberato@chromium.org <liberato@chromium.org>
Date: Thu Jan 23 00:35:37 2020 +0000
Attach SmoothnessHelper to WMPI for MediaCap experiment
This CL also plumbs ukm::SourceId through BeginObservation, instead
of CompleteObservation so that default target values work.