Final tweaks for "Abseil is allowed in first-party code":
* Improve comments
* Make DEPS block "third_party/abseil-cpp" and "absl" both
* Update formal "allowed on" date to date this lands
* Remove visibility restrictions
Bug: 1096380
Change-Id: I10f615cfd02c397a988f73e4548cdf2309b44b81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2327638
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#793629}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 16fe8feff0d82312f25478aa542718ca4d9b2415
diff --git a/BUILD.gn b/BUILD.gn
index 0373bff..e32b069 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -53,14 +53,6 @@
}
}
}
-
- # Usage of Abseil in Chromium is guarded by an explicit opt-in list, before
- # adding projects to this list please reach out to cxx@chromium.org and CC:
- # - https://cs.chromium.org/chromium/src/third_party/abseil-cpp/OWNERS
- #
- # More information can be found at:
- # https://docs.google.com/document/d/1DgS1-A3rzboTLjpf4m1sqkJgWjnY_Ru2dokk1X1vBDU
- visibility = absl_visibility
}
group("absl_component_deps") {
@@ -69,8 +61,8 @@
"//third_party/abseil-cpp/absl/base",
"//third_party/abseil-cpp/absl/base:config",
"//third_party/abseil-cpp/absl/base:core_headers",
- "//third_party/abseil-cpp/absl/container:flat_hash_map",
"//third_party/abseil-cpp/absl/container:fixed_array",
+ "//third_party/abseil-cpp/absl/container:flat_hash_map",
"//third_party/abseil-cpp/absl/container:flat_hash_set",
"//third_party/abseil-cpp/absl/container:inlined_vector",
"//third_party/abseil-cpp/absl/debugging:failure_signal_handler",
diff --git a/README.chromium b/README.chromium
index 37dbe88..cb4beff 100644
--- a/README.chromium
+++ b/README.chromium
@@ -9,8 +9,10 @@
Description:
This directory contains the source code of Abseil for C++. This can be used by
-Chromium's dependencies, but shouldn't be used by Chromium itself.
-See: https://goo.gl/TgnJb8.
+Chromium, subject to the guidance at https://chromium-cpp.appspot.com/; it can
+be used without restriction by Chromium's dependencies, except that objects
+compiled into Chromium itself cannot use anything relying on
+absl::base_internal::FastTypeId (see https://crbug.com/1096380).
How to update Abseil:
diff --git a/absl.gni b/absl.gni
index 88ce3aa..dc87e2a 100644
--- a/absl.gni
+++ b/absl.gni
@@ -7,9 +7,6 @@
# This template will correctly set "configs" and "public_configs" in order
# to correctly compile abseil in Chromium.
#
-# Targets that set visibility should set it to something more restrictive than
-# `absl_visibility` (defined below).
-#
# Usage:
# Most of the times its usage will be similar to the example below but all
# the arguments avilable in source_set are also available for absl_source_set.
@@ -22,35 +19,6 @@
import("//build_overrides/build.gni")
-# Usage of Abseil in Chromium is guarded by an explicit opt-in list, before
-# adding projects to this list please reach out to cxx@chromium.org and CC:
-# - https://cs.chromium.org/chromium/src/third_party/abseil-cpp/OWNERS
-#
-# More information can be found at:
-# https://docs.google.com/document/d/1DgS1-A3rzboTLjpf4m1sqkJgWjnY_Ru2dokk1X1vBDU
-declare_args() {
- # Additional targets that can depend on absl.
- additional_absl_clients = []
-}
-
-_chromium_absl_clients = [
- "//chrome/services/sharing/nearby/platform_v2/*",
- "//third_party/blink/renderer/modules/peerconnection",
- "//third_party/blink/renderer/platform",
- "//third_party/googletest:gtest",
- "//third_party/openscreen/src/third_party/abseil/*",
- "//third_party/private_membership/*",
- "//third_party/shell-encryption/*",
- "//third_party/webrtc/*",
- "//third_party/nearby/*",
-]
-
-# When adding a new package to `absl_visibility`, please check that all the
-# Abseil dependencies that are required are listed in the dependencies of
-# //third_party/abseil-cpp:absl. If not, please add them and run:
-# //third_party/abseil-cpp/generate_def_file.py.
-absl_visibility = _chromium_absl_clients + additional_absl_clients
-
template("absl_source_set") {
source_set(target_name) {
forward_variables_from(invoker, "*")
@@ -75,8 +43,14 @@
public_configs += [ "//third_party/abseil-cpp:absl_include_config" ]
if (!defined(visibility)) {
+ # Within Chromium builds, restrict direct visibility of Abseil sources, so
+ # users must depend on //third_party/abseil-cpp:absl. This prevents use of
+ # banned targets like absl/types:any. A few targets require exceptions.
+ # TODO(crbug.com/1096380): Consider replacing build_with_chromium with
+ # is_component_build for a narrower, more accurate condition.
if (build_with_chromium) {
visibility = [
+ # Abseil itself.
"//third_party/abseil-cpp/*",
# WebRTC binary to run PSNR and SSIM video quality analysis. It
@@ -85,7 +59,7 @@
# component because it uses absl/flags.
"//third_party/webrtc/rtc_tools:frame_analyzer",
- # WebRTC binaries used by //:chromium_builder_asan, they both
+ # WebRTC binaries used by //:chromium_builder_asan. They both
# statically link absl (because they depend on absl/flags) and are
# used by Chromium only when is_component_build=false.
"//third_party/webrtc/rtc_tools:rtp_generator",