66 Commits
Author SHA1 Message Date
Shivan effc1f3612 Skip body sniffing for Content-Disposition: attachment responses (#34589)
Responses marked as downloads (Content-Disposition: attachment) were
being body-sniffed, which meant De-AMP redirected to a canonical URL
instead of downloading the file. 

Check for attachment disposition early in the throttle handlers/producers.
2026-03-11 06:34:11 +00:00
cdesouza-chromium 164ed33c3d [CodeHealth] Use base::DictValue/base::ListValue - Part XII (#33721)
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
2026-02-06 15:03:15 -03:00
Claudio DeSouza d4b6dc4fe9 [cr145] BrowserList::size() deleted
In most cases this is being replaced with
`chrome::GetTotalBrowserCount()`.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/64c605ab89727cdd821c724ee5870933b09b6beb

commit 64c605ab89727cdd821c724ee5870933b09b6beb
Author: Qikai <qikaizhong@microsoft.com>
Date:   Wed Dec 17 09:46:02 2025 -0800

    [bedrock] Remove unused BrowserList::size() method

    The size() method is no longer referenced anywhere in the codebase and
    can be safely removed.

    Bug: 431671320
    Change-Id: I014cde7e669a325f9e29f5f22e32c7910d383d31
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7269944
    Auto-Submit: Qikai Zhong <qikaizhong@microsoft.com>
    Reviewed-by: Tom Lukaszewicz <tluk@chromium.org>
    Commit-Queue: Tom Lukaszewicz <tluk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1560010}
2026-01-29 13:40:43 -05:00
cdesouza-chromium 68a84b8637 [IWYU] Dropping several superfluous std inclusions (#32830)
This PR removes several superfluous inclusions for <map>, <vector>,
and <string>. This is a mechanical change.

```
git ls-files components | grep '\.cc$' | xargs grep -l '<vector>$' | \
  xargs grep -L std::vector | \
  xargs ../tools/add_header.py --remove --header '<vector>'

git ls-files components | grep '\.cc$' | xargs grep -l '<string>$' | \
  xargs grep -L std::wstring | xargs grep -L std::string | xargs grep -L std::u16string | xargs grep -L std::npos | \
  xargs ../tools/add_header.py --remove --header '<string>'

git ls-files components | grep '\.cc$' | xargs grep -l '<map>$' | \
  xargs grep -L std::map | xargs grep -L std::multimap | \
  xargs ../tools/add_header.py --remove --header '<map>'
```

Bug: https://github.com/brave/brave-browser/issues/42212
2025-12-16 14:01:06 +00:00
Claudio DeSouza 7d54897d85 [cr143] InProcessBrowserTest::SelectFirstBrowser() removed
This value is now set with the help of `BrowserCreatedObserver`.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/5202ab57139b9c0d8a6be73af944eb5601a09d74

commit 5202ab57139b9c0d8a6be73af944eb5601a09d74
Author: Thomas Lukaszewicz <tluk@chromium.org>
Date:   Wed Oct 8 18:22:18 2025 -0700

    [bedrock] Remove InProcessBrowserTest::SelectLastActive()

    There are no intended behavioral changes in this CL, this is purely
    a test refactor.

    This CL replaces all remaining uses of SelectFirstBrowser() with
    SetBrowser(), forcing tests to be explicit which Browser instance
    is being set to default - eliminating the dependency on
    BrowserList ordering.

    During setup the last-active Browser is now set as the default
    Browser instance. In the vast majority of cases (barring possibly
    session-restore browser tests) this is the only Browser instance in
    the environment.

    Bug: 431672609
    Change-Id: I0c0eb6e0a7a5b8a7d194c6b27ee3f90ac2972c1b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7019129
    Commit-Queue: Tom Lukaszewicz <tluk@chromium.org>
    Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1527272}
2025-11-18 11:18:51 -05:00
cdesouza-chromium 07b587a892 [CodeHealth] Use BASE_FEATURE with two args where possible (#32041)
This PR corrects several places where `BASE_FEATURE` is being used to
rely on the two-arg variant of this macro. This particular PR has no
functional changes, and the only feature declarations affected are the
ones for which the feature-name constant, and the actual value are
identical.

The particular issue for this will be left open so subsequent work for
the other features can be followed up on.

Bug: https://github.com/brave/brave-browser/issues/50492
2025-10-27 18:56:50 +00:00
Claudio DeSouza cc79061ccb base::JSONReader::ReadList requires options
This is being done by upstream to migrate the parser away from using
`JSON_PARSE_CHROMIUM_EXTENSIONS` as a default.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/606a5254fc9193a310de36fd750861eacce1d612

commit 606a5254fc9193a310de36fd750861eacce1d612
Author: Daniel Cheng <dcheng@chromium.org>
Date:   Mon Sep 22 21:42:27 2025 -0700

    Remove base::JSONReader::ReadList's default argument for parsing options

    Callers should be explicit if they need to opt into non-compliant JSON
    parsing that allows Chromium-specific extensions, e.g. comments.

    Bug: 446188265
    Change-Id: Icec12f00b124837e6820216cd87c9d52af47f4e5
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6975033
    Reviewed-by: Lei Zhang <thestig@chromium.org>
    Commit-Queue: Daniel Cheng <dcheng@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1519103}
2025-10-15 20:31:10 -04:00
Claudio DeSouza 0ef6dad0df [cr141] IWYU fixes 2025-09-22 14:59:27 -04:00
cdesouza-chromium 468ce215b7 [CodeHealth] IWYU for absl::StrFormat (#30441)
This PR runs a mechanical change to do IWYU on all files using the new
abseil functions, while also removing the old header inclusions for
`base::StringPrintf`.

A presubmit `BanRule` is also being added for the `base::` functions.

Resolves https://github.com/brave/brave-browser/issues/48143
2025-08-05 18:20:12 +01:00
cdesouza-chromium 5eb666f034 [CodeHealth] Run gn format on all files (#30448)
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
2025-08-05 18:08:10 +01:00
cdesouza-chromium c100289833 [CodeHealth] Remove uses of base::StringPrintf pt.4 (#30395)
This PR has additional replacements for base::StringPrintf with the
underlying abseil implementation absl::StrFormat.

This is mostly a mechanical change.

Resolves https://github.com/brave/brave-browser/issues/48076
2025-08-01 12:06:49 +01:00
Anton Paymyshev 65012521f9 Fix implicit deps on chromium components (#29840)
image_fetcher infobars keep_alive_registry language metrics network_session_configurator network_time
2025-07-01 21:53:40 +07:00
Anton Paymyshev 5f00c94751 Fix implicit deps on components/user_prefs (#29772) 2025-06-27 11:28:47 +07:00
Anton Paymyshev 18188bafcd Fix implicit deps on components/prefs (#29649) 2025-06-20 14:33:58 +07:00
Emerick Rogul 32f4a7b272 Add missing //chrome/browser/profiles/keep_alive dep 2025-06-11 17:07:39 -04:00
cdesouza-chromium 3998467be9 [IWYU] Fixing logging inclusions //components (#29511)
This change is one of many fixing inclusion for the following files:

    - `base/notimplemented.h`
    - `base/notreached.h`
    - `base/check.h`
    - `base/dcheck_is_on.h`
    - `base/check_deref.h`
    - `base/check_op.h`
    - `base/logging/log_severity.h`
    - `base/logging.h`

This change is a mechanical change done with the following script:
https://github.com/brave/brave-browser/issues/46707#issuecomment-2960116515

Resolves https://github.com/brave/brave-browser/issues/46707
2025-06-11 16:03:11 +01:00
cdesouza-chromium d05979d19c [iwyu] Fixing inclusions for string_util.h pt.2 (#29378)
Files that use functions from `string_util.h` should include that header
directly instead of relying on transient inclusions.

This is a mechanical change using this script:

```sh
remove_header_if_unused() {
    files=$(git grep -l "base/strings/string_util.h")
    for file in $files; do
        if ! git grep -qE "base::MakeStringPiece|base::MakeWStringView|base::ToLowerASCII|base::ToUpperASCII|base::CompareCaseInsensitiveASCII|base::EqualsCaseInsensitiveASCII|base::EmptyString|base::RemoveChars|base::ReplaceChars|base::TrimPositions|base::TrimString|base::TruncateUTF8ToByteSize|base::TrimWhitespace|base::CollapseWhitespace|base::ContainsOnlyChars|base::IsStringUTF8|base::IsStringASCII|base::EqualsASCII|base::CompareCase|base::StartsWith|base::EndsWith|base::RemovePrefix|base::RemoveSuffix|base::IsAscii|base::IsUnicodeControl|base::IsHexDigit|base::IsUnicodeWhitespace|base::FormatBytesUnlocalized|base::ReplaceFirstSubstringAfterOffset|base::ReplaceSubstringsAfterOffset|base::WriteInto|base::JoinString|base::ReplaceStringPlaceholders|base::MakeStringViewWithNulChars" "$file"; then
            sed -i '/base\/strings\/string_util.h/d' "$file"
            echo "Removed 'base/strings/string_util.h' from $file"
        fi
    done
}

add_header_if_needed() {
    files=$(git grep -lE "base::MakeStringPiece|base::MakeWStringView|base::ToLowerASCII|base::ToUpperASCII|base::CompareCaseInsensitiveASCII|base::EqualsCaseInsensitiveASCII|base::EmptyString|base::RemoveChars|base::ReplaceChars|base::TrimPositions|base::TrimString|base::TruncateUTF8ToByteSize|base::TrimWhitespace|base::CollapseWhitespace|base::ContainsOnlyChars|base::IsStringUTF8|base::IsStringASCII|base::EqualsASCII|base::CompareCase|base::StartsWith|base::EndsWith|base::RemovePrefix|base::RemoveSuffix|base::IsAscii|base::IsUnicodeControl|base::IsHexDigit|base::IsUnicodeWhitespace|base::FormatBytesUnlocalized|base::ReplaceFirstSubstringAfterOffset|base::ReplaceSubstringsAfterOffset|base::WriteInto|base::JoinString|base::ReplaceStringPlaceholders|base::MakeStringViewWithNulChars")
    for file in $files; do
        ../tools/add_header.py --header '"base/strings/string_util.h"' "$file"
    done
}

remove_header_if_unused
add_header_if_needed

```

Resolves https://github.com/brave/brave-browser/issues/46559
2025-06-05 12:15:02 +01:00
cdesouza-chromium 254259ab2c [CodeHealth] Simplifying json parsing - pt.5 (#27884)
This PR simplifies JSON reading in several places by:

    - Using `base::JSONReader::ReadDict`
    - Using `base::JSONReader::ReadList`
    - Using `base::test::ParseJson*`

This changes aim to make the checks around the parsing and its
expectations simpler to read.
2025-03-03 14:53:41 +00:00
Pavel Beloborodov d9eb05c2ad [DeAmp] Fixed self cycle. (#27411) 2025-02-12 17:44:23 -08:00
Max Karolinskiy e781e373c8 [cr133] Disables a couple of flaky-on-CI tests on MacOS. 2025-01-27 09:41:50 -05:00
Brian Johnson afd4e0239d fix overly permissive DEPS (#27193)
Fix overly permissive deps
2025-01-12 21:43:04 -07:00
Pavel Beloborodov e937963c71 Disable cosmetic filtering on Speedreader pages (#25692)
* Disabled cosmetic filters on speedreader pages.
2024-12-06 11:55:00 +07:00
Pavel Beloborodov 72869b9a7b Strictly check no more than kMaxBytesToCheck bytes in the buffer. (#26344) 2024-11-04 10:42:11 +01:00
cdesouza-chromium 1a3eb65e92 [DanglingPtr][linux] Dangling violations as untriaged (#26244)
This PR marks all the dangling pointers causing test crahses on linux as
`DanglingUntriaged`. This is the first step to gradually permit us to
switch on the our dangling pointer check in our CI. This change does not
include upstream patches, that may be required depending on how
difficult it becomes to fix those.

Resolves https://github.com/brave/brave-browser/issues/41896
2024-10-28 16:02:49 +00:00
Pavel Beloborodov 8ee53fd6e7 Replaced NOTREACHED_IN_MIGRATION with NOTREACHED. (#26229) 2024-10-26 14:57:40 +07:00
cdesouza-chromium b6b98fff4c [CodeHealth] Remove empty param lists for lambdas (#25928)
In cxx20 and higher, lambda function syntax can omit the empty param
list in some cases. This change removes these occurrences to reduce code
clutter.
2024-10-10 22:23:53 +01:00
cdesouza-chromium e1f8a28431 [CodeHealth] Use constexpr strings (#25810)
Use `constexpr` strings

This PR changes moves away from uses of `const char` with two
approaches. For `.cc` files, these types are turned into constexpr ones,
which gives the compiler more leeway for optimisations.

For the constants on header files, we are converting these instances to
`inline constexpr`, in order to also reduce string duplication across
the binary.

This change was generated with a tool.
2024-10-04 10:01:05 -07:00
Pavel Beloborodov 4d68db921d Strictly check no more than kMaxBytesToCheck bytes in the buffer. (#25740) 2024-10-03 17:18:52 +07:00
Claudio DeSouza cc0aa3933c GetHeader out-param variant removed
The optional-based variant is the only method left. This change corrects
all remaining uses we had for the out-param one.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/0b37c6610cabc65262c79de9a2f9c332d244db82

commit 0b37c6610cabc65262c79de9a2f9c332d244db82
Author: Chris Fredrickson <cfredric@chromium.org>
Date:   Fri Aug 16 14:51:17 2024 +0000

    Remove unused GetHeader overload

    Fixed: 355451174
2024-09-10 14:42:45 -04:00
Claudio DeSouza 25ca04aed6 NotificationService has been deleted
This change removes the unnecessary header inclusions for this type that
has been removed in previous iterations.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/ad2fa76e065ded6bc8b1a606b06bd3f3e11c609c

commit ad2fa76e065ded6bc8b1a606b06bd3f3e11c609c
Author: Avi Drissman <avi@chromium.org>
Date:   Wed Jul 24 15:48:35 2024 +0000

    Remove the NotificationService

    Fixed: 40327896
    Fixed: 40299241
    Fixed: 40746966
    Change-Id: Ic0652a24abd58a6bdda66b380d1ffd29b7af7572
2024-09-10 14:42:25 -04:00
Claudio DeSouza a19c44fed1 Use NOTREACHED_IN_MIGRATION()
`NOTREACHED()` has been marked as `[[noreturn]]`, and therefore will
break in many cases when building the code. The migration variant of the
macro is being used upstream to allow for a gradual migration of each
callsite.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/61831cb39155842c781f63214a7862bfd23e3390

commit 61831cb39155842c781f63214a7862bfd23e3390
Author: Peter Boström <pbos@chromium.org>
Date:   Wed May 22 21:32:53 2024 +0000

    Reland "Make NOTREACHED() without parameters [[noreturn]]"

    This is a reland of commit fdeac78ccd92e2cc578d8cfa04219599520138b4

    Original change's description:
    > Make NOTREACHED() without parameters [[noreturn]]
    >
    > Previous callers have been migrated to NOTREACHED_IN_MIGRATION(). This
    > also renames the few NOTREACHED_NORETURN() callers in base/ to
    > NOTREACHED() to verify that it's still working (no missing-return).
    >
    > Let's see how many times this needs to be reverted and relanded. :)
    >
    > Bug: 40580068
    > Change-Id: Ib8155e461ea9d0853c9508e28fc45389114da48c
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5548908
    > Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
    > Commit-Queue: Lei Zhang <thestig@chromium.org>
    > Owners-Override: Lei Zhang <thestig@chromium.org>
    > Auto-Submit: Peter Boström <pbos@chromium.org>
    > Commit-Queue: Peter Boström <pbos@chromium.org>
    > Reviewed-by: Lei Zhang <thestig@chromium.org>
    > Cr-Commit-Position: refs/heads/main@{#1303439}

    Bug: 40580068
2024-06-25 13:13:09 +01:00
cdesouza-chromium 7814e17784 [clang-tidy] Modernise namespaces (#24272)
Modernising all namespaces in brave to use nested concat namespace
declarations.

This change is part of a large effort to modernise the brave codebase
across the board with `clang-tidy`, in order to allow future use of
`clang-duty`during code reviews. The idea is to apply a few modernisers
across the codebase in order to have less noise when trying to use
clang-tidy with some sort of autmoation.
2024-06-21 17:12:18 +01:00
Brian Johnson 5b9f860a1f Browser test fixes (#23657)
Fixes various setup issues in browser tests that were causing tests to crash in debug mode where `!NDEBUG` checks are enabled
2024-06-03 16:23:44 -07:00
Claudio DeSouza 9ddc48293d OpenURLFromTab now taking a handle callback
This extra argument for completion has been added upstream, and some
code in brave could be improved with this. This change however
concentrates in getting the code to build, so a default empty event is
passed in its place.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/0d795c6e8be398088fdd747cb4fa4b7c7e366878

commit 0d795c6e8be398088fdd747cb4fa4b7c7e366878
Author: HuanPo Lin <robertlin@chromium.org>
Date:   Thu Mar 28 03:54:05 2024 +0000

    preloading: Add NewTabPagePageLoadMetricsObserver

    This CL adds NewTabPagePageLoadMetricsObserver and adds base::OnceCallback<void(content::NavigationHandle&)>
    navigation_handle_callback to PageNavigator::OpenURL and
    WebContentsDelegate::OpenURLFromTab to attach NavigationHandleUserData for identifying whether a navigation is initiated by NewTabPage.
    Please refer to
    https://docs.google.com/document/d/11VtFdLTjOOQoUi_MnycnNgwtI1liYd_4u7zWzb6OcEY/edit?usp=sharing for more details.

    Bug: 1462832
2024-05-03 16:54:08 -04:00
Shivan Kaul Sahibandboocmp eb91a1a601 Only De-AMP HTML pages (check MIME type) (#22978)
Co-authored-by: boocmp <boocmp@yandex.ru>
2024-04-10 19:11:24 -07:00
Pavel Beloborodov d3c0dc3203 Refactoring of the BodySnifferThrottle. (#21792)
* Refactoring of the BodySnifferThrottle.
* Speedreader throttles moved to the new logic.
* De-amp throttle moved to the new logic.
* Improved De-amp throttle support of the chained AMP pages.
* AiChatResourceSniffer moved to the new logic.
2024-03-29 20:46:33 +07:00
Claudio DeSouza 57e28aa1a7 Fixing IWYU failures for browser_test_base.h
Upstream has removed certain headers from the inclusion chains to reduce
building times, which has broken a few browser tests.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/a47d7859c400272c6e3055f1225d297ab94031e2

commit a47d7859c400272c6e3055f1225d297ab94031e2
Author: Takuto Ikuta <tikuta@chromium.org>
Date:   Mon Feb 19 03:46:58 2024 +0000

    autofill: remove unnecessary include from browser_test_base.h

    This is extracted from https://crrev.com/c/5280997 to reduce compile
    time of some test files.

    content/public/test/browser_test_base.h is the file removing
    unnecessary header.

    Bug: b/324519459
2024-03-08 14:56:09 -05:00
Shivan Kaul Sahib bb932438b4 Script injector component tests (#20884)
* Fix up script_injector mojom build deps
2023-11-15 18:42:10 -08:00
cdesouza-chromium 75bbf7d53c Convert various extern strings to constexpr (#20959)
These change are being done to make use of `absl::StrFormat` in the
future, and also to get some better codegen with these constants.
There's also some harderning on upstream code to avoid unnecessary
conversions involving constants, which can only be enforced in a
`constexpr` constext.
2023-11-15 09:02:30 +00:00
Claudio DeSouza 80f1037df1 IWYU fixes for notification_service.h
This change adds the use of the header in places making use of its
content in certain tests. Upstream is doing refactoring changes around
the use of `content::NotificationService`, which has led to these
failures.
2023-09-06 12:38:43 +01:00
cdesouza-chromium f9dc6f25ca Use raw_ref<T>/raw_ptr<T> for data members (#18113)
This change corrects all sites where pointer fields were still remaining
in the codebase, and replaces them with `raw_ptr<T>`, and `raw_ref<T>`.
This is in accordance with upstream hardening requirements, which are
about to be enforced by chromium's clang plugin, in M114.

This change goes one step further, and replaces pointer with references
in types where nullptr values are not supposed to be supported.
2023-04-19 23:59:22 +02:00
Pavel Beloborodov 851e8ea8a3 Added on-demand mode for speedreader. (#17380)
* Added on-demand mode for speedreader.
* Added PageDistiller.
2023-04-07 10:18:22 +07:00
Emerick Rogul 7d7bca1cef bind.h, callback{,_forward,_helpers}.h now located in //base/functionality
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
2023-02-22 06:29:17 -05:00
cdesouza-chromium 932606f421 Task posting v3 handle refactor (#16857)
Task posting v3 handle refactor - II

This change is following upstream refactor for task runner provisioning.
This primarily involves changing how we are fetching the default current
sequence/thread runners.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/edb604e09fa4ac6eb56f447b643085afda6150a9

commit edb604e09fa4ac6eb56f447b643085afda6150a9
Author: Sean Maher <spvw@chromium.org>
Date:   Thu Jan 12 15:18:20 2023 +0000

    task posting v3: Remove task runner handles from codebase entirely

    As the last CL of the task runner handle refactor, this CL removes
    Single and Thread task runner handles from the codebase entirely. The
    new API for this functionality can be found under
    (SingleThread|Sequenced)TaskRunner::CurrentDefaultHandle,
    ::GetCurrentDefault(), ::HasCurrentDefault(), and
    ::CurrentHandleOverride(ForTesting).

    Bug: 1026641
2023-01-27 09:49:00 +00:00
Shivan Kaul Sahib de86b14eca Update regex for De-AMP (#16431)
Add tests
2022-12-20 15:50:24 -08:00
mkarolin 9299e9ac71 Use macros for declaring/defining features.
Following Chromium's lead:

"Issue 1364289: Sort out constexpr base::Feature"

https://bugs.chromium.org/p/chromium/issues/detail?id=1364289
2022-11-14 14:11:50 -05:00
Claudio DeSouza f406e3b034 base::expected restricted for implicit conversions
Chromium change:
https://chromium.googlesource.com/chromium/src/+/07dfbdcdf84741518ae37b7820de32f9e3fab140

commit 07dfbdcdf84741518ae37b7820de32f9e3fab140
Author: Daniel Cheng <dcheng@chromium.org>
Date:   Thu Oct 6 17:33:46 2022 +0000

    Further restrict implicit value conversions to base::expected.

    Only allow implicit conversions from U to base::expected<T, E> if U is
    *not* implicitly convertible to E. This makes it harder to write bugs of
    the form:

      // `e` contains an expected value of `true`, not an unexpected value
      // of `123L`.
      base::expected<bool, long> e = 123L;

    As a Chromium extension to the C++23 std::expected proposal, this also
    adds a `base::ok` hint to simplify construction of a `base::expected`
    containing a value when the implicit conversion is disallowed.

    While the C++23 proposal chose not to go this route, section 3.7 calls
    a hypothetical version of this `success`. Chromium chooses to call this
    `base::ok` because:
    - it is succinct (every column is precious when there's only 80!)
    - has precedence, e.g. Rust's Result enum uses Ok.

    Bug: 1369769
2022-11-14 14:11:11 -05:00
Claudio DeSouza fab7a3bfda Using base::test::FeatureRef as a view type
Chromium change
https://chromium.googlesource.com/chromium/src/+/f93d399969cc7d7836a47b40fae283f70d9e4d51

commit f93d399969cc7d7836a47b40fae283f70d9e4d51
Author: Daniel Cheng <dcheng@chromium.org>
Date:   Tue Oct 4 02:11:39 2022 +0000

    Add overloads to avoid copying base::Feature with ScopedFeatureList.

    A base::Feature should not be copyable; a feature is intended to have a
    single global instance, as it caches internal mutable state.

    One major reason features are copied is to specify lists of features to
    enable or disable in tests. This use case is addressed by the addition
    of a base::test::FeatureRef helper.

    To aid incremental migration, this CL just adds overloads but makes no
    actual migration. Followups will change `std::vector<base::Feature>`
    into `std::vector<base::test::FeatureRef>`, and the compatibility
    overloads will be removed after that.

    A few small test fixes are required to disambiguate callers that
    accidentally wrapped lists of features with extra {}'s: with the new
    overloads, it becomes ambiguous which std::vector overload to choose.
    Simply remove the extra {}'s so that the std::initializer_list
    overload is chosen instead.

    Bug: 1370572
2022-11-14 14:11:10 -05:00
Claudio DeSouza bbcd14be67 base::Feature cannot be foward-declared anymore
Chromium change:
https://chromium.googlesource.com/chromium/src/+/9dbbbda3d576a40b107535bf18e150ee68f169ad

commit 9dbbbda3d576a40b107535bf18e150ee68f169ad
Author: Anthony Vallee-Dubois <anthonyvd@chromium.org>
Date:   Fri Aug 26 01:25:31 2022 +0000

    Add gnu::abi_tag("logically_const") to base::Feature

    This is in preparation of landing https://chromium-review.googlesource.com/c/chromium/src/+/3683086, which adds a mutable field to base::Feature. Adding the "logically_const" tag in this way will allow the binary_size bot to ignore the fact that const base::Feature objects will now exist in non-readonly sections of the binary.

    Adding this annotation breaks forward declarations, so all of the existing base::Feature forward declarations are replaced by "base/feature_list.h" includes.

    Bug: 1341292
2022-09-15 20:46:20 -04:00
Claudio DeSouza af511ff091 [CodeHealth] Clang-tidy make_unique modernise II
This change applies clang-tidy with modernize-make-unique to the
codebase, correcting all instatiations of unique_ptr to use
std::make_unique.
2022-08-30 12:04:55 +01:00