Title: [231342] trunk/Source
- Revision
- 231342
- Author
- [email protected]
- Date
- 2018-05-03 18:00:18 -0700 (Thu, 03 May 2018)
Log Message
Use default std::optional if it is provided
https://bugs.webkit.org/show_bug.cgi?id=185159
Reviewed by Michael Catanzaro.
Source/WebKit:
* Shared/SandboxExtension.h:
(WebKit::SandboxExtension::Handle::decode):
* Shared/TouchBarMenuItemData.cpp:
(WebKit::TouchBarMenuItemData::decode):
Source/WTF:
* wtf/Expected.h:
* wtf/Optional.h:
Do not use <optional> for clang currently.
(WTF::valueOrCompute):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (231341 => 231342)
--- trunk/Source/WTF/ChangeLog 2018-05-04 00:55:28 UTC (rev 231341)
+++ trunk/Source/WTF/ChangeLog 2018-05-04 01:00:18 UTC (rev 231342)
@@ -1,3 +1,15 @@
+2018-05-03 Yusuke Suzuki <[email protected]>
+
+ Use default std::optional if it is provided
+ https://bugs.webkit.org/show_bug.cgi?id=185159
+
+ Reviewed by Michael Catanzaro.
+
+ * wtf/Expected.h:
+ * wtf/Optional.h:
+ Do not use <optional> for clang currently.
+ (WTF::valueOrCompute):
+
2018-05-03 Filip Pizlo <[email protected]>
Strings should not be allocated in a gigacage
Modified: trunk/Source/WTF/wtf/Expected.h (231341 => 231342)
--- trunk/Source/WTF/wtf/Expected.h 2018-05-04 00:55:28 UTC (rev 231341)
+++ trunk/Source/WTF/wtf/Expected.h 2018-05-04 01:00:18 UTC (rev 231342)
@@ -573,5 +573,5 @@
}}} // namespace std::experimental::fundamentals_v3
-__EXPECTED_INLINE_VARIABLE constexpr std::experimental::unexpected_t& unexpect = std::experimental::unexpect;
+__EXPECTED_INLINE_VARIABLE constexpr auto& unexpect = std::experimental::unexpect;
template<class T, class E> using Expected = std::experimental::expected<T, E>;
Modified: trunk/Source/WTF/wtf/Optional.h (231341 => 231342)
--- trunk/Source/WTF/wtf/Optional.h 2018-05-04 00:55:28 UTC (rev 231341)
+++ trunk/Source/WTF/wtf/Optional.h 2018-05-04 01:00:18 UTC (rev 231342)
@@ -47,6 +47,10 @@
# include <wtf/Compiler.h>
# include <wtf/StdLibExtras.h>
+#if !COMPILER(MSVC) && !PLATFORM(COCOA) && __has_include(<optional>)
+# include <optional>
+#else
+
# define TR2_OPTIONAL_REQUIRES(...) typename std::enable_if<__VA_ARGS__::value, bool>::type = false
# if defined __GNUC__ // NOTE: GNUC is also defined for Clang
@@ -1012,20 +1016,6 @@
} // namespace std
-namespace WTF {
-
-// -- WebKit Additions --
-template <class OptionalType, class Callback>
-ALWAYS_INLINE
-auto valueOrCompute(OptionalType optional, Callback callback) -> typename OptionalType::value_type
-{
- if (optional)
- return *optional;
- return callback();
-}
-
-} // namespace WTF
-
namespace std
{
template <typename T>
@@ -1054,4 +1044,20 @@
# undef TR2_OPTIONAL_REQUIRES
# undef TR2_OPTIONAL_ASSERTED_EXPRESSION
+#endif // defined(__cpp_lib_optional)
+
+namespace WTF {
+
+// -- WebKit Additions --
+template <class OptionalType, class Callback>
+ALWAYS_INLINE
+auto valueOrCompute(OptionalType optional, Callback callback) -> typename OptionalType::value_type
+{
+ if (optional)
+ return *optional;
+ return callback();
+}
+
+} // namespace WTF
+
using WTF::valueOrCompute;
Modified: trunk/Source/WebKit/ChangeLog (231341 => 231342)
--- trunk/Source/WebKit/ChangeLog 2018-05-04 00:55:28 UTC (rev 231341)
+++ trunk/Source/WebKit/ChangeLog 2018-05-04 01:00:18 UTC (rev 231342)
@@ -1,3 +1,15 @@
+2018-05-03 Yusuke Suzuki <[email protected]>
+
+ Use default std::optional if it is provided
+ https://bugs.webkit.org/show_bug.cgi?id=185159
+
+ Reviewed by Michael Catanzaro.
+
+ * Shared/SandboxExtension.h:
+ (WebKit::SandboxExtension::Handle::decode):
+ * Shared/TouchBarMenuItemData.cpp:
+ (WebKit::TouchBarMenuItemData::decode):
+
2018-05-03 Justin Fan <[email protected]>
[WebGL] Add runtime flag for enabling ASTC support in WebGL
Modified: trunk/Source/WebKit/Shared/SandboxExtension.h (231341 => 231342)
--- trunk/Source/WebKit/Shared/SandboxExtension.h 2018-05-04 00:55:28 UTC (rev 231341)
+++ trunk/Source/WebKit/Shared/SandboxExtension.h 2018-05-04 01:00:18 UTC (rev 231342)
@@ -120,7 +120,7 @@
inline SandboxExtension::Handle::Handle() { }
inline SandboxExtension::Handle::~Handle() { }
inline void SandboxExtension::Handle::encode(IPC::Encoder&) const { }
-inline std::optional<SandboxExtension::Handle> SandboxExtension::Handle::decode(IPC::Decoder&) { return {{ }}; }
+inline std::optional<SandboxExtension::Handle> SandboxExtension::Handle::decode(IPC::Decoder&) { return SandboxExtension::Handle { }; }
inline SandboxExtension::HandleArray::HandleArray() { }
inline SandboxExtension::HandleArray::~HandleArray() { }
inline void SandboxExtension::HandleArray::allocate(size_t) { }
Modified: trunk/Source/WebKit/Shared/TouchBarMenuItemData.cpp (231341 => 231342)
--- trunk/Source/WebKit/Shared/TouchBarMenuItemData.cpp 2018-05-04 00:55:28 UTC (rev 231341)
+++ trunk/Source/WebKit/Shared/TouchBarMenuItemData.cpp 2018-05-04 01:00:18 UTC (rev 231342)
@@ -65,7 +65,7 @@
if (!decoder.decode(result.priority))
return std::nullopt;
- return WTFMove(result);
+ return std::make_optional(WTFMove(result));
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes