0

Replace ABSL_ATTRIBUTE_* with base/ macros.

Approved on
https://groups.google.com/a/chromium.org/g/cxx/c/lVQOJTng1RU.

Bug: none
Change-Id: Ibe0f8f16bce55b3ede4c1e1d2720e83e8dd4faf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5852373
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Owners-Override: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1356840}
This commit is contained in:
Peter Kasting
2024-09-18 00:56:11 +00:00
committed by Chromium LUCI CQ
parent 5edbc5ad41
commit 4b18d0c047
108 changed files with 356 additions and 262 deletions
DEPS
ash
assistant
constants
base
chrome
browser
password_manager
safe_browsing
test
chromeos
ash
components
attestation
audio
cryptohome
dbus
login
auth
integrity
session
network
tpm
services
recording
components
onc
dbus
components
content
device/gamepad
docs/speed/binary_size
extensions/renderer
gin
gpu/command_buffer/service
ipc
mojo
net/base
ppapi/shared_impl
remoting/host/win
styleguide/c++
third_party
ui

1
DEPS

@ -4707,6 +4707,7 @@ include_rules = [
# //styleguide/c++/c++-features.md.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/no_destructor.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',

@ -32,6 +32,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -13,6 +13,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -17,7 +17,6 @@
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "build/robolectric_buildflags.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/jni_zero/jni_zero.h"
#if BUILDFLAG(IS_ROBOLECTRIC)

@ -155,8 +155,7 @@ inline char* CheckOpValueStr(const T& v) {
// use with CheckOpValueStr() which allocates these strings using strdup().
// Returns allocated string (with strdup) for passing into
// ::logging::CheckError::(D)CheckOp methods.
// TODO(pbos): Annotate this ABSL_ATTRIBUTE_RETURNS_NONNULL after solving
// compile failure.
// TODO(pbos): Annotate this RETURNS_NONNULL after solving compile failure.
BASE_EXPORT char* CreateCheckOpLogMessageString(const char* expr_str,
char* v1_str,
char* v2_str);

@ -725,6 +725,155 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) {
#define LIFETIME_BOUND
#endif
// Annotates a function or variable to indicate that it should have weak
// linkage. Useful for library code that wants code linking against it to be
// able to override its functionality; inside a single target, this is better
// accomplished via virtual methods and other more standard mechanisms.
//
// Any weak definition of a symbol will be overridden at link time by a non-weak
// definition. Marking a `const` or `constexpr` variable weak makes it no longer
// be considered a compile-time constant, since its value may be different after
// linking.
//
// Multiple weak definitions of a symbol may exist, in which case the linker is
// free to select any when there are no non-weak definitions. Like with symbols
// marked `inline`, this can lead to subtle, difficult-to-diagnose bugs if not
// all definitions are identical.
//
// A weak declaration that has no definitions at link time will be linked as if
// the corresponding address is null. Therefore library code can use weak
// declarations and conditionals to allow consumers to provide optional
// customizations.
//
// See also:
// https://clang.llvm.org/docs/AttributeReference.html#weak
//
// Usage:
// ```
// // The following definition defaults `x` to 10, but allows other object
// // files to override its value. Thus, despite `constexpr`, `x` is not
// // considered a compile-time constant (and cannot be used in a `constexpr`
// // context).
// extern const int x;
// WEAK_SYMBOL constexpr int x = 10;
//
// // The following declaration allows linking to occur whether a definition
// // of `Func()` is provided or not; if none is present, `&Func` will
// // evaluate to `nullptr` at runtime.
// WEAK_SYMBOL void Func();
//
// // The following definition provides a default implementation of `Func2()`,
// // but allows other object files to override.
// WEAK_SYMBOL void Func2() { ... }
// ```
#if __has_cpp_attribute(gnu::weak)
#define WEAK_SYMBOL [[gnu::weak]]
#else
#define WEAK_SYMBOL
#endif
// Annotates a function indicating that the compiler should not convert calls
// within it to tail calls.
//
// For a callee-side version of this, see `NOT_TAIL_CALLED`.
//
// See also:
// https://clang.llvm.org/docs/AttributeReference.html#disable-tail-calls
// Usage:
// ```
// DISABLE_TAIL_CALLS void Func() {
// // Function calls in this body will not be tail calls.
// }
// ```
#if __has_cpp_attribute(clang::disable_tail_calls)
#define DISABLE_TAIL_CALLS [[clang::disable_tail_calls]]
#else
#define DISABLE_TAIL_CALLS
#endif
// Annotates a type or member indicating the minimum possible alignment (one bit
// for bitfields, one byte otherwise) should be used. This can be used to
// eliminate padding inside objects, at the cost of potentially pessimizing
// code, or even generating invalid code (depending on platform restrictions) if
// underaligned objects have their addresses taken and passed elsewhere.
//
// This is similar to the more-broadly-supported `#pragma pack(1)`.
//
// See also:
// https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-packed-variable-attribute
//
// Usage:
// ```
// struct PACKED_OBJ S1 {
// int8_t a; // Alignment 1, offset 0, size 1
// int32_t b; // Alignment 1, offset 1 (0 bytes padding), size 4
// }; // Overall alignment 1, 0 bytes trailing padding, overall size 5
//
// struct S2 {
// int8_t a; // Alignment 1, offset 0, size 1
// int32_t b; // Alignment 4, offset 4 (3 bytes padding), size 4
// int8_t c; // Alignment 1, offset 8 (0 bytes padding), size 1
// PACKED_OBJ int32_t d; // Alignment 1, offset 9 (0 bytes padding), size 4
// }; // Overall alignment 4, 3 bytes trailing padding, overall size 16
// ```
#if __has_cpp_attribute(gnu::packed)
#define PACKED_OBJ [[gnu::packed]]
#else
#define PACKED_OBJ
#endif
// Annotates a function indicating that the returned pointer will never be null.
// This may allow the compiler to assume null checks on the caller side are
// unnecessary.
//
// In practice, this is usually better-handled by returning a value or
// reference, which enforce such guarantees at the type level.
//
// See also:
// https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-returns_005fnonnull-function-attribute
// https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes
//
// Usage:
// ```
// // The following function will never return `nullptr`.
// RETURNS_NONNULL int* Func();
// ```
#if __has_cpp_attribute(gnu::returns_nonnull)
#define RETURNS_NONNULL [[gnu::returns_nonnull]]
#else
#define RETURNS_NONNULL
#endif
// Annotates a function indicating it is const, meaning that it has no
// observable side effects and its return value depends only on its arguments.
// Const functions may not read external memory other than unchanging objects
// (e.g. non-volatile constants), and the compiler is free to replace calls to
// them with the return values of earlier calls with the same arguments no
// matter what other state might have changed in the meantime.
//
// This is a much stronger restriction than `const`-qualified functions, and is
// rarely appropriate outside small local helpers, which are frequently
// inlineable anyway and would not really benefit.
//
// WARNING: Misusing this attribute can lead to silent miscompilation, UB, and
// difficult-to-diagnose bugs. For this and the above reason, usage should be
// very rare.
//
// See also:
// https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute
//
// Usage:
// ```
// // The compiler may replace calls to this function with values returned
// // from earlier calls, assuming the args match.
// CONST_FUNCTION int Func(int);
// ```
#if __has_cpp_attribute(gnu::const)
#define CONST_FUNCTION [[gnu::const]]
#else
#define CONST_FUNCTION
#endif
// Annotates a function indicating it is pure, meaning that it has no observable
// side effects. Unlike functions annotated `CONST_FUNCTION`, pure functions may
// still read external memory, and thus their return values may change between

@ -13,7 +13,6 @@
#include "base/compiler_specific.h"
#include "base/containers/span.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
@ -117,23 +116,17 @@ class TRIVIAL_ABI GSL_OWNER HeapArray {
// Prefer span-based methods below over data() where possible. The data()
// method exists primarily to allow implicit constructions of spans.
// Returns nullptr for a zero-sized (or moved-from) array.
T* data() ABSL_ATTRIBUTE_LIFETIME_BOUND { return data_.get(); }
const T* data() const ABSL_ATTRIBUTE_LIFETIME_BOUND { return data_.get(); }
T* data() LIFETIME_BOUND { return data_.get(); }
const T* data() const LIFETIME_BOUND { return data_.get(); }
iterator begin() ABSL_ATTRIBUTE_LIFETIME_BOUND { return as_span().begin(); }
const_iterator begin() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
return as_span().begin();
}
iterator begin() LIFETIME_BOUND { return as_span().begin(); }
const_iterator begin() const LIFETIME_BOUND { return as_span().begin(); }
iterator end() ABSL_ATTRIBUTE_LIFETIME_BOUND { return as_span().end(); }
const_iterator end() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
return as_span().end();
}
iterator end() LIFETIME_BOUND { return as_span().end(); }
const_iterator end() const LIFETIME_BOUND { return as_span().end(); }
T& operator[](size_t idx) ABSL_ATTRIBUTE_LIFETIME_BOUND {
return as_span()[idx];
}
const T& operator[](size_t idx) const ABSL_ATTRIBUTE_LIFETIME_BOUND {
T& operator[](size_t idx) LIFETIME_BOUND { return as_span()[idx]; }
const T& operator[](size_t idx) const LIFETIME_BOUND {
return as_span()[idx];
}
@ -141,12 +134,12 @@ class TRIVIAL_ABI GSL_OWNER HeapArray {
// constructible from HeapArray<T>, so an explicit call to .as_span() is
// most useful, say, when the compiler can't deduce a template
// argument type.
base::span<T> as_span() ABSL_ATTRIBUTE_LIFETIME_BOUND {
base::span<T> as_span() LIFETIME_BOUND {
// SAFETY: `size_` is the number of elements in the `data_` allocation` at
// all times.
return UNSAFE_BUFFERS(base::span<T>(data_.get(), size_));
}
base::span<const T> as_span() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
base::span<const T> as_span() const LIFETIME_BOUND {
// SAFETY: `size_` is the number of elements in the `data_` allocation` at
// all times.
return UNSAFE_BUFFERS(base::span<const T>(data_.get(), size_));
@ -169,31 +162,31 @@ class TRIVIAL_ABI GSL_OWNER HeapArray {
// If `count` is unspecified, all remaining elements are included. A CHECK()
// occurs if any of the parameters results in an out-of-range position in
// the HeapArray.
base::span<T> subspan(size_t offset, size_t count = base::dynamic_extent)
ABSL_ATTRIBUTE_LIFETIME_BOUND {
base::span<T> subspan(size_t offset,
size_t count = base::dynamic_extent) LIFETIME_BOUND {
return as_span().subspan(offset, count);
}
base::span<const T> subspan(size_t offset,
size_t count = base::dynamic_extent) const
ABSL_ATTRIBUTE_LIFETIME_BOUND {
LIFETIME_BOUND {
return as_span().subspan(offset, count);
}
// Returns a span over the first `count` elements of the HeapArray. A CHECK()
// occurs if the `count` is larger than size of the HeapArray.
base::span<T> first(size_t count) ABSL_ATTRIBUTE_LIFETIME_BOUND {
base::span<T> first(size_t count) LIFETIME_BOUND {
return as_span().first(count);
}
base::span<const T> first(size_t count) const ABSL_ATTRIBUTE_LIFETIME_BOUND {
base::span<const T> first(size_t count) const LIFETIME_BOUND {
return as_span().first(count);
}
// Returns a span over the last `count` elements of the HeapArray. A CHECK()
// occurs if the `count` is larger than size of the HeapArray.
base::span<T> last(size_t count) ABSL_ATTRIBUTE_LIFETIME_BOUND {
base::span<T> last(size_t count) LIFETIME_BOUND {
return as_span().last(count);
}
base::span<const T> last(size_t count) const ABSL_ATTRIBUTE_LIFETIME_BOUND {
base::span<const T> last(size_t count) const LIFETIME_BOUND {
return as_span().last(count);
}

@ -27,7 +27,6 @@
#include "base/containers/dynamic_extent.h"
#include "base/numerics/safe_conversions.h"
#include "base/types/to_address.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
@ -1521,8 +1520,7 @@ constexpr auto make_span(Container&& container) noexcept {
// non-std helper that is inspired by the `std::slice::from_ref()` function from
// Rust.
template <typename T>
constexpr span<T, 1u> span_from_ref(
T& single_object ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept {
constexpr span<T, 1u> span_from_ref(T& single_object LIFETIME_BOUND) noexcept {
// SAFETY: Given a valid reference to `single_object` the span of size 1 will
// be a valid span that points to the `single_object`.
return UNSAFE_BUFFERS(span<T, 1u>(std::addressof(single_object), 1u));
@ -1536,12 +1534,12 @@ constexpr span<T, 1u> span_from_ref(
// references are turned into a `span<T, sizeof(T)>`.
template <typename T>
constexpr span<const uint8_t, sizeof(T)> byte_span_from_ref(
const T& single_object ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept {
const T& single_object LIFETIME_BOUND) noexcept {
return as_bytes(span_from_ref(single_object));
}
template <typename T>
constexpr span<uint8_t, sizeof(T)> byte_span_from_ref(
T& single_object ABSL_ATTRIBUTE_LIFETIME_BOUND) noexcept {
T& single_object LIFETIME_BOUND) noexcept {
return as_writable_bytes(span_from_ref(single_object));
}
@ -1559,7 +1557,7 @@ constexpr span<uint8_t, sizeof(T)> byte_span_from_ref(
// always preserved.
template <class CharT, size_t N>
constexpr span<const CharT, N - 1> span_from_cstring(
const CharT (&lit ABSL_ATTRIBUTE_LIFETIME_BOUND)[N])
const CharT (&lit LIFETIME_BOUND)[N])
ENABLE_IF_ATTR(lit[N - 1u] == CharT{0},
"requires string literal as input") {
return span(lit).template first<N - 1>();
@ -1582,7 +1580,7 @@ constexpr span<const CharT, N - 1> span_from_cstring(
// always preserved.
template <class CharT, size_t N>
constexpr span<const CharT, N> span_with_nul_from_cstring(
const CharT (&lit ABSL_ATTRIBUTE_LIFETIME_BOUND)[N])
const CharT (&lit LIFETIME_BOUND)[N])
ENABLE_IF_ATTR(lit[N - 1u] == CharT{0},
"requires string literal as input") {
return span(lit);
@ -1602,7 +1600,7 @@ constexpr span<const CharT, N> span_with_nul_from_cstring(
// always preserved.
template <size_t N>
constexpr span<const uint8_t, N - 1> byte_span_from_cstring(
const char (&lit ABSL_ATTRIBUTE_LIFETIME_BOUND)[N])
const char (&lit LIFETIME_BOUND)[N])
ENABLE_IF_ATTR(lit[N - 1u] == '\0', "requires string literal as input") {
return as_bytes(span(lit).template first<N - 1>());
}
@ -1624,7 +1622,7 @@ constexpr span<const uint8_t, N - 1> byte_span_from_cstring(
// always preserved.
template <size_t N>
constexpr span<const uint8_t, N> byte_span_with_nul_from_cstring(
const char (&lit ABSL_ATTRIBUTE_LIFETIME_BOUND)[N])
const char (&lit LIFETIME_BOUND)[N])
ENABLE_IF_ATTR(lit[N - 1u] == '\0', "requires string literal as input") {
return as_bytes(span(lit));
}
@ -1642,7 +1640,7 @@ constexpr auto as_byte_span(const Spannable& arg) {
template <int&... ExplicitArgumentBarrier, typename T, size_t N>
constexpr span<const uint8_t, N * sizeof(T)> as_byte_span(
const T (&arr ABSL_ATTRIBUTE_LIFETIME_BOUND)[N]) {
const T (&arr LIFETIME_BOUND)[N]) {
return as_bytes(make_span(arr));
}
@ -1664,13 +1662,13 @@ constexpr auto as_writable_byte_span(Spannable&& arg) {
// the span type signature span<uint8_t, N>.
template <int&... ExplicitArgumentBarrier, typename T, size_t N>
constexpr span<uint8_t, N * sizeof(T)> as_writable_byte_span(
T (&arr ABSL_ATTRIBUTE_LIFETIME_BOUND)[N]) {
T (&arr LIFETIME_BOUND)[N]) {
return as_writable_bytes(make_span(arr));
}
template <int&... ExplicitArgumentBarrier, typename T, size_t N>
constexpr span<uint8_t, N * sizeof(T)> as_writable_byte_span(
T (&&arr ABSL_ATTRIBUTE_LIFETIME_BOUND)[N]) {
T (&&arr LIFETIME_BOUND)[N]) {
return as_writable_bytes(make_span(arr));
}

@ -208,13 +208,13 @@ void FromRefNoSuchFunctionForIntLiteral() {
}
void FromRefLifetimeBoundErrorForIntLiteral() {
// Testing that `ABSL_ATTRIBUTE_LIFETIME_BOUND` works as intended.
// Testing that `LIFETIME_BOUND` works as intended.
[[maybe_unused]] auto wont_work =
span_from_ref<const int>(123); // expected-error@*:* {{temporary whose address is used as value of local variable 'wont_work' will be destroyed at the end of the full-expression}}
}
void FromRefLifetimeBoundErrorForTemporaryStringObject() {
// Testing that `ABSL_ATTRIBUTE_LIFETIME_BOUND` works as intended.
// Testing that `LIFETIME_BOUND` works as intended.
[[maybe_unused]] auto wont_work =
span_from_ref<const std::string>("temporary string"); // expected-error@*:* {{temporary whose address is used as value of local variable 'wont_work' will be destroyed at the end of the full-expression}}
}

@ -17,14 +17,13 @@
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "base/threading/thread_restrictions.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace {
// Per-thread FileDescriptorWatcher registration.
ABSL_CONST_INIT thread_local FileDescriptorWatcher* fd_watcher = nullptr;
constinit thread_local FileDescriptorWatcher* fd_watcher = nullptr;
} // namespace

@ -10,9 +10,9 @@
#include <type_traits>
#include <utility>
#include "base/compiler_specific.h"
#include "base/functional/bind_internal.h"
#include "base/types/is_instantiation.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/abseil-cpp/absl/functional/function_ref.h"
namespace base {
@ -71,7 +71,7 @@ class FunctionRef<R(Args...)> {
std::same_as<internal::ExtractArgs<RunType>, internal::TypeList<Args...>>;
public:
// `ABSL_ATTRIBUTE_LIFETIME_BOUND` is important; since `FunctionRef` retains
// `LIFETIME_BOUND` is important; since `FunctionRef` retains
// only a reference to `functor`, `functor` must outlive `this`.
template <typename Functor>
requires kCompatibleFunctor<Functor> &&
@ -98,7 +98,7 @@ class FunctionRef<R(Args...)> {
(!internal::is_instantiation_v<absl::FunctionRef,
std::decay_t<Functor>>)
// NOLINTNEXTLINE(google-explicit-constructor)
FunctionRef(const Functor& functor ABSL_ATTRIBUTE_LIFETIME_BOUND)
FunctionRef(const Functor& functor LIFETIME_BOUND)
: wrapped_func_ref_(functor) {}
// Constructs a reference to the given function pointer. This constructor

@ -12,7 +12,6 @@
#include <sanitizer/asan_interface.h>
#include "base/memory/raw_ptr_asan_service.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
@ -20,7 +19,7 @@ namespace {
// We use thread-local storage instead of sequence-local storage for consistency
// with PendingReport in RawPtrAsanService.
ABSL_CONST_INIT thread_local RawPtrAsanBoundArgTracker::ProtectedArgsVector*
constinit thread_local RawPtrAsanBoundArgTracker::ProtectedArgsVector*
protected_args = nullptr;
} // namespace

@ -27,7 +27,6 @@
#include "base/process/process.h"
#include "base/strings/stringprintf.h"
#include "base/task/thread_pool/thread_group.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
@ -48,7 +47,7 @@ constexpr uint8_t kAsanUserPoisonedMemoryMagic = 0xf7;
// doesn't prevent sharing of PendingReport contents between unrelated tasks, so
// we keep this at a lower-level and avoid introducing additional assumptions
// about Chrome's sequence model.
ABSL_CONST_INIT thread_local RawPtrAsanService::PendingReport pending_report;
constinit thread_local RawPtrAsanService::PendingReport pending_report;
} // namespace

@ -4,13 +4,12 @@
#include "base/observer_list_threadsafe.h"
#include "base/compiler_specific.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace internal {
ABSL_CONST_INIT thread_local const ObserverListThreadSafeBase::
NotificationDataBase* current_notification = nullptr;
constinit thread_local const ObserverListThreadSafeBase::NotificationDataBase*
current_notification = nullptr;
// static
const ObserverListThreadSafeBase::NotificationDataBase*&

@ -25,7 +25,6 @@
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
///////////////////////////////////////////////////////////////////////////////
//

@ -13,14 +13,13 @@
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/base_tracing.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace {
ABSL_CONST_INIT thread_local RunLoop::Delegate* delegate = nullptr;
ABSL_CONST_INIT thread_local const RunLoop::RunLoopTimeout* run_loop_timeout =
constinit thread_local RunLoop::Delegate* delegate = nullptr;
constinit thread_local const RunLoop::RunLoopTimeout* run_loop_timeout =
nullptr;
// Runs |closure| immediately if this is called on |task_runner|, otherwise

@ -17,7 +17,6 @@
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
@ -33,12 +32,10 @@ const intptr_t kAccumulatedBytesOffset = 1 << 29;
bool g_deterministic = false;
// Pointer to the current |LockFreeAddressHashSet|.
ABSL_CONST_INIT std::atomic<LockFreeAddressHashSet*> g_sampled_addresses_set{
nullptr};
constinit std::atomic<LockFreeAddressHashSet*> g_sampled_addresses_set{nullptr};
// Sampling interval parameter, the mean value for intervals between samples.
ABSL_CONST_INIT std::atomic_size_t g_sampling_interval{
kDefaultSamplingIntervalBytes};
constinit std::atomic_size_t g_sampling_interval{kDefaultSamplingIntervalBytes};
struct ThreadLocalData {
// Accumulated bytes towards sample.
@ -180,7 +177,7 @@ PoissonAllocationSampler::ScopedMuteHookedSamplesForTesting::operator=(
ScopedMuteHookedSamplesForTesting&&) = default;
// static
ABSL_CONST_INIT std::atomic<PoissonAllocationSampler::ProfilingStateFlagMask>
constinit std::atomic<PoissonAllocationSampler::ProfilingStateFlagMask>
PoissonAllocationSampler::profiling_state_{0};
PoissonAllocationSampler::PoissonAllocationSampler() {

@ -5,7 +5,6 @@
#include "base/sequence_token.h"
#include "base/atomic_sequence_num.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace internal {
@ -16,10 +15,10 @@ base::AtomicSequenceNumber g_sequence_token_generator;
base::AtomicSequenceNumber g_task_token_generator;
ABSL_CONST_INIT thread_local SequenceToken current_sequence_token;
ABSL_CONST_INIT thread_local TaskToken current_task_token;
ABSL_CONST_INIT thread_local bool current_task_is_thread_bound = true;
ABSL_CONST_INIT thread_local bool current_task_is_running_synchronously = false;
constinit thread_local SequenceToken current_sequence_token;
constinit thread_local TaskToken current_task_token;
constinit thread_local bool current_task_is_thread_bound = true;
constinit thread_local bool current_task_is_running_synchronously = false;
} // namespace

@ -5,7 +5,6 @@
#include "base/task/common/scoped_defer_task_posting.h"
#include "base/compiler_specific.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
@ -13,7 +12,7 @@ namespace {
// Holds a thread-local pointer to the current scope or null when no
// scope is active.
ABSL_CONST_INIT thread_local ScopedDeferTaskPosting* scoped_defer_task_posting =
constinit thread_local ScopedDeferTaskPosting* scoped_defer_task_posting =
nullptr;
} // namespace

@ -22,7 +22,6 @@
#include "base/time/time.h"
#include "base/trace_event/base_tracing.h"
#include "base/tracing_buildflags.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if BUILDFLAG(ENABLE_BASE_TRACING)
#include "third_party/perfetto/protos/perfetto/trace/track_event/chrome_mojo_event_info.pbzero.h" // nogncheck
@ -37,15 +36,15 @@ TaskAnnotator::ObserverForTesting* g_task_annotator_observer = nullptr;
// The PendingTask currently in progress on each thread. Used to allow creating
// a breadcrumb of program counters on the stack to help identify a task's
// origin in crashes.
ABSL_CONST_INIT thread_local PendingTask* current_pending_task = nullptr;
constinit thread_local PendingTask* current_pending_task = nullptr;
// Scoped IPC-related data (IPC hash and/or IPC interface name). IPC hash or
// interface name can be known before the associated task object is created;
// thread-local so that this data can be affixed to the associated task.
ABSL_CONST_INIT thread_local TaskAnnotator::ScopedSetIpcHash*
constinit thread_local TaskAnnotator::ScopedSetIpcHash*
current_scoped_ipc_hash = nullptr;
ABSL_CONST_INIT thread_local TaskAnnotator::LongTaskTracker*
constinit thread_local TaskAnnotator::LongTaskTracker*
current_long_task_tracker = nullptr;
// These functions can be removed, and the calls below replaced with direct

@ -5,14 +5,13 @@
#include "base/task/scoped_set_task_priority_for_current_thread.h"
#include "base/compiler_specific.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace internal {
namespace {
ABSL_CONST_INIT thread_local TaskPriority task_priority_for_current_thread =
constinit thread_local TaskPriority task_priority_for_current_thread =
TaskPriority::USER_BLOCKING;
} // namespace

@ -45,7 +45,6 @@
#include "base/time/tick_clock.h"
#include "base/trace_event/base_tracing.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace sequence_manager {
@ -57,7 +56,7 @@ BASE_FEATURE(kRecordSequenceManagerCrashKeys,
"RecordSequenceManagerCrashKeys",
base::FEATURE_DISABLED_BY_DEFAULT);
ABSL_CONST_INIT thread_local internal::SequenceManagerImpl*
constinit thread_local internal::SequenceManagerImpl*
thread_local_sequence_manager = nullptr;
class TracedBaseValue : public trace_event::ConvertableToTraceFormat {

@ -9,13 +9,12 @@
#include "base/functional/bind.h"
#include "base/task/default_delayed_task_handle_delegate.h"
#include "base/time/time.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace {
ABSL_CONST_INIT thread_local SequencedTaskRunner::CurrentDefaultHandle*
constinit thread_local SequencedTaskRunner::CurrentDefaultHandle*
current_default_handle = nullptr;
} // namespace

@ -14,13 +14,12 @@
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/run_loop.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace {
ABSL_CONST_INIT thread_local SingleThreadTaskRunner::CurrentDefaultHandle*
constinit thread_local SingleThreadTaskRunner::CurrentDefaultHandle*
current_default_handle = nullptr;
// This function can be removed, and the calls below replaced with direct

@ -34,7 +34,6 @@
#include "base/trace_event/base_tracing.h"
#include "base/values.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace internal {
@ -127,7 +126,7 @@ auto EmitThreadPoolTraceEventMetadata(perfetto::EventContext& ctx,
// posting back to a BLOCK_SHUTDOWN sequence is a coincidence rather than part
// of a shutdown blocking series of tasks, this prevents racy DCHECKs in those
// cases.
ABSL_CONST_INIT thread_local int fizzle_block_shutdown_tasks_ref = 0;
constinit thread_local int fizzle_block_shutdown_tasks_ref = 0;
} // namespace

@ -14,7 +14,6 @@
#include "base/task/task_features.h"
#include "base/task/thread_pool/task_tracker.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if BUILDFLAG(IS_WIN)
#include "base/win/com_init_check_hook.h"
@ -54,7 +53,7 @@ constexpr TimeDelta kBackgroundMayBlockThreshold = Seconds(10);
constexpr TimeDelta kBackgroundBlockedWorkersPoll = Seconds(12);
// ThreadGroup that owns the current thread, if any.
ABSL_CONST_INIT thread_local const ThreadGroup* current_thread_group = nullptr;
constinit thread_local const ThreadGroup* current_thread_group = nullptr;
} // namespace

@ -9,6 +9,7 @@
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/containers/flat_map.h"
#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
@ -16,14 +17,13 @@
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
#include "base/types/pass_key.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base::test {
// A reference to a base::Feature and field trial params that should be force
// enabled and overwritten for test purposes.
struct FeatureRefAndParams {
FeatureRefAndParams(const Feature& feature ABSL_ATTRIBUTE_LIFETIME_BOUND,
FeatureRefAndParams(const Feature& feature LIFETIME_BOUND,
const FieldTrialParams& params);
FeatureRefAndParams(const FeatureRefAndParams& other);
@ -41,8 +41,7 @@ struct FeatureRefAndParams {
class FeatureRef {
public:
// NOLINTNEXTLINE(google-explicit-constructor)
FeatureRef(const Feature& feature ABSL_ATTRIBUTE_LIFETIME_BOUND)
: feature_(feature) {}
FeatureRef(const Feature& feature LIFETIME_BOUND) : feature_(feature) {}
const Feature& operator*() const { return *feature_; }
const Feature* operator->() const { return &*feature_; }

@ -30,7 +30,6 @@
#include "base/time/time.h"
#include "base/trace_event/base_tracing.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
@ -44,8 +43,7 @@ namespace {
enum class LoggingLevel { kNone = 0, kUmaOnly = 1, kUmaAndCrash = 2 };
HangWatcher* g_instance = nullptr;
ABSL_CONST_INIT thread_local internal::HangWatchState* hang_watch_state =
nullptr;
constinit thread_local internal::HangWatchState* hang_watch_state = nullptr;
std::atomic<bool> g_use_hang_watcher{false};
std::atomic<HangWatcher::ProcessType> g_hang_watcher_process_type{
HangWatcher::ProcessType::kBrowserProcess};

@ -6,7 +6,6 @@
#include "base/threading/thread_id_name_manager.h"
#include "base/task/current_thread.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if BUILDFLAG(IS_FUCHSIA)
#include "base/fuchsia/scheduler.h"
@ -16,8 +15,7 @@ namespace base {
namespace {
ABSL_CONST_INIT thread_local ThreadType current_thread_type =
ThreadType::kDefault;
constinit thread_local ThreadType current_thread_type = ThreadType::kDefault;
} // namespace

@ -18,7 +18,6 @@
#if DCHECK_IS_ON()
#include "base/auto_reset.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#endif
namespace base {
@ -29,7 +28,7 @@ namespace {
// Used to verify that the trace events used in the constructor do not result in
// instantiating a ScopedBlockingCall themselves (which would cause an infinite
// reentrancy loop).
ABSL_CONST_INIT thread_local bool construction_in_progress = false;
constinit thread_local bool construction_in_progress = false;
#endif
} // namespace

@ -25,18 +25,17 @@
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/scoped_blocking_call.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace internal {
namespace {
ABSL_CONST_INIT thread_local BlockingObserver* blocking_observer = nullptr;
constinit thread_local BlockingObserver* blocking_observer = nullptr;
// Last ScopedBlockingCall instantiated on this thread.
ABSL_CONST_INIT thread_local UncheckedScopedBlockingCall*
last_scoped_blocking_call = nullptr;
constinit thread_local UncheckedScopedBlockingCall* last_scoped_blocking_call =
nullptr;
// These functions can be removed, and the calls below replaced with direct
// variable accesses, once the MSAN workaround is not necessary.

@ -9,15 +9,14 @@
#include "base/check_op.h"
#include "base/sequence_token.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace internal {
namespace {
ABSL_CONST_INIT thread_local SequenceLocalStorageMap*
current_sequence_local_storage = nullptr;
constinit thread_local SequenceLocalStorageMap* current_sequence_local_storage =
nullptr;
} // namespace

@ -26,7 +26,6 @@
#include "base/threading/thread_restrictions.h"
#include "base/types/pass_key.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/abseil-cpp/absl/base/dynamic_annotations.h"
#if (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_NACL)) || BUILDFLAG(IS_FUCHSIA)
@ -48,7 +47,7 @@ namespace {
// because its Stop method was called. This allows us to catch cases where
// MessageLoop::QuitWhenIdle() is called directly, which is unexpected when
// using a Thread to setup and run a MessageLoop.
ABSL_CONST_INIT thread_local bool was_quit_properly = false;
constinit thread_local bool was_quit_properly = false;
} // namespace
#endif

@ -12,7 +12,6 @@
#include "base/memory/singleton.h"
#include "base/strings/string_util.h"
#include "base/trace_event/heap_profiler_allocation_context_tracker.h" // no-presubmit-check
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
namespace {
@ -20,7 +19,7 @@ namespace {
static const char kDefaultName[] = "";
static std::string* g_default_name;
ABSL_CONST_INIT thread_local const char* thread_name = kDefaultName;
constinit thread_local const char* thread_name = kDefaultName;
}
ThreadIdNameManager::Observer::~Observer() = default;

@ -8,7 +8,6 @@
#include "base/threading/hang_watcher.h"
#include "base/trace_event/base_tracing.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
@ -39,11 +38,11 @@ std::ostream& operator<<(std::ostream& out,
namespace {
ABSL_CONST_INIT thread_local BooleanWithOptionalStack tls_blocking_disallowed;
ABSL_CONST_INIT thread_local BooleanWithOptionalStack tls_singleton_disallowed;
ABSL_CONST_INIT thread_local BooleanWithOptionalStack
constinit thread_local BooleanWithOptionalStack tls_blocking_disallowed;
constinit thread_local BooleanWithOptionalStack tls_singleton_disallowed;
constinit thread_local BooleanWithOptionalStack
tls_base_sync_primitives_disallowed;
ABSL_CONST_INIT thread_local BooleanWithOptionalStack
constinit thread_local BooleanWithOptionalStack
tls_cpu_intensive_work_disallowed;
} // namespace

@ -15,7 +15,6 @@
#include "base/android/apk_assets.h"
#include "base/android/library_loader/anchor_functions.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if !defined(ARCH_CPU_ARMEL)
#error This file should not be built for this architecture.
@ -125,7 +124,7 @@ static_assert(
sizeof(CFIUnwindDataRow) == 4,
"The CFIUnwindDataRow struct must be exactly 4 bytes for searching.");
ABSL_CONST_INIT thread_local CFIBacktraceAndroid::CFICache cfi_cache;
constinit thread_local CFIBacktraceAndroid::CFICache cfi_cache;
} // namespace

@ -107,10 +107,10 @@ bool g_perfetto_initialized_by_tracelog = false;
TraceLog* g_trace_log_for_testing = nullptr;
ABSL_CONST_INIT thread_local TraceLog::ThreadLocalEventBuffer*
constinit thread_local TraceLog::ThreadLocalEventBuffer*
thread_local_event_buffer = nullptr;
ABSL_CONST_INIT thread_local bool thread_blocks_message_loop = false;
ABSL_CONST_INIT thread_local bool thread_is_in_trace_event = false;
constinit thread_local bool thread_blocks_message_loop = false;
constinit thread_local bool thread_is_in_trace_event = false;
ThreadTicks ThreadNow() {
return ThreadTicks::IsSupported()

@ -14,9 +14,9 @@
#include <string>
#include <utility>
#include "base/compiler_specific.h"
#include "base/types/expected.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/google_benchmark/src/include/benchmark/benchmark.h"
namespace base {
@ -32,7 +32,7 @@ class ReturnLoop {
: value_(std::move(return_value)) {}
virtual ~ReturnLoop() = default;
ABSL_ATTRIBUTE_NO_TAIL_CALL ReturnType Loop(size_t* ops) {
DISABLE_TAIL_CALLS ReturnType Loop(size_t* ops) {
if (!*ops) {
return value_;
}

@ -10,8 +10,8 @@
#include <type_traits>
#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/memory/raw_ptr.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
@ -100,13 +100,12 @@ class optional_ref {
template <typename U>
requires(std::is_const_v<T> && IsCompatibleV<U>)
// NOLINTNEXTLINE(google-explicit-constructor)
constexpr optional_ref(
const std::optional<U>& o ABSL_ATTRIBUTE_LIFETIME_BOUND)
constexpr optional_ref(const std::optional<U>& o LIFETIME_BOUND)
: ptr_(o ? &*o : nullptr) {}
template <typename U>
requires(IsCompatibleV<U>)
// NOLINTNEXTLINE(google-explicit-constructor)
constexpr optional_ref(std::optional<U>& o ABSL_ATTRIBUTE_LIFETIME_BOUND)
constexpr optional_ref(std::optional<U>& o LIFETIME_BOUND)
: ptr_(o ? &*o : nullptr) {}
// Constructs an `optional_ref` from a pointer; the resulting `optional_ref`
@ -118,7 +117,7 @@ class optional_ref {
template <typename U>
requires(IsCompatibleV<U>)
// NOLINTNEXTLINE(google-explicit-constructor)
constexpr optional_ref(U* p ABSL_ATTRIBUTE_LIFETIME_BOUND) : ptr_(p) {}
constexpr optional_ref(U* p LIFETIME_BOUND) : ptr_(p) {}
// Constructs an `optional_ref` from a reference; the resulting `optional_ref`
// is never empty.
@ -129,13 +128,11 @@ class optional_ref {
template <typename U>
requires(IsCompatibleV<const U>)
// NOLINTNEXTLINE(google-explicit-constructor)
constexpr optional_ref(const U& r ABSL_ATTRIBUTE_LIFETIME_BOUND)
: ptr_(std::addressof(r)) {}
constexpr optional_ref(const U& r LIFETIME_BOUND) : ptr_(std::addressof(r)) {}
template <typename U>
requires(IsCompatibleV<U>)
// NOLINTNEXTLINE(google-explicit-constructor)
constexpr optional_ref(U& r ABSL_ATTRIBUTE_LIFETIME_BOUND)
: ptr_(std::addressof(r)) {}
constexpr optional_ref(U& r LIFETIME_BOUND) : ptr_(std::addressof(r)) {}
// An empty `optional_ref` must be constructed with `std::nullopt`, not
// `nullptr`. Otherwise, `optional_ref<T*>` constructed with `nullptr` would

@ -21,7 +21,6 @@
#include "base/win/base_win_buildflags.h"
#include "base/win/current_module.h"
#include "base/win/scoped_handle.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
extern "C" {
__declspec(dllexport) void* GetHandleVerifier();
@ -38,7 +37,7 @@ namespace internal {
namespace {
ScopedHandleVerifier* g_active_verifier = nullptr;
ABSL_CONST_INIT thread_local bool closing = false;
constinit thread_local bool closing = false;
using GetHandleVerifierFn = void* (*)();
using HandleMap =
std::unordered_map<HANDLE, ScopedHandleVerifierInfo, HandleHash>;

@ -27,7 +27,6 @@
#include "components/prefs/pref_service.h"
#include "components/sync/base/pref_names.h"
#include "components/version_info/android/channel_getter.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
using password_manager::prefs::kCurrentMigrationVersionToGoogleMobileServices;
using password_manager::prefs::kPasswordsUseUPMLocalAndSeparateStores;

@ -40,7 +40,6 @@
#include "content/public/test/browser_task_environment.h"
#include "extensions/browser/quota_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if BUILDFLAG(IS_WIN)
#include "base/test/test_reg_util_win.h"
@ -49,8 +48,7 @@
namespace {
class TestIncidentReportingService;
ABSL_CONST_INIT thread_local TestIncidentReportingService* test_instance =
nullptr;
constinit thread_local TestIncidentReportingService* test_instance = nullptr;
constexpr char kFakeOsName[] = "fakedows";
constexpr char kFakeDownloadToken[] = "fakedlt";

@ -51,7 +51,6 @@
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/log/net_log_source.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace {
@ -120,8 +119,8 @@ void HandleRequestOnIOThread(
send_response_func)));
}
ABSL_CONST_INIT thread_local HttpServer* server_ipv4 = nullptr;
ABSL_CONST_INIT thread_local HttpServer* server_ipv6 = nullptr;
constinit thread_local HttpServer* server_ipv4 = nullptr;
constinit thread_local HttpServer* server_ipv6 = nullptr;
void StopServerOnIOThread() {
delete server_ipv4;

@ -20,11 +20,10 @@
#include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/chrome/web_view.h"
#include "chrome/test/chromedriver/logging.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace {
ABSL_CONST_INIT thread_local Session* session = nullptr;
constinit thread_local Session* session = nullptr;
} // namespace

@ -15,6 +15,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -24,6 +24,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -17,6 +17,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -26,6 +26,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -30,6 +30,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -17,6 +17,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -14,6 +14,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -43,6 +43,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -14,6 +14,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -24,6 +24,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -15,6 +15,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -19,6 +19,7 @@ include_rules = [
# Please keep this section in sync with //DEPS.
'+third_party/abseil-cpp',
'-third_party/abseil-cpp/absl/algorithm/container.h',
'-third_party/abseil-cpp/absl/base/attributes.h',
'-third_party/abseil-cpp/absl/base/nullability.h',
'-third_party/abseil-cpp/absl/container',
'+third_party/abseil-cpp/absl/container/inlined_vector.h',

@ -5,10 +5,10 @@
#ifndef COMPONENTS_FEATURE_ENGAGEMENT_INTERNAL_TESTING_CLOCK_TIME_PROVIDER_H_
#define COMPONENTS_FEATURE_ENGAGEMENT_INTERNAL_TESTING_CLOCK_TIME_PROVIDER_H_
#include "base/compiler_specific.h"
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "components/feature_engagement/internal/time_provider.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace base {
class Clock;
@ -20,8 +20,7 @@ namespace feature_engagement {
class TestingClockTimeProvider : public TimeProvider {
public:
// The passed in clock must outlive this class.
TestingClockTimeProvider(const base::Clock& clock
ABSL_ATTRIBUTE_LIFETIME_BOUND,
TestingClockTimeProvider(const base::Clock& clock LIFETIME_BOUND,
base::Time initial_now);
TestingClockTimeProvider(const TestingClockTimeProvider&) = delete;

@ -14,7 +14,6 @@
#include "components/memory_system/memory_system_features.h"
#include "components/memory_system/parameters.h"
#include "partition_alloc/buildflags.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if BUILDFLAG(ENABLE_GWP_ASAN)
#include "components/gwp_asan/client/gwp_asan.h" // nogncheck

@ -9,7 +9,6 @@
#include "base/threading/thread_checker.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace metrics {
@ -37,7 +36,7 @@ class SingleSampleMetricImpl : public base::SingleSampleMetric {
mojo::Remote<mojom::SingleSampleMetric> metric_;
};
ABSL_CONST_INIT thread_local mojo::Remote<mojom::SingleSampleMetricsProvider>*
constinit thread_local mojo::Remote<mojom::SingleSampleMetricsProvider>*
provider = nullptr;
} // namespace

@ -20,7 +20,6 @@
#include "components/subresource_filter/core/common/flat/indexed_ruleset_generated.h"
#include "components/subresource_filter/core/common/load_policy.h"
#include "components/url_pattern_index/url_pattern_index.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/flatbuffers/src/include/flatbuffers/flatbuffers.h"
class GURL;
@ -86,7 +85,7 @@ class RulesetIndexer {
// Returns a pointer to the buffer containing the serialized flat data
// structures. Should only be called after Finish().
base::span<const uint8_t> data() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
base::span<const uint8_t> data() const LIFETIME_BOUND {
return base::span(builder_.GetBufferPointer(), builder_.GetSize());
}

@ -8,12 +8,12 @@
#include <stddef.h>
#include <stdint.h>
#include "base/compiler_specific.h"
#include "base/files/file.h"
#include "base/files/memory_mapped_file.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace subresource_filter {
@ -31,7 +31,7 @@ class MemoryMappedRuleset final : public base::RefCounted<MemoryMappedRuleset> {
static void SetMemoryMapFailuresForTesting(bool fail);
base::span<const uint8_t> data() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
base::span<const uint8_t> data() const LIFETIME_BOUND {
return ruleset_.bytes();
}

@ -12,14 +12,13 @@
#include "base/containers/contains.h"
#include "base/metrics/field_trial_list_including_low_anonymity.h"
#include "components/variations/variations_crash_keys.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace variations {
namespace {
ChildProcessFieldTrialSyncer* g_instance = nullptr;
ABSL_CONST_INIT thread_local bool in_set_field_trial_group_from_browser = false;
constinit thread_local bool in_set_field_trial_group_from_browser = false;
} // namespace

@ -11,7 +11,6 @@
#include "components/web_package/signed_web_bundles/signature_entry_parser.h"
#include "components/web_package/signed_web_bundles/types.h"
#include "components/web_package/web_bundle_parser.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace web_package {

@ -9,6 +9,7 @@
#include <string_view>
#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
@ -203,7 +204,7 @@ class WebBundleParser::MetadataParser
: public WebBundleParser::WebBundleSectionParser {
public:
MetadataParser(mojo::Remote<mojom::BundleDataSource>& data_source
ABSL_ATTRIBUTE_LIFETIME_BOUND,
LIFETIME_BOUND,
GURL base_url,
std::optional<uint64_t> offset,
ParseMetadataCallback callback)
@ -720,7 +721,7 @@ class WebBundleParser::ResponseParser
: public WebBundleParser::WebBundleSectionParser {
public:
ResponseParser(mojo::Remote<mojom::BundleDataSource>& data_source
ABSL_ATTRIBUTE_LIFETIME_BOUND,
LIFETIME_BOUND,
uint64_t response_offset,
uint64_t response_length,
WebBundleParser::ParseResponseCallback callback)

@ -22,7 +22,6 @@
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/webrtc/rtc_base/physical_socket_server.h"
#include "third_party/webrtc_overrides/api/location.h"
#include "third_party/webrtc_overrides/metronome_source.h"
@ -33,7 +32,7 @@ namespace {
constexpr base::TimeDelta kTaskLatencySampleDuration = base::Seconds(3);
ABSL_CONST_INIT thread_local ThreadWrapper* jingle_thread_wrapper = nullptr;
constinit thread_local ThreadWrapper* jingle_thread_wrapper = nullptr;
} // namespace

@ -76,7 +76,6 @@
#include "media/capture/video/fake_video_capture_device_factory.h"
#include "media/capture/video/video_capture_system_impl.h"
#include "media/mojo/mojom/display_media_information.mojom.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/mediastream/media_devices.h"
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
@ -114,7 +113,7 @@ using ::blink::mojom::MediaDeviceType;
namespace content {
ABSL_CONST_INIT thread_local MediaStreamManager* media_stream_manager = nullptr;
constinit thread_local MediaStreamManager* media_stream_manager = nullptr;
using ::blink::MediaStreamDevice;
using ::blink::MediaStreamDevices;

@ -21,7 +21,6 @@
#include "mojo/public/cpp/bindings/interface_endpoint_client.h"
#include "sandbox/policy/sandbox_type.h"
#include "services/tracing/public/cpp/trace_startup.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/blink/public/common/features.h"
#if BUILDFLAG(CLANG_PROFILING_INSIDE_SANDBOX)
@ -40,7 +39,7 @@ namespace content {
namespace {
ABSL_CONST_INIT thread_local ChildProcess* child_process = nullptr;
constinit thread_local ChildProcess* child_process = nullptr;
class ChildIOThread : public base::Thread {
public:

@ -78,7 +78,6 @@
#include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h"
#include "services/tracing/public/cpp/background_tracing/background_tracing_agent_impl.h"
#include "services/tracing/public/cpp/background_tracing/background_tracing_agent_provider_impl.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if BUILDFLAG(IS_POSIX)
#include "base/posix/global_descriptors.h"
@ -114,7 +113,7 @@ namespace {
// How long to wait for a connection to the browser process before giving up.
const int kConnectionTimeoutS = 15;
ABSL_CONST_INIT thread_local ChildThreadImpl* child_thread_impl = nullptr;
constinit thread_local ChildThreadImpl* child_thread_impl = nullptr;
// This isn't needed on Windows because there the sandbox's job object
// terminates child processes automatically. For unsandboxed processes (i.e.

@ -16,7 +16,6 @@
#include "content/public/browser/web_contents_observer.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace content {
@ -85,7 +84,7 @@ class CONTENT_EXPORT RenderFrameHostReceiverSet : public WebContentsObserver {
//
// Important: this method must only be called while the incoming message is
// being dispatched on the stack.
RenderFrameHost* GetCurrentTargetFrame() ABSL_ATTRIBUTE_RETURNS_NONNULL {
RETURNS_NONNULL RenderFrameHost* GetCurrentTargetFrame() {
if (current_target_frame_for_testing_)
return current_target_frame_for_testing_;
return receivers_.current_context();

@ -6,7 +6,6 @@
#include "base/no_destructor.h"
#include "base/threading/thread_checker_impl.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace content {
@ -14,7 +13,7 @@ namespace {
// Keep the global RenderThread in a TLS slot so it is impossible to access
// incorrectly from the wrong thread.
ABSL_CONST_INIT thread_local RenderThread* render_thread = nullptr;
constinit thread_local RenderThread* render_thread = nullptr;
static const base::ThreadCheckerImpl& GetThreadChecker() {
static base::NoDestructor<base::ThreadCheckerImpl> checker;

@ -4,7 +4,6 @@
#include "content/public/utility/utility_thread.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace content {
@ -12,7 +11,7 @@ namespace {
// Keep the global UtilityThread in a TLS slot so it is impossible to access
// incorrectly from the wrong thread.
ABSL_CONST_INIT thread_local UtilityThread* utility_thread = nullptr;
constinit thread_local UtilityThread* utility_thread = nullptr;
} // namespace

@ -147,7 +147,6 @@
#include "services/viz/public/cpp/gpu/gpu.h"
#include "skia/ext/font_utils.h"
#include "skia/ext/skia_memory_dump_provider.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/blink/public/common/origin_trials/origin_trials_settings_provider.h"
#include "third_party/blink/public/common/page/launching_process_state.h"
#include "third_party/blink/public/common/switches.h"
@ -247,7 +246,7 @@ using ::blink::WebView;
// Keep the global RenderThreadImpl in a TLS slot so it is impossible to access
// incorrectly from the wrong thread.
ABSL_CONST_INIT thread_local RenderThreadImpl* render_thread = nullptr;
constinit thread_local RenderThreadImpl* render_thread = nullptr;
base::LazyInstance<scoped_refptr<base::SingleThreadTaskRunner>>::
DestructorAtExit g_main_task_runner = LAZY_INSTANCE_INITIALIZER;

@ -35,7 +35,7 @@ struct WorkerThreadData {
WorkerThreadObservers observers;
};
ABSL_CONST_INIT thread_local WorkerThreadData* worker_data = nullptr;
constinit thread_local WorkerThreadData* worker_data = nullptr;
// A task-runner that refuses to run any tasks.
class DoNothingTaskRunner : public base::SequencedTaskRunner {

@ -12,6 +12,7 @@
#include <algorithm>
#include <array>
#include "base/compiler_specific.h"
#include "base/containers/span.h"
#include "base/metrics/crc32.h"
#include "base/numerics/safe_conversions.h"
@ -41,7 +42,7 @@ const float kDpadMax = 7.0f;
constexpr uint16_t kTouchDimensionX = 1920;
constexpr uint16_t kTouchDimensionY = 942;
struct ControllerData {
struct PACKED_OBJ ControllerData {
uint8_t axis_left_x;
uint8_t axis_left_y;
uint8_t axis_right_x;
@ -76,7 +77,7 @@ struct ControllerData {
uint8_t battery_info : 5;
uint8_t padding2 : 2;
bool extension_detection : 1;
} ABSL_ATTRIBUTE_PACKED;
};
static_assert(sizeof(ControllerData) == 30,
"ControllerData has incorrect size");
@ -107,7 +108,7 @@ struct Dualshock4InputReportUsb {
static_assert(sizeof(Dualshock4InputReportUsb) == 64,
"Dualshock4InputReportUsb has incorrect size");
struct Dualshock4InputReportBluetooth {
struct PACKED_OBJ Dualshock4InputReportBluetooth {
uint8_t padding1[2];
ControllerData controller_data;
uint8_t padding2[2];
@ -115,7 +116,7 @@ struct Dualshock4InputReportBluetooth {
TouchPadData touches[4];
uint8_t padding3[2];
uint32_t crc32;
} ABSL_ATTRIBUTE_PACKED;
};
static_assert(sizeof(Dualshock4InputReportBluetooth) == 77,
"Dualshock4InputReportBluetooth has incorrect size");

@ -123,7 +123,7 @@ footers.
- Make the symbol read-only (usually by adding "const").
- If you can't make it const, then rename it.
- If the symbol is logically const, and you really don't want to rename it to
reveal that it is not actually mutable, you can annotate it with the
reveal that it is actually mutable, you can annotate it with the
[LOGICALLY_CONST] macro.
- To check what section a symbol is in for a local build:
```sh

@ -12,7 +12,6 @@
#include "extensions/renderer/dispatcher.h"
#include "extensions/renderer/script_context.h"
#include "extensions/renderer/worker_thread_util.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "v8/include/v8-context.h"
namespace extensions {
@ -35,7 +34,7 @@ ContextVector::iterator FindContext(ContextVector* contexts,
}
// Implement thread safety by storing each ScriptContext in TLS.
ABSL_CONST_INIT thread_local ContextVector* contexts = nullptr;
constinit thread_local ContextVector* contexts = nullptr;
} // namespace

@ -28,14 +28,13 @@
#include "extensions/renderer/service_worker_data.h"
#include "extensions/renderer/worker_script_context_set.h"
#include "extensions/renderer/worker_thread_util.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace extensions {
namespace {
ABSL_CONST_INIT thread_local extensions::ServiceWorkerData*
service_worker_data = nullptr;
constinit thread_local extensions::ServiceWorkerData* service_worker_data =
nullptr;
ServiceWorkerData* GetServiceWorkerDataChecked() {
ServiceWorkerData* data = WorkerThreadDispatcher::GetServiceWorkerData();

@ -13,14 +13,14 @@
#include "base/check.h"
#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/memory/page_size.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "partition_alloc/thread_isolation/alignment.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
extern int pkey_alloc(unsigned int flags,
unsigned int access_rights) ABSL_ATTRIBUTE_WEAK;
WEAK_SYMBOL extern int pkey_alloc(unsigned int flags,
unsigned int access_rights);
namespace {

@ -8,7 +8,6 @@
#include "gpu/command_buffer/service/scheduler.h"
#if DCHECK_IS_ON()
#include "third_party/abseil-cpp/absl/base/attributes.h"
#endif
namespace gpu {
@ -16,7 +15,7 @@ namespace gpu {
namespace {
#if DCHECK_IS_ON()
ABSL_CONST_INIT thread_local bool schedule_task_disallowed = false;
constinit thread_local bool schedule_task_disallowed = false;
#endif // DCHECK_IS_ON()
} // namespace

@ -12,14 +12,12 @@
#include "base/functional/bind.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/command_buffer/service/scheduler.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace gpu {
namespace {
ABSL_CONST_INIT thread_local const SchedulerTaskRunner* current_task_runner =
nullptr;
constinit thread_local const SchedulerTaskRunner* current_task_runner = nullptr;
} // namespace

@ -61,7 +61,6 @@
#include "gpu/config/gpu_preferences.h"
#include "gpu/config/webgpu_blocklist.h"
#include "gpu/webgpu/callback.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/gpu/ganesh/GrBackendSemaphore.h"
@ -1005,7 +1004,7 @@ constexpr WebGPUDecoderImpl::CommandInfo WebGPUDecoderImpl::command_info[] = {
// This variable is set to DawnWireServer's parent decoder during execution of
// HandleCommands. It is cleared to nullptr after.
ABSL_CONST_INIT thread_local WebGPUDecoderImpl* parent_decoder = nullptr;
constinit thread_local WebGPUDecoderImpl* parent_decoder = nullptr;
// DawnWireServer is a wrapper around dawn::wire::WireServer which allows
// overriding some of the WGPU procs the server delegates calls to.

@ -55,7 +55,6 @@
#include "mojo/public/cpp/bindings/scoped_message_error_crash_key.h"
#include "mojo/public/cpp/bindings/sequence_local_sync_event_watcher.h"
#include "mojo/public/cpp/bindings/tracing_helpers.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace IPC {
@ -63,7 +62,7 @@ class ChannelAssociatedGroupController;
namespace {
ABSL_CONST_INIT thread_local bool off_sequence_binding_allowed = false;
constinit thread_local bool off_sequence_binding_allowed = false;
BASE_FEATURE(kMojoChannelAssociatedSendUsesRunOrPostTask,
"MojoChannelAssociatedSendUsesRunOrPostTask",

@ -27,7 +27,6 @@
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_sync_message.h"
#include "mojo/public/cpp/bindings/sync_event_watcher.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if !BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#include "ipc/trace_ipc_message.h"
@ -46,7 +45,7 @@ void OnEventReady(bool* signal) {
}
// Holds a pointer to the per-thread ReceivedSyncMsgQueue object.
ABSL_CONST_INIT thread_local SyncChannel::ReceivedSyncMsgQueue* received_queue =
constinit thread_local SyncChannel::ReceivedSyncMsgQueue* received_queue =
nullptr;
} // namespace

@ -12,14 +12,13 @@
#include "mojo/core/platform_handle_dispatcher.h"
#include "mojo/core/ports/event.h"
#include "mojo/core/shared_buffer_dispatcher.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace mojo {
namespace core {
namespace {
ABSL_CONST_INIT thread_local bool is_extracting_handles_from_message = false;
constinit thread_local bool is_extracting_handles_from_message = false;
} // namespace

@ -16,7 +16,6 @@
#if DCHECK_IS_ON()
#include "base/check_op.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#endif
namespace mojo {
@ -26,7 +25,7 @@ namespace ports {
#if DCHECK_IS_ON()
namespace {
ABSL_CONST_INIT thread_local const PortLocker* port_locker = nullptr;
constinit thread_local const PortLocker* port_locker = nullptr;
} // namespace
#endif

@ -5,14 +5,13 @@
#include "mojo/core/request_context.h"
#include "base/check.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace mojo {
namespace core {
namespace {
ABSL_CONST_INIT thread_local RequestContext* current_context = nullptr;
constinit thread_local RequestContext* current_context = nullptr;
} // namespace

@ -46,7 +46,7 @@ namespace mojo {
namespace {
ABSL_CONST_INIT thread_local base::HistogramBase* g_end_to_end_metric = nullptr;
constinit thread_local base::HistogramBase* g_end_to_end_metric = nullptr;
// A helper to expose a subset of an InterfaceEndpointClient's functionality
// through a thread-safe interface. Used by SharedRemote.

@ -4,14 +4,13 @@
#include "mojo/public/cpp/bindings/urgent_message_scope.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace mojo {
namespace {
// `UrgentMessageScope` is stack allocated and should never cross tasks, so
// using thread local is good enough to avoid collisions.
ABSL_CONST_INIT thread_local bool is_in_urgent_message_scope = false;
constinit thread_local bool is_in_urgent_message_scope = false;
} // namespace
UrgentMessageScope::UrgentMessageScope()

@ -7,13 +7,12 @@
#include <atomic>
#include <type_traits>
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace net::activity_monitor {
namespace {
ABSL_CONST_INIT std::atomic<uint64_t> g_bytes_received = 0;
constinit std::atomic<uint64_t> g_bytes_received = 0;
} // namespace

@ -25,7 +25,7 @@ bool g_partition_by_default = false;
// True if NAK::IsPartitioningEnabled has been called, and the value of
// `g_partition_by_default` cannot be changed.
ABSL_CONST_INIT std::atomic<bool> g_partition_by_default_locked = false;
constinit std::atomic<bool> g_partition_by_default_locked = false;
} // namespace

@ -7,7 +7,6 @@
#include "base/check.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace ppapi {
@ -15,7 +14,7 @@ namespace {
// Thread-local globals for testing. See SetPpapiGlobalsOnThreadForTest for more
// information.
ABSL_CONST_INIT thread_local PpapiGlobals* ppapi_globals_for_test = nullptr;
constinit thread_local PpapiGlobals* ppapi_globals_for_test = nullptr;
} // namespace

@ -7,18 +7,17 @@
#include "base/lazy_instance.h"
#include "base/synchronization/lock.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace ppapi {
base::LazyInstance<base::Lock>::Leaky g_proxy_lock = LAZY_INSTANCE_INITIALIZER;
bool g_disable_locking = false;
ABSL_CONST_INIT thread_local bool disable_locking_for_thread = false;
constinit thread_local bool disable_locking_for_thread = false;
// Simple single-thread deadlock detector for the proxy lock.
// |true| when the current thread has the lock.
ABSL_CONST_INIT thread_local bool proxy_locked_on_thread = false;
constinit thread_local bool proxy_locked_on_thread = false;
// static
base::Lock* ProxyLock::Get() {

@ -15,7 +15,6 @@
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_bstr.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace remoting {
@ -58,7 +57,7 @@ enum RdpAudioMode {
};
// Points to a per-thread instance of the window activation hook handle.
ABSL_CONST_INIT thread_local RdpClientWindow::WindowHook* window_hook = nullptr;
constinit thread_local RdpClientWindow::WindowHook* window_hook = nullptr;
// Finds a child window with the class name matching |class_name|. Unlike
// FindWindowEx() this function walks the tree of windows recursively. The walk

@ -1743,6 +1743,28 @@ Banned since workaround for lack of RTTI
`std::any`.
***
### Attributes <sup>[banned]</sup>
```c++
T* data() ABSL_ATTRIBUTE_LIFETIME_BOUND { return data_; }
ABSL_ATTRIBUTE_NO_TAIL_CALL ReturnType Loop();
struct S { bool b; int32_t i; } ABSL_ATTRIBUTE_PACKED;
```
**Description:** Cross-platform macros to expose compiler-specific
functionality.
**Documentation:** [attributes.h](https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/base/attributes.h)
**Notes:**
*** promo
Long names discourage use. Use standardized attributes over macros where
possible, and otherwise prefer shorter alternatives in
`base/compiler_specific.h`.
[Discussion thread](https://groups.google.com/a/chromium.org/g/cxx/c/lVQOJTng1RU)
***
### bind_front <sup>[banned]</sup>
```c++

@ -35,7 +35,6 @@
#include <utility>
#include "base/notreached.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/blink/public/platform/web_isolated_world_info.h"
#include "third_party/blink/renderer/platform/bindings/dom_data_store.h"
#include "third_party/blink/renderer/platform/bindings/v8_object_data_store.h"
@ -253,7 +252,7 @@ void DOMWrapperWorld::SetNonMainWorldHumanReadableName(
IsolatedWorldHumanReadableNames().Set(world_id, human_readable_name);
}
ABSL_CONST_INIT thread_local int next_world_id =
constinit thread_local int next_world_id =
DOMWrapperWorld::kUnspecifiedWorldIdStart;
// static

@ -4,14 +4,13 @@
#include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace blink {
unsigned ScriptForbiddenScope::g_main_thread_counter_ = 0;
unsigned ScriptForbiddenScope::g_blink_lifecycle_counter_ = 0;
ABSL_CONST_INIT thread_local unsigned script_forbidden_counter = 0;
constinit thread_local unsigned script_forbidden_counter = 0;
unsigned& ScriptForbiddenScope::GetMutableCounter() {
return IsMainThread() ? g_main_thread_counter_ : script_forbidden_counter;

@ -10,7 +10,6 @@
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/interface_endpoint_client.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread.h"
@ -31,7 +30,7 @@ namespace blink {
namespace {
ABSL_CONST_INIT thread_local Thread* current_thread = nullptr;
constinit thread_local Thread* current_thread = nullptr;
std::unique_ptr<MainThread>& GetMainThread() {
DEFINE_STATIC_LOCAL(std::unique_ptr<MainThread>, main_thread, ());

@ -29,7 +29,8 @@
#include <iosfwd>
#include <memory>
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "base/compiler_specific.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h"
@ -169,7 +170,7 @@ class PLATFORM_EXPORT KURL {
String Protocol() const;
String Host() const;
StringView HostView() const ABSL_ATTRIBUTE_LIFETIME_BOUND;
StringView HostView() const LIFETIME_BOUND;
// Returns 0 when there is no port or the default port was specified, or the
// URL is invalid.

@ -25,8 +25,8 @@
#include <iosfwd>
#include <type_traits>
#include "base/compiler_specific.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/hash_table_deleted_value_type.h"
#include "third_party/blink/renderer/platform/wtf/ref_counted.h"
@ -301,17 +301,14 @@ struct HashTraits<AtomicString>;
// double-quotes, and escapes characters other than ASCII printables.
WTF_EXPORT std::ostream& operator<<(std::ostream&, const AtomicString&);
inline StringView::StringView(const AtomicString& string
ABSL_ATTRIBUTE_LIFETIME_BOUND,
inline StringView::StringView(const AtomicString& string LIFETIME_BOUND,
unsigned offset,
unsigned length)
: StringView(string.Impl(), offset, length) {}
inline StringView::StringView(const AtomicString& string
ABSL_ATTRIBUTE_LIFETIME_BOUND,
inline StringView::StringView(const AtomicString& string LIFETIME_BOUND,
unsigned offset)
: StringView(string.Impl(), offset) {}
inline StringView::StringView(
const AtomicString& string ABSL_ATTRIBUTE_LIFETIME_BOUND)
inline StringView::StringView(const AtomicString& string LIFETIME_BOUND)
: StringView(string.Impl()) {}
} // namespace WTF

@ -13,10 +13,10 @@
#include <cstring>
#include <type_traits>
#include "base/compiler_specific.h"
#include "base/containers/span.h"
#include "base/dcheck_is_on.h"
#include "base/numerics/safe_conversions.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/get_ptr.h"
#include "third_party/blink/renderer/platform/wtf/text/string_impl.h"
@ -121,22 +121,20 @@ class WTF_EXPORT StringView {
StringView(StringImpl&, unsigned offset, unsigned length);
// From a String, implemented in wtf_string.h
inline StringView(const String& string ABSL_ATTRIBUTE_LIFETIME_BOUND,
inline StringView(const String& string LIFETIME_BOUND,
unsigned offset,
unsigned length);
inline StringView(const String& string ABSL_ATTRIBUTE_LIFETIME_BOUND,
unsigned offset);
inline StringView(const String& string LIFETIME_BOUND, unsigned offset);
// NOLINTNEXTLINE(google-explicit-constructor)
inline StringView(const String& string ABSL_ATTRIBUTE_LIFETIME_BOUND);
inline StringView(const String& string LIFETIME_BOUND);
// From an AtomicString, implemented in atomic_string.h
inline StringView(const AtomicString& string ABSL_ATTRIBUTE_LIFETIME_BOUND,
inline StringView(const AtomicString& string LIFETIME_BOUND,
unsigned offset,
unsigned length);
inline StringView(const AtomicString& string ABSL_ATTRIBUTE_LIFETIME_BOUND,
unsigned offset);
inline StringView(const AtomicString& string LIFETIME_BOUND, unsigned offset);
// NOLINTNEXTLINE(google-explicit-constructor)
inline StringView(const AtomicString& string ABSL_ATTRIBUTE_LIFETIME_BOUND);
inline StringView(const AtomicString& string LIFETIME_BOUND);
// From a literal string or LChar buffer:
StringView(const LChar* chars, unsigned length)

Some files were not shown because too many files have changed in this diff Show More