[go: nahoru, domu]

Rename {absl => std}::optional in //ash/

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&utm_source=footer

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 "^ash" \
    | 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>"
git cl format
```

Bug: chromium:1500249
AX-Relnotes: n/a.
Change-Id: I7087c89bc345e825ebcb8c66325f4dcc9d72c3b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5062951
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1230002}
diff --git a/ash/system/pcie_peripheral/pcie_peripheral_notification_controller_unittest.cc b/ash/system/pcie_peripheral/pcie_peripheral_notification_controller_unittest.cc
index 95b3668a..4be1c4b 100644
--- a/ash/system/pcie_peripheral/pcie_peripheral_notification_controller_unittest.cc
+++ b/ash/system/pcie_peripheral/pcie_peripheral_notification_controller_unittest.cc
@@ -5,6 +5,7 @@
 #include "ash/system/pcie_peripheral/pcie_peripheral_notification_controller.h"
 
 #include <memory>
+#include <optional>
 #include <vector>
 
 #include "ash/constants/ash_pref_names.h"
@@ -16,7 +17,6 @@
 #include "base/memory/raw_ptr.h"
 #include "components/prefs/pref_service.h"
 #include "testing/gmock/include/gmock/gmock.h"
-#include "third_party/abseil-cpp/absl/types/optional.h"
 #include "ui/message_center/fake_message_center.h"
 #include "ui/message_center/message_center.h"
 #include "ui/message_center/public/cpp/notification.h"
@@ -111,20 +111,20 @@
         prefs::kPciePeripheralDisplayNotificationRemaining);
   }
 
-  void ClickLimitedNotificationButton(absl::optional<int> button_index) {
+  void ClickLimitedNotificationButton(std::optional<int> button_index) {
     // No button index means the notification body was clicked.
     if (!button_index.has_value()) {
       message_center::Notification* notification =
           MessageCenter::Get()->FindVisibleNotificationById(
               kPciePeripheralLimitedPerformanceNotificationId);
-      notification->delegate()->Click(absl::nullopt, absl::nullopt);
+      notification->delegate()->Click(std::nullopt, std::nullopt);
       return;
     }
 
     message_center::Notification* notification =
         MessageCenter::Get()->FindVisibleNotificationById(
             kPciePeripheralLimitedPerformanceNotificationId);
-    notification->delegate()->Click(button_index, absl::nullopt);
+    notification->delegate()->Click(button_index, std::nullopt);
   }
 
   void ClickGuestNotification(bool is_thunderbolt_only) {
@@ -315,7 +315,7 @@
   EXPECT_EQ(2u, notification->buttons().size());
 
   // Click the notification body.
-  ClickLimitedNotificationButton(absl::nullopt);
+  ClickLimitedNotificationButton(std::nullopt);
   EXPECT_EQ(0, GetPrefNotificationCount());
   EXPECT_EQ(0u, MessageCenter::Get()->NotificationCount());
   EXPECT_EQ(1, GetNumOsPrivacySettingsOpened());