Rename {absl => std}::optional in base + everywhere. [Final]
Automated patch. This is a no-op. Please avoid, as much as possible,
assigning unrelated bugs to this.
Context:
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email
As of https://crrev.com/1204351, absl::optional is now a type alias
for std::optional. We should migrate toward it.
Script:
```
function replace {
echo "Replacing $1 by $2"
git grep -l "$1" \
| cut -f1 -d: \
| grep -v \
-e "components/cast_streaming/browser/public/receiver_config.*" \
-e "components/power_metrics/*" \
-e "components/zucchini/patch_reader.*" \
-e "third_party/abseil-cpp/*" \
-e "third_party/googletest/*" \
-e "third_party/leveldatabase/*" \
-e "third_party/libaddressinput/" \
-e "third_party/liburlpattern/*" \
-e "third_party/lzma_sdk/*" \
-e "third_party/maldoca/*" \
-e "third_party/mediapipe/*" \
-e "third_party/shell-encryption/*"\
-e "third_party/tflite_support/*" \
-e "third_party/webrtc_overrides/*" \
-e "third_party/zxcvbn-cpp/*" \
| grep \
-e "\.h" \
-e "\.cc" \
-e "\.mm" \
-e "\.pidl" \
| sort \
| uniq \
| xargs sed -i "s/$1/$2/g"
}
replace "absl::make_optional" "std::make_optional"
replace "absl::optional" "std::optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place," "std::in_place,"
replace "absl::in_place_t," "std::in_place_t,"
replace "absl::in_place)" "std::in_place)"
replace "absl::in_place_t)" "std::in_place_t)"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
git status
echo "Formatting"
echo "IncludeBlocks: Regroup" >> ".clang-format"
echo "IncludeIsMainRegex: \"(_(android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?(_(unit|browser|perf)?tests?)?$\"" >> ".clang-format"
git cl format
git restore ".clang-format"
```
Bug: chromium:1500249
Change-Id: Ic2994b982bbc64d62f030d3d158979dc5d266121
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5296147
Reviewed-by: danakj <[email protected]>
Commit-Queue: danakj <[email protected]>
Owners-Override: danakj <[email protected]>
Auto-Submit: Arthur Sonzogni <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1263362}
diff --git a/base/metrics/histogram_shared_memory.h b/base/metrics/histogram_shared_memory.h
index 56b6089..88f39fa6 100644
--- a/base/metrics/histogram_shared_memory.h
+++ b/base/metrics/histogram_shared_memory.h
@@ -5,6 +5,7 @@
#ifndef BASE_METRICS_HISTOGRAM_SHARED_MEMORY_H_
#define BASE_METRICS_HISTOGRAM_SHARED_MEMORY_H_
+#include <optional>
#include <string_view>
#include "base/base_export.h"
@@ -14,7 +15,6 @@
#include "base/metrics/persistent_memory_allocator.h"
#include "base/process/launch.h"
#include "build/build_config.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE)
#include "base/files/platform_file.h"
@@ -76,8 +76,8 @@
// |process_id| based on |config|. On success, returns true and updates
// the values of |memory_region| and |allocator|. On failure, returns false
// and |memory_region| and |allocator| are unchanged.
- static absl::optional<SharedMemory> Create(int process_id,
- const Config& config);
+ static std::optional<SharedMemory> Create(int process_id,
+ const Config& config);
#if BUILDFLAG(IS_APPLE)
// Exposed for testing.