Replace QuicheOptional with absl::optional.
PiperOrigin-RevId: 336947387
Change-Id: I20fa90b62347b2fbb08e68db34a22cd182ef2b64
diff --git a/common/platform/api/quiche_optional.h b/common/platform/api/quiche_optional.h
deleted file mode 100644
index d5d3dac..0000000
--- a/common/platform/api/quiche_optional.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_OPTIONAL_H_
-#define QUICHE_COMMON_PLATFORM_API_QUICHE_OPTIONAL_H_
-
-#include <utility>
-
-#include "net/quiche/common/platform/impl/quiche_optional_impl.h"
-
-namespace quiche {
-
-template <typename T>
-using QuicheOptional = QuicheOptionalImpl<T>;
-
-#define QUICHE_NULLOPT QUICHE_NULLOPT_IMPL
-
-} // namespace quiche
-
-#endif // QUICHE_COMMON_PLATFORM_API_QUICHE_OPTIONAL_H_
diff --git a/common/platform/api/quiche_text_utils.h b/common/platform/api/quiche_text_utils.h
index 0aab251..3e83063 100644
--- a/common/platform/api/quiche_text_utils.h
+++ b/common/platform/api/quiche_text_utils.h
@@ -8,8 +8,8 @@
#include <string>
#include "absl/strings/string_view.h"
+#include "absl/types/optional.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
#include "net/quiche/common/platform/impl/quiche_text_utils_impl.h"
namespace quiche {
@@ -107,7 +107,7 @@
// Decodes a base64-encoded |input|. Returns nullopt when the input is
// invalid.
- static QuicheOptional<std::string> Base64Decode(absl::string_view input) {
+ static absl::optional<std::string> Base64Decode(absl::string_view input) {
return quiche::QuicheTextUtilsImpl::Base64Decode(input);
}
diff --git a/common/platform/api/quiche_time_utils.h b/common/platform/api/quiche_time_utils.h
index 7319568..e1e59f0 100644
--- a/common/platform/api/quiche_time_utils.h
+++ b/common/platform/api/quiche_time_utils.h
@@ -16,7 +16,7 @@
// instance, it will reject February 29 on non-leap years, or 25 hours in a day.
// As a notable exception, 60 seconds is accepted to deal with potential leap
// seconds. If the date predates Unix epoch, nullopt will be returned.
-inline QuicheOptional<int64_t> QuicheUtcDateTimeToUnixSeconds(int year,
+inline absl::optional<int64_t> QuicheUtcDateTimeToUnixSeconds(int year,
int month,
int day,
int hour,
diff --git a/common/platform/api/quiche_time_utils_test.cc b/common/platform/api/quiche_time_utils_test.cc
index 3ae296d..e32b8b2 100644
--- a/common/platform/api/quiche_time_utils_test.cc
+++ b/common/platform/api/quiche_time_utils_test.cc
@@ -4,7 +4,7 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_time_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
+#include "absl/types/optional.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
namespace quiche {
@@ -19,26 +19,24 @@
QuicheUtcDateTimeToUnixSeconds(2006, 7, 15, 12, 34, 56));
EXPECT_EQ(1591130001, QuicheUtcDateTimeToUnixSeconds(2020, 6, 2, 20, 33, 21));
- EXPECT_EQ(QUICHE_NULLOPT,
+ EXPECT_EQ(absl::nullopt,
QuicheUtcDateTimeToUnixSeconds(1970, 2, 29, 0, 0, 1));
- EXPECT_NE(QUICHE_NULLOPT,
+ EXPECT_NE(absl::nullopt,
QuicheUtcDateTimeToUnixSeconds(1972, 2, 29, 0, 0, 1));
}
TEST(QuicheTimeUtilsTest, Bounds) {
- EXPECT_EQ(QUICHE_NULLOPT,
+ EXPECT_EQ(absl::nullopt,
QuicheUtcDateTimeToUnixSeconds(1970, 1, 32, 0, 0, 1));
- EXPECT_EQ(QUICHE_NULLOPT,
+ EXPECT_EQ(absl::nullopt,
QuicheUtcDateTimeToUnixSeconds(1970, 4, 31, 0, 0, 1));
- EXPECT_EQ(QUICHE_NULLOPT,
- QuicheUtcDateTimeToUnixSeconds(1970, 1, 0, 0, 0, 1));
- EXPECT_EQ(QUICHE_NULLOPT,
+ EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 1, 0, 0, 0, 1));
+ EXPECT_EQ(absl::nullopt,
QuicheUtcDateTimeToUnixSeconds(1970, 13, 1, 0, 0, 1));
- EXPECT_EQ(QUICHE_NULLOPT,
- QuicheUtcDateTimeToUnixSeconds(1970, 0, 1, 0, 0, 1));
- EXPECT_EQ(QUICHE_NULLOPT,
+ EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 0, 1, 0, 0, 1));
+ EXPECT_EQ(absl::nullopt,
QuicheUtcDateTimeToUnixSeconds(1970, 1, 1, 24, 0, 0));
- EXPECT_EQ(QUICHE_NULLOPT,
+ EXPECT_EQ(absl::nullopt,
QuicheUtcDateTimeToUnixSeconds(1970, 1, 1, 0, 60, 0));
}
@@ -46,7 +44,7 @@
EXPECT_EQ(QuicheUtcDateTimeToUnixSeconds(2015, 6, 30, 23, 59, 60),
QuicheUtcDateTimeToUnixSeconds(2015, 7, 1, 0, 0, 0));
EXPECT_EQ(QuicheUtcDateTimeToUnixSeconds(2015, 6, 30, 25, 59, 60),
- QUICHE_NULLOPT);
+ absl::nullopt);
}
} // namespace