Rename {absl => std}::optional Final n°2
#cleanup
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 "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"
```
Cleanup: rename
Bug: chromium:1500249
Change-Id: I7cb6bc208109aa9b0a2d70e6cd5a7253c3cc4c0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5321725
Commit-Queue: danakj <[email protected]>
Owners-Override: danakj <[email protected]>
Reviewed-by: danakj <[email protected]>
Auto-Submit: Arthur Sonzogni <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1265221}
diff --git a/components/power_metrics/smc_mac.h b/components/power_metrics/smc_mac.h
index cb2a715..74a7ff86 100644
--- a/components/power_metrics/smc_mac.h
+++ b/components/power_metrics/smc_mac.h
@@ -12,11 +12,11 @@
#import <Foundation/Foundation.h>
#include <memory>
+#include <optional>
#include "base/containers/flat_map.h"
#include "base/mac/scoped_ioobject.h"
#include "components/power_metrics/smc_internal_types_mac.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
namespace power_metrics {
@@ -29,7 +29,7 @@
// Returns the value of a key, or nullopt if not available.
// Virtual for testing.
- virtual absl::optional<double> ReadKey(SMCKeyIdentifier identifier);
+ virtual std::optional<double> ReadKey(SMCKeyIdentifier identifier);
protected:
explicit SMCReader(base::mac::ScopedIOObject<io_object_t> connect);
@@ -44,7 +44,7 @@
~SMCKey();
bool Exists() const;
- absl::optional<double> Read();
+ std::optional<double> Read();
private:
bool CallSMCFunction(uint8_t function, SMCParamStruct* out);