Rename {absl => std}::optional in //chrome/
#cleanup
Automated patch, intended to be effectively a no-op.
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 \
-e "^chrome/" \
| sort \
| uniq \
| grep \
-e "\.h" \
-e "\.cc" \
-e "\.mm" \
-e "\.py" \
| 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 "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
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"
git cl format
```
Bug: chromium:1500249
Change-Id: I5f8d179940c7af6a927efbf7e70b972a845a4127
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5192010
Reviewed-by: Anastasiia N <[email protected]>
Commit-Queue: Arthur Sonzogni <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Auto-Submit: Arthur Sonzogni <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1247101}
diff --git a/chrome/browser/command_updater_impl.cc b/chrome/browser/command_updater_impl.cc
index 5c05fc16..8a714d1 100644
--- a/chrome/browser/command_updater_impl.cc
+++ b/chrome/browser/command_updater_impl.cc
@@ -5,16 +5,16 @@
#include "chrome/browser/command_updater_impl.h"
#include <algorithm>
+#include <optional>
#include "base/check.h"
#include "base/observer_list.h"
#include "chrome/browser/command_observer.h"
#include "chrome/browser/command_updater_delegate.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
struct CommandUpdaterImpl::Command {
// Empty optional means not specified yet and thus implicitly disabled.
- absl::optional<bool> enabled;
+ std::optional<bool> enabled;
base::ObserverList<CommandObserver>::Unchecked observers;
};
@@ -31,8 +31,9 @@
bool CommandUpdaterImpl::IsCommandEnabled(int id) const {
auto command = commands_.find(id);
- if (command == commands_.end() || command->second->enabled == absl::nullopt)
+ if (command == commands_.end() || command->second->enabled == std::nullopt) {
return false;
+ }
return *command->second->enabled;
}