Title: [207517] trunk
Revision
207517
Author
commit-qu...@webkit.org
Date
2016-10-18 19:43:44 -0700 (Tue, 18 Oct 2016)

Log Message

Replace std::experimental::variant with WTF::Variant (or similar)
https://bugs.webkit.org/show_bug.cgi?id=163626

Patch by Sam Weinig <s...@webkit.org> on 2016-10-18
Reviewed by Chris Dumez.

Rename std::experimental::variant, Variant. Move helpers get/holds_alternative/etc.
into the WTF namespace.

Source/_javascript_Core:

* domjit/DOMJITReg.h:
(JSC::DOMJIT::Reg::gpr):
(JSC::DOMJIT::Reg::fpr):
(JSC::DOMJIT::Reg::jsValueRegs):

Source/WebCore:

* Modules/fetch/FetchBody.h:
(WebCore::FetchBody::isBlob):
(WebCore::FetchBody::isFormData):
(WebCore::FetchBody::isArrayBuffer):
(WebCore::FetchBody::isArrayBufferView):
(WebCore::FetchBody::isURLSearchParams):
(WebCore::FetchBody::isText):
(WebCore::FetchBody::blobBody):
(WebCore::FetchBody::formDataBody):
(WebCore::FetchBody::arrayBufferBody):
(WebCore::FetchBody::arrayBufferViewBody):
(WebCore::FetchBody::textBody):
(WebCore::FetchBody::urlSearchParamsBody):
* bindings/generic/IDLTypes.h:
* dom/ExceptionOr.h:
(WebCore::ExceptionOr<ReturnType>::hasException):
(WebCore::ExceptionOr<ReturnType>::releaseException):
(WebCore::ExceptionOr<ReturnType>::releaseReturnValue):
* dom/MessageEvent.cpp:
(WebCore::MessageEvent::source):
* dom/MessageEvent.h:
* dom/Node.cpp:
(WebCore::nodeSetPreTransformedFromNodeOrStringVector):
(WebCore::Node::convertNodesOrStringsIntoNode):
* dom/Node.h:
* html/HTMLOptionsCollection.h:
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::add):
* html/HTMLSelectElement.h:
* html/track/TrackEvent.cpp:
(WebCore::TrackEvent::TrackEvent):
* html/track/TrackEvent.h:

Source/WebKit/mac:

* DOM/DOMHTMLSelectElement.mm:
(-[DOMHTMLSelectElement add:before:]):

Source/WTF:

* wtf/Forward.h:
* wtf/Variant.h:

Tools:

* TestWebKitAPI/Tests/WTF/Variant.cpp:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (207516 => 207517)


--- trunk/Source/_javascript_Core/ChangeLog	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-10-19 02:43:44 UTC (rev 207517)
@@ -1,3 +1,18 @@
+2016-10-18  Sam Weinig  <s...@webkit.org>
+
+        Replace std::experimental::variant with WTF::Variant (or similar)
+        https://bugs.webkit.org/show_bug.cgi?id=163626
+
+        Reviewed by Chris Dumez.
+
+        Rename std::experimental::variant, Variant. Move helpers get/holds_alternative/etc.
+        into the WTF namespace.
+
+        * domjit/DOMJITReg.h:
+        (JSC::DOMJIT::Reg::gpr):
+        (JSC::DOMJIT::Reg::fpr):
+        (JSC::DOMJIT::Reg::jsValueRegs):
+
 2016-10-18  Keith Miller  <keith_mil...@apple.com>
 
         GetByVal to GetById conversion in the DFG is incorrect for getters with control flow

Modified: trunk/Source/_javascript_Core/domjit/DOMJITReg.h (207516 => 207517)


--- trunk/Source/_javascript_Core/domjit/DOMJITReg.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/_javascript_Core/domjit/DOMJITReg.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -71,21 +71,21 @@
     GPRReg gpr() const
     {
         ASSERT(isGPR());
-        return std::experimental::get<GPRReg>(m_variant);
+        return WTF::get<GPRReg>(m_variant);
     }
     FPRReg fpr() const
     {
         ASSERT(isFPR());
-        return std::experimental::get<FPRReg>(m_variant);
+        return WTF::get<FPRReg>(m_variant);
     }
     JSValueRegs jsValueRegs() const
     {
         ASSERT(isJSValueRegs());
-        return std::experimental::get<JSValueRegs>(m_variant);
+        return WTF::get<JSValueRegs>(m_variant);
     }
 
 private:
-    std::experimental::variant<GPRReg, FPRReg, JSValueRegs> m_variant;
+    Variant<GPRReg, FPRReg, JSValueRegs> m_variant;
 };
 
 } }

Modified: trunk/Source/WTF/ChangeLog (207516 => 207517)


--- trunk/Source/WTF/ChangeLog	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WTF/ChangeLog	2016-10-19 02:43:44 UTC (rev 207517)
@@ -1,3 +1,16 @@
+2016-10-18  Sam Weinig  <s...@webkit.org>
+
+        Replace std::experimental::variant with WTF::Variant (or similar)
+        https://bugs.webkit.org/show_bug.cgi?id=163626
+
+        Reviewed by Chris Dumez.
+
+        Rename std::experimental::variant, Variant. Move helpers get/holds_alternative/etc.
+        into the WTF namespace.
+
+        * wtf/Forward.h:
+        * wtf/Variant.h:
+
 2016-10-18  Filip Pizlo  <fpi...@apple.com>
 
         WTF should make it easier to create threads that die automatically after inactivity

Modified: trunk/Source/WTF/wtf/Forward.h (207516 => 207517)


--- trunk/Source/WTF/wtf/Forward.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WTF/wtf/Forward.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -34,6 +34,7 @@
 template<typename T> class RefPtr;
 template<typename T> class StringBuffer;
 
+template<typename... T> class Variant;
 template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> class Vector;
 
 class AtomicString;
@@ -51,18 +52,6 @@
 
 }
 
-namespace std {
-namespace experimental {
-
-template<typename... T> class variant;
-
-}
-
-template<typename... Types>
-using variant = std::experimental::variant<Types...>;
-
-}
-
 using WTF::AtomicString;
 using WTF::AtomicStringImpl;
 using WTF::BinarySemaphore;
@@ -84,4 +73,5 @@
 using WTF::StringImpl;
 using WTF::StringView;
 using WTF::TextPosition;
+using WTF::Variant;
 using WTF::Vector;

Modified: trunk/Source/WTF/wtf/Variant.h (207516 => 207517)


--- trunk/Source/WTF/wtf/Variant.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WTF/wtf/Variant.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -59,8 +59,7 @@
 
 #if !COMPILER(CLANG) || WTF_CPP_STD_VER >= 14
 
-namespace std {
-namespace experimental {
+namespace WTF {
 
 #if COMPILER_SUPPORTS(EXCEPTIONS)
 #define __THROW_EXCEPTION(__exception) throw __exception;
@@ -165,7 +164,7 @@
 };
 
 template<typename ... _Types>
-class variant;
+class Variant;
 
 template<typename>
 struct variant_size;
@@ -180,7 +179,7 @@
 struct variant_size<const volatile _Type> : variant_size<_Type> {};
 
 template <typename... _Types>
-struct variant_size<variant<_Types...>>
+struct variant_size<Variant<_Types...>>
     : std::integral_constant<size_t, sizeof...(_Types)> {};
 
 template<size_t _Index,typename _Type>
@@ -205,7 +204,7 @@
 };
 
 template<size_t _Index,typename ... _Types>
-struct variant_alternative<_Index,variant<_Types...>>{
+struct variant_alternative<_Index,Variant<_Types...>>{
     using type=typename __indexed_type<_Index,_Types...>::__type;
 };
 
@@ -212,43 +211,43 @@
 constexpr size_t variant_npos=-1;
 
 template<typename _Type,typename ... _Types>
-constexpr _Type& get(variant<_Types...>&);
+constexpr _Type& get(Variant<_Types...>&);
 
 template<typename _Type,typename ... _Types>
-constexpr _Type const& get(variant<_Types...> const&);
+constexpr _Type const& get(Variant<_Types...> const&);
 
 template<typename _Type,typename ... _Types>
-constexpr _Type&& get(variant<_Types...>&&);
+constexpr _Type&& get(Variant<_Types...>&&);
 
 template<typename _Type,typename ... _Types>
-constexpr const _Type&& get(variant<_Types...> const&&);
+constexpr const _Type&& get(Variant<_Types...> const&&);
 
 template<ptrdiff_t _Index,typename ... _Types>
-constexpr typename __indexed_type<_Index,_Types...>::__type& get(variant<_Types...>&);
+constexpr typename __indexed_type<_Index,_Types...>::__type& get(Variant<_Types...>&);
 
 template<ptrdiff_t _Index,typename ... _Types>
-constexpr typename __indexed_type<_Index,_Types...>::__type&& get(variant<_Types...>&&);
+constexpr typename __indexed_type<_Index,_Types...>::__type&& get(Variant<_Types...>&&);
 
 template<ptrdiff_t _Index,typename ... _Types>
 constexpr typename __indexed_type<_Index,_Types...>::__type const& get(
-    variant<_Types...> const&);
+    Variant<_Types...> const&);
 
 template <ptrdiff_t _Index, typename... _Types>
 constexpr const typename __indexed_type<_Index, _Types...>::__type &&
-get(variant<_Types...> const &&);
+get(Variant<_Types...> const &&);
 
 template<typename _Type,typename ... _Types>
-constexpr std::add_pointer_t<_Type> get_if(variant<_Types...>&);
+constexpr std::add_pointer_t<_Type> get_if(Variant<_Types...>&);
 
 template<typename _Type,typename ... _Types>
-constexpr std::add_pointer_t<_Type const> get_if(variant<_Types...> const&);
+constexpr std::add_pointer_t<_Type const> get_if(Variant<_Types...> const&);
 
 template<ptrdiff_t _Index,typename ... _Types>
-constexpr std::add_pointer_t<typename __indexed_type<_Index,_Types...>::__type> get_if(variant<_Types...>&);
+constexpr std::add_pointer_t<typename __indexed_type<_Index,_Types...>::__type> get_if(Variant<_Types...>&);
 
 template<ptrdiff_t _Index,typename ... _Types>
 constexpr std::add_pointer_t<typename __indexed_type<_Index,_Types...>::__type const> get_if(
-    variant<_Types...> const&);
+    Variant<_Types...> const&);
 
 template<ptrdiff_t _Index,typename ... _Types>
 struct __variant_accessor;
@@ -379,7 +378,7 @@
 struct __any_backup_storage_required;
 
 template<typename ... _Types>
-struct __any_backup_storage_required<variant<_Types...> >{
+struct __any_backup_storage_required<Variant<_Types...> >{
     static const bool __value=
         __any_backup_storage_required_impl<0,sizeof...(_Types),_Types...>::__value;
 };
@@ -704,7 +703,7 @@
 struct __variant_indices;
 
 template<typename ... _Types>
-struct __variant_indices<variant<_Types...>>{
+struct __variant_indices<Variant<_Types...>>{
     typedef typename __type_indices<_Types...>::__type __type;
 };
 
@@ -1436,17 +1435,17 @@
 {};
 
 template<typename ... _Types>
-class variant:
+class Variant:
         private __variant_base<
-    variant<_Types...>,__all_trivially_destructible<_Types...>::__value>
+    Variant<_Types...>,__all_trivially_destructible<_Types...>::__value>
 {
-    typedef __variant_base<variant<_Types...>,__all_trivially_destructible<_Types...>::__value> __base_type;
+    typedef __variant_base<Variant<_Types...>,__all_trivially_destructible<_Types...>::__value> __base_type;
     friend __base_type;
-    friend struct __copy_construct_op_table<variant>;
-    friend struct __copy_assign_op_table<variant>;
-    friend struct __move_construct_op_table<variant>;
-    friend struct __move_assign_op_table<variant>;
-    friend struct __destroy_op_table<variant>;
+    friend struct __copy_construct_op_table<Variant>;
+    friend struct __copy_assign_op_table<Variant>;
+    friend struct __move_construct_op_table<Variant>;
+    friend struct __move_assign_op_table<Variant>;
+    friend struct __destroy_op_table<Variant>;
     
     template<ptrdiff_t _Index,typename ... _Types2>
     friend struct __variant_accessor;
@@ -1467,24 +1466,24 @@
     void __destroy_self(){
         if(valueless_by_exception())
             return;
-        __destroy_op_table<variant>::__apply[index()](this);
+        __destroy_op_table<Variant>::__apply[index()](this);
         __index=-1;
     }
     
-    ptrdiff_t __move_construct(variant& __other){
+    ptrdiff_t __move_construct(Variant& __other){
         ptrdiff_t const __other_index=__other.index();
         if(__other_index==-1)
             return -1;
-        __move_construct_op_table<variant>::__apply[__other_index](this,__other);
+        __move_construct_op_table<Variant>::__apply[__other_index](this,__other);
         __other.__destroy_self();
         return __other_index;
     }
 
-    ptrdiff_t __copy_construct(variant const& __other){
+    ptrdiff_t __copy_construct(Variant const& __other){
         ptrdiff_t const __other_index=__other.index();
         if(__other_index==-1)
             return -1;
-        __copy_construct_op_table<variant>::__apply[__other_index](this,__other);
+        __copy_construct_op_table<Variant>::__apply[__other_index](this,__other);
         return __other_index;
     }
 
@@ -1531,35 +1530,35 @@
     struct __private_type{};
 
 public:
-    constexpr variant()
+    constexpr Variant()
         __NOEXCEPT_(noexcept(typename __indexed_type<0,_Types...>::__type())):
         __storage(in_place<0>),
         __index(0)
     {}
 
-    constexpr variant(typename std::conditional<__all_move_constructible<_Types...>::value,variant,__private_type>::type&& __other)
+    constexpr Variant(typename std::conditional<__all_move_constructible<_Types...>::value,Variant,__private_type>::type&& __other)
     __NOEXCEPT_(__noexcept_variant_move_construct<_Types...>::value):
         __index(__move_construct(__other))
     {}
 
-    constexpr variant(typename std::conditional<!__all_move_constructible<_Types...>::value,variant,__private_type>::type&& __other)=delete;
+    constexpr Variant(typename std::conditional<!__all_move_constructible<_Types...>::value,Variant,__private_type>::type&& __other)=delete;
     
-    constexpr variant(typename std::conditional<__all_copy_constructible<_Types...>::value,variant,__private_type>::type& __other)
+    constexpr Variant(typename std::conditional<__all_copy_constructible<_Types...>::value,Variant,__private_type>::type& __other)
     __NOEXCEPT_(__noexcept_variant_non_const_copy_construct<_Types...>::value):
         __index(__copy_construct(__other))
     {}
 
-    constexpr variant(typename std::conditional<!__all_copy_constructible<_Types...>::value,variant,__private_type>::type& __other)=delete;
+    constexpr Variant(typename std::conditional<!__all_copy_constructible<_Types...>::value,Variant,__private_type>::type& __other)=delete;
 
-    constexpr variant(typename std::conditional<__all_copy_constructible<_Types...>::value,variant,__private_type>::type const& __other)
+    constexpr Variant(typename std::conditional<__all_copy_constructible<_Types...>::value,Variant,__private_type>::type const& __other)
     __NOEXCEPT_(__noexcept_variant_const_copy_construct<_Types...>::value):
         __index(__copy_construct(__other))
     {}
 
-    constexpr variant(typename std::conditional<!__all_copy_constructible<_Types...>::value,variant,__private_type>::type const& __other)=delete;
+    constexpr Variant(typename std::conditional<!__all_copy_constructible<_Types...>::value,Variant,__private_type>::type const& __other)=delete;
     
     template<typename _Type,typename ... _Args>
-    explicit constexpr variant(in_place_type_t<_Type>,_Args&& ... __args):
+    explicit constexpr Variant(in_place_type_t<_Type>,_Args&& ... __args):
         __storage(
             in_place<__type_index<_Type,_Types...>::__value>,
             std::forward<_Args>(__args)...),
@@ -1569,7 +1568,7 @@
     }
 
     template<size_t _Index,typename ... _Args>
-    explicit constexpr variant(in_place_index_t<_Index>,_Args&& ... __args):
+    explicit constexpr Variant(in_place_index_t<_Index>,_Args&& ... __args):
         __storage(in_place<_Index>,std::forward<_Args>(__args)...),
         __index(_Index)
     {
@@ -1577,7 +1576,7 @@
     }
     
     template<typename _Type>
-    constexpr variant(_Type&& __x):
+    constexpr Variant(_Type&& __x):
         __storage(
             in_place<
             __type_index_to_construct<_Type,_Types...>::__value>,
@@ -1590,7 +1589,7 @@
              typename std::enable_if<
                  (__constructible_matches<std::initializer_list<_Type>,_Types...>::__type::__length>0)
              >::type>
-    constexpr variant(std::initializer_list<_Type> __x):
+    constexpr Variant(std::initializer_list<_Type> __x):
         __storage(
             in_place<
             __type_index_to_construct<std::initializer_list<_Type>,_Types...>::__value>,
@@ -1599,7 +1598,7 @@
     {}
     
     template<typename _Type>
-    variant& operator=(_Type&& __x){
+    Variant& operator=(_Type&& __x){
         constexpr size_t _Index=
             __type_index_to_construct<_Type,_Types...>::__value;
         if(_Index==__index){
@@ -1611,76 +1610,76 @@
         return *this;
     }
 
-    variant &operator=(
+    Variant &operator=(
         typename std::conditional<
             !(__all_copy_constructible<_Types...>::value &&
               __all_move_constructible<_Types...>::value &&
               __all_copy_assignable<_Types...>::value),
-            variant, __private_type>::type const &__other) = delete;
+            Variant, __private_type>::type const &__other) = delete;
 
-    variant &operator=(
+    Variant &operator=(
         typename std::conditional<
             __all_copy_constructible<_Types...>::value &&
                 __all_move_constructible<_Types...>::value &&
                 __all_copy_assignable<_Types...>::value,
-            variant, __private_type>::type const &__other) {
+            Variant, __private_type>::type const &__other) {
         if (__other.valueless_by_exception()) {
             __destroy_self();
         }
         else if(__other.index()==index()){
-            __copy_assign_op_table<variant>::__apply[index()](this,__other);
+            __copy_assign_op_table<Variant>::__apply[index()](this,__other);
         }
         else{
-            __replace_construct_helper::__op_table<variant>::__copy_assign[
+            __replace_construct_helper::__op_table<Variant>::__copy_assign[
                 __other.index()](this,__other);
         }
         return *this;
     }
-    variant &operator=(
+    Variant &operator=(
         typename std::conditional<
             !(__all_copy_constructible<_Types...>::value &&
               __all_move_constructible<_Types...>::value &&
               __all_copy_assignable<_Types...>::value),
-            variant, __private_type>::type &__other) = delete;
+            Variant, __private_type>::type &__other) = delete;
 
-    variant &operator=(
+    Variant &operator=(
         typename std::conditional<
             __all_copy_constructible<_Types...>::value &&
                 __all_move_constructible<_Types...>::value &&
                 __all_copy_assignable<_Types...>::value,
-            variant, __private_type>::type &__other) {
+            Variant, __private_type>::type &__other) {
         if(__other.valueless_by_exception()){
             __destroy_self();
         }
         else if(__other.index()==index()){
-            __copy_assign_op_table<variant>::__apply[index()](this,__other);
+            __copy_assign_op_table<Variant>::__apply[index()](this,__other);
         }
         else{
-            __replace_construct_helper::__op_table<variant>::__copy_assign[
+            __replace_construct_helper::__op_table<Variant>::__copy_assign[
                 __other.index()](this,__other);
         }
         return *this;
     }
-    variant &operator=(
+    Variant &operator=(
         typename std::conditional<
             !(__all_move_constructible<_Types...>::value &&
               __all_move_assignable<_Types...>::value),
-            variant, __private_type>::type &&__other) = delete;
+            Variant, __private_type>::type &&__other) = delete;
 
-    variant &operator=(
+    Variant &operator=(
         typename std::conditional<__all_move_constructible<_Types...>::value &&
                                       __all_move_assignable<_Types...>::value,
-                                  variant, __private_type>::type &&
+                                  Variant, __private_type>::type &&
             __other) __NOEXCEPT_(__noexcept_variant_move_assign<_Types...>::value) {
         if (__other.valueless_by_exception()) {
             __destroy_self();
         }
         else if(__other.index()==index()){
-            __move_assign_op_table<variant>::__apply[index()](this,__other);
+            __move_assign_op_table<Variant>::__apply[index()](this,__other);
             __other.__destroy_self();
         }
         else{
-            __replace_construct_helper::__op_table<variant>::__move_assign[
+            __replace_construct_helper::__op_table<Variant>::__move_assign[
                 __other.index()](this,__other);
         }
         return *this;
@@ -1708,14 +1707,14 @@
         typename std::conditional<
             __all_swappable<_Types...>::value &&
                 __all_move_constructible<_Types...>::value,
-            variant, __private_type>::type
+            Variant, __private_type>::type
             &__other) __NOEXCEPT_(__noexcept_variant_swap<_Types...>::value) {
         if (__other.index() == index()) {
             if(!valueless_by_exception())
-                __swap_op_table<variant>::__apply[index()](*this,__other);
+                __swap_op_table<Variant>::__apply[index()](*this,__other);
         }
         else{
-            variant __temp(std::move(__other));
+            Variant __temp(std::move(__other));
             __other.__index=__other.__move_construct(*this);
             __index=__move_construct(__temp);
         }
@@ -1723,9 +1722,9 @@
 };
 
 template<>
-class variant<>{
+class Variant<>{
 public:
-    variant()=delete;
+    Variant()=delete;
     
     constexpr bool valueless_by_exception() const __NOEXCEPT{
         return true;
@@ -1734,7 +1733,7 @@
         return -1;
     }
 
-    void swap(variant&){}
+    void swap(Variant&){}
 };
 
 template <typename... _Types>
@@ -1741,7 +1740,7 @@
 typename std::enable_if<__all_swappable<_Types...>::value &&
                             __all_move_constructible<_Types...>::value,
                         void>::type
-swap(variant<_Types...> &__lhs, variant<_Types...> &__rhs) __NOEXCEPT_(
+swap(Variant<_Types...> &__lhs, Variant<_Types...> &__rhs) __NOEXCEPT_(
     __noexcept_variant_swap<_Types...>::value) {
     __lhs.swap(__rhs);
 }
@@ -1749,85 +1748,85 @@
 template<ptrdiff_t _Index,typename ... _Types>
 struct __variant_accessor{
     typedef typename __indexed_type<_Index,_Types...>::__type __type;
-    static constexpr __type& get(variant<_Types...>& __v){
+    static constexpr __type& get(Variant<_Types...>& __v){
         return __v.__storage.__get(in_place<_Index>);
     }
-    static constexpr __type const& get(variant<_Types...> const& __v){
+    static constexpr __type const& get(Variant<_Types...> const& __v){
         return __v.__storage.__get(in_place<_Index>);
     }
-    static constexpr __type&& get(variant<_Types...>&& __v){
+    static constexpr __type&& get(Variant<_Types...>&& __v){
         return __v.__storage.__get_rref(in_place<_Index>);
     }
-    static constexpr const __type&& get(variant<_Types...> const&& __v){
+    static constexpr const __type&& get(Variant<_Types...> const&& __v){
         return __v.__storage.__get_rref(in_place<_Index>);
     }
 };
 
 template<typename _Type,typename ... _Types>
-constexpr _Type& get(variant<_Types...>& __v){
+constexpr _Type& get(Variant<_Types...>& __v){
     return get<__type_index<_Type,_Types...>::__value>(__v);
 }
 
 template<typename _Type,typename ... _Types>
-constexpr _Type&& get(variant<_Types...>&& __v){
+constexpr _Type&& get(Variant<_Types...>&& __v){
     return get<__type_index<_Type,_Types...>::__value>(std::move(__v));
 }
 
 template<typename _Type,typename ... _Types>
-constexpr _Type const& get(variant<_Types...> const& __v){
+constexpr _Type const& get(Variant<_Types...> const& __v){
     return get<__type_index<_Type,_Types...>::__value>(__v);
 }
 
 template<typename _Type,typename ... _Types>
-constexpr const _Type&& get(variant<_Types...> const&& __v){
+constexpr const _Type&& get(Variant<_Types...> const&& __v){
     return get<__type_index<_Type,_Types...>::__value>(std::move(__v));
 }
 
 
 template<ptrdiff_t _Index,typename ... _Types>
-constexpr typename __indexed_type<_Index,_Types...>::__type const& get(variant<_Types...> const& __v){
+constexpr typename __indexed_type<_Index,_Types...>::__type const& get(Variant<_Types...> const& __v){
     return *(
         (_Index!=__v.index())
-            ? &__throw_bad_variant_access<typename __indexed_type<_Index,_Types...>::__type const&>("Bad variant index in get")
+            ? &__throw_bad_variant_access<typename __indexed_type<_Index,_Types...>::__type const&>("Bad Variant index in get")
             : &__variant_accessor<_Index,_Types...>::get(__v)
     );
 }
 
 template<ptrdiff_t _Index,typename ... _Types>
-constexpr typename __indexed_type<_Index,_Types...>::__type& get(variant<_Types...>& __v){
+constexpr typename __indexed_type<_Index,_Types...>::__type& get(Variant<_Types...>& __v){
     return *(
         (_Index!=__v.index())
-            ? &__throw_bad_variant_access<typename __indexed_type<_Index,_Types...>::__type&>("Bad variant index in get")
+            ? &__throw_bad_variant_access<typename __indexed_type<_Index,_Types...>::__type&>("Bad Variant index in get")
             : &__variant_accessor<_Index,_Types...>::get(__v)
     );
 }
 
 template<ptrdiff_t _Index,typename ... _Types>
-constexpr typename __indexed_type<_Index,_Types...>::__type&& get(variant<_Types...>&& __v){
+constexpr typename __indexed_type<_Index,_Types...>::__type&& get(Variant<_Types...>&& __v){
     return __variant_accessor<_Index,_Types...>::get(
-        (((_Index!=__v.index()) ? __throw_bad_variant_access<int>("Bad variant index in get") : 0), std::move(__v))
+        (((_Index!=__v.index()) ? __throw_bad_variant_access<int>("Bad Variant index in get") : 0), std::move(__v))
     );
 }
 
 template<ptrdiff_t _Index,typename ... _Types>
-constexpr const typename __indexed_type<_Index,_Types...>::__type&& get(variant<_Types...> const&& __v){
+constexpr const typename __indexed_type<_Index,_Types...>::__type&& get(Variant<_Types...> const&& __v){
     return __variant_accessor<_Index,_Types...>::get(
-        (((_Index!=__v.index()) ? __throw_bad_variant_access<int>("Bad variant index in get") : 0), std::move(__v))
+        (((_Index!=__v.index()) ? __throw_bad_variant_access<int>("Bad Variant index in get") : 0), std::move(__v))
     );
 }
 
 template<typename _Type,typename ... _Types>
-constexpr std::add_pointer_t<_Type> get_if(variant<_Types...>& __v){
+constexpr std::add_pointer_t<_Type> get_if(Variant<_Types...>& __v){
     return (__type_index<_Type,_Types...>::__value!=__v.index())?nullptr:&get<_Type>(__v);
 }
 
 template<typename _Type,typename ... _Types>
-constexpr std::add_pointer_t<_Type const> get_if(variant<_Types...> const& __v){
+constexpr std::add_pointer_t<_Type const> get_if(Variant<_Types...> const& __v){
     return (__type_index<_Type,_Types...>::__value!=__v.index())?nullptr:&get<_Type>(__v);
 }
 
 template<ptrdiff_t _Index,typename ... _Types>
-constexpr std::add_pointer_t<typename __indexed_type<_Index,_Types...>::__type> get_if(variant<_Types...>& __v){
+constexpr std::add_pointer_t<typename __indexed_type<_Index,_Types...>::__type> get_if(Variant<_Types...>& __v){
     return ((_Index!=__v.index())?nullptr:
         &__variant_accessor<_Index,_Types...>::get(__v));
 }
@@ -1834,13 +1833,13 @@
 
 template<ptrdiff_t _Index,typename ... _Types>
 constexpr std::add_pointer_t<typename __indexed_type<_Index,_Types...>::__type const> get_if(
-    variant<_Types...> const& __v){
+    Variant<_Types...> const& __v){
     return ((_Index!=__v.index())?nullptr:
         &__variant_accessor<_Index,_Types...>::get(__v));
 }
 
 template<typename _Type,typename ... _Types>
-constexpr bool holds_alternative(variant<_Types...> const& __v) __NOEXCEPT{
+constexpr bool holds_alternative(Variant<_Types...> const& __v) __NOEXCEPT{
     return __v.index()==__type_index<_Type,_Types...>::__value;
 }
 
@@ -1859,7 +1858,7 @@
 
 template<typename _Visitor,typename ... _Types>
 struct __visitor_table{
-    typedef variant<_Types...> __variant_type;
+    typedef Variant<_Types...> __variant_type;
     typedef typename __visitor_return_type<_Visitor,_Types...>::__type __return_type;
     typedef __return_type (*__func_type)(_Visitor&,__variant_type&);
 
@@ -1878,9 +1877,9 @@
 
 template<typename _Visitor,typename ... _Types>
 constexpr typename __visitor_return_type<_Visitor,_Types...>::__type
-visit(_Visitor&& __visitor,variant<_Types...>& __v){
+visit(_Visitor&& __visitor,Variant<_Types...>& __v){
     return (__v.valueless_by_exception())
-        ? __throw_bad_variant_access<typename __visitor_return_type<_Visitor,_Types...>::__type>("Visiting of empty variant")
+        ? __throw_bad_variant_access<typename __visitor_return_type<_Visitor,_Types...>::__type>("Visiting of empty Variant")
         : __visitor_table<_Visitor,_Types...>::__trampoline[__v.index()](__visitor,__v);
 }
 
@@ -1944,7 +1943,7 @@
     template<typename _Visitor,typename ... _Variants>
     static constexpr typename __multi_visitor_return_type<_Visitor,_Variants...>::__type
     __visit(_Visitor&,_Variants&& ...){
-        return __throw_bad_variant_access<typename __multi_visitor_return_type<_Visitor,_Variants...>::__type>("Visiting of empty variant");
+        return __throw_bad_variant_access<typename __multi_visitor_return_type<_Visitor,_Variants...>::__type>("Visiting of empty Variant");
     }
 };
 
@@ -1952,7 +1951,7 @@
 struct __variant_type_count;
 
 template<typename ... _Types>
-struct __variant_type_count<variant<_Types...>>{
+struct __variant_type_count<Variant<_Types...>>{
     static constexpr size_t __value=sizeof...(_Types);
 };
 
@@ -1989,50 +1988,50 @@
 }
 
 template<typename ... _Types>
-constexpr bool operator==(variant<_Types...> const& __lhs,variant<_Types...> const& __rhs){
+constexpr bool operator==(Variant<_Types...> const& __lhs,Variant<_Types...> const& __rhs){
     return (__lhs.index()==__rhs.index()) &&
         ((__lhs.index()==-1) ||
-         __equality_op_table<variant<_Types...>>::__equality_compare[__lhs.index()](
+         __equality_op_table<Variant<_Types...>>::__equality_compare[__lhs.index()](
              __lhs,__rhs));
 }
 
 template<typename ... _Types>
-constexpr bool operator!=(variant<_Types...> const& __lhs,variant<_Types...> const& __rhs){
+constexpr bool operator!=(Variant<_Types...> const& __lhs,Variant<_Types...> const& __rhs){
     return !(__lhs==__rhs);
 }
 
 template<typename ... _Types>
-constexpr bool operator<(variant<_Types...> const& __lhs,variant<_Types...> const& __rhs){
+constexpr bool operator<(Variant<_Types...> const& __lhs,Variant<_Types...> const& __rhs){
     return (__lhs.index()<__rhs.index()) ||
         ((__lhs.index()==__rhs.index()) &&
          ((__lhs.index()!=-1) &&
-          __less_than_op_table<variant<_Types...>>::
+          __less_than_op_table<Variant<_Types...>>::
           __less_than_compare[__lhs.index()](__lhs,__rhs)));
 }
 
 template<typename ... _Types>
-constexpr bool operator>(variant<_Types...> const& __lhs,variant<_Types...> const& __rhs){
+constexpr bool operator>(Variant<_Types...> const& __lhs,Variant<_Types...> const& __rhs){
     return __rhs<__lhs;
 }
 
 template<typename ... _Types>
-constexpr bool operator>=(variant<_Types...> const& __lhs,variant<_Types...> const& __rhs){
+constexpr bool operator>=(Variant<_Types...> const& __lhs,Variant<_Types...> const& __rhs){
     return !(__lhs<__rhs);
 }
 
 template<typename ... _Types>
-constexpr bool operator<=(variant<_Types...> const& __lhs,variant<_Types...> const& __rhs){
+constexpr bool operator<=(Variant<_Types...> const& __lhs,Variant<_Types...> const& __rhs){
     return !(__lhs>__rhs);
 }
 
-struct monostate{};
+struct Monostate{};
 
-constexpr inline bool operator==(monostate const&,monostate const&){ return true;}
-constexpr inline bool operator!=(monostate const&,monostate const&){ return false;}
-constexpr inline bool operator>=(monostate const&,monostate const&){ return true;}
-constexpr inline bool operator<=(monostate const&,monostate const&){ return true;}
-constexpr inline bool operator>(monostate const&,monostate const&){ return false;}
-constexpr inline bool operator<(monostate const&,monostate const&){ return false;}
+constexpr inline bool operator==(Monostate const&,Monostate const&){ return true;}
+constexpr inline bool operator!=(Monostate const&,Monostate const&){ return false;}
+constexpr inline bool operator>=(Monostate const&,Monostate const&){ return true;}
+constexpr inline bool operator<=(Monostate const&,Monostate const&){ return true;}
+constexpr inline bool operator>(Monostate const&,Monostate const&){ return false;}
+constexpr inline bool operator<(Monostate const&,Monostate const&){ return false;}
 
 struct __hash_visitor{
     template<typename _Type>
@@ -2041,25 +2040,29 @@
     }
 };
 
-} // namespace experimental
+} // namespace WTF
 
+namespace std {
+
 template<>
-struct hash<experimental::monostate>{
-    size_t operator()(experimental::monostate) __NOEXCEPT{
+struct hash<WTF::Monostate>{
+    size_t operator()(WTF::Monostate) __NOEXCEPT{
         return 42;
     }
 };
 
 template<typename ... _Types>
-struct hash<experimental::variant<_Types...>>{
-    size_t operator()(experimental::variant<_Types...> const &v) __NOEXCEPT {
-        return std::hash<ptrdiff_t>()(v.index()) ^
-               experimental::visit(experimental::__hash_visitor(), v);
+struct hash<WTF::Variant<_Types...>>{
+    size_t operator()(WTF::Variant<_Types...> const &v) __NOEXCEPT {
+        return std::hash<ptrdiff_t>()(v.index()) ^ WTF::visit(WTF::__hash_visitor(), v);
     }
 };
 
 } // namespace std
 
+using WTF::Monostate;
+using WTF::Variant;
+
 #endif // !COMPILER(CLANG) || WTF_CPP_STD_VER >= 14
 
 #if COMPILER(MSVC)

Modified: trunk/Source/WebCore/ChangeLog (207516 => 207517)


--- trunk/Source/WebCore/ChangeLog	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/ChangeLog	2016-10-19 02:43:44 UTC (rev 207517)
@@ -1,3 +1,46 @@
+2016-10-18  Sam Weinig  <s...@webkit.org>
+
+        Replace std::experimental::variant with WTF::Variant (or similar)
+        https://bugs.webkit.org/show_bug.cgi?id=163626
+
+        Reviewed by Chris Dumez.
+
+        Rename std::experimental::variant, Variant. Move helpers get/holds_alternative/etc.
+        into the WTF namespace.
+
+        * Modules/fetch/FetchBody.h:
+        (WebCore::FetchBody::isBlob):
+        (WebCore::FetchBody::isFormData):
+        (WebCore::FetchBody::isArrayBuffer):
+        (WebCore::FetchBody::isArrayBufferView):
+        (WebCore::FetchBody::isURLSearchParams):
+        (WebCore::FetchBody::isText):
+        (WebCore::FetchBody::blobBody):
+        (WebCore::FetchBody::formDataBody):
+        (WebCore::FetchBody::arrayBufferBody):
+        (WebCore::FetchBody::arrayBufferViewBody):
+        (WebCore::FetchBody::textBody):
+        (WebCore::FetchBody::urlSearchParamsBody):
+        * bindings/generic/IDLTypes.h:
+        * dom/ExceptionOr.h:
+        (WebCore::ExceptionOr<ReturnType>::hasException):
+        (WebCore::ExceptionOr<ReturnType>::releaseException):
+        (WebCore::ExceptionOr<ReturnType>::releaseReturnValue):
+        * dom/MessageEvent.cpp:
+        (WebCore::MessageEvent::source):
+        * dom/MessageEvent.h:
+        * dom/Node.cpp:
+        (WebCore::nodeSetPreTransformedFromNodeOrStringVector):
+        (WebCore::Node::convertNodesOrStringsIntoNode):
+        * dom/Node.h:
+        * html/HTMLOptionsCollection.h:
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::add):
+        * html/HTMLSelectElement.h:
+        * html/track/TrackEvent.cpp:
+        (WebCore::TrackEvent::TrackEvent):
+        * html/track/TrackEvent.h:
+
 2016-10-18  Chris Dumez  <cdu...@apple.com>
 
         Unreviewed, rebaseline bindings tests after Sam's r207505.

Modified: trunk/Source/WebCore/Modules/fetch/FetchBody.h (207516 => 207517)


--- trunk/Source/WebCore/Modules/fetch/FetchBody.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/Modules/fetch/FetchBody.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -65,12 +65,12 @@
     void consumeAsStream(FetchBodyOwner&, FetchResponseSource&);
 #endif
 
-    bool isBlob() const { return std::experimental::holds_alternative<Ref<const Blob>>(m_data); }
-    bool isFormData() const { return std::experimental::holds_alternative<Ref<FormData>>(m_data); }
-    bool isArrayBuffer() const { return std::experimental::holds_alternative<Ref<const ArrayBuffer>>(m_data); }
-    bool isArrayBufferView() const { return std::experimental::holds_alternative<Ref<const ArrayBufferView>>(m_data); }
-    bool isURLSearchParams() const { return std::experimental::holds_alternative<Ref<const URLSearchParams>>(m_data); }
-    bool isText() const { return std::experimental::holds_alternative<String>(m_data); }
+    bool isBlob() const { return WTF::holds_alternative<Ref<const Blob>>(m_data); }
+    bool isFormData() const { return WTF::holds_alternative<Ref<FormData>>(m_data); }
+    bool isArrayBuffer() const { return WTF::holds_alternative<Ref<const ArrayBuffer>>(m_data); }
+    bool isArrayBufferView() const { return WTF::holds_alternative<Ref<const ArrayBufferView>>(m_data); }
+    bool isURLSearchParams() const { return WTF::holds_alternative<Ref<const URLSearchParams>>(m_data); }
+    bool isText() const { return WTF::holds_alternative<String>(m_data); }
 
     static Optional<FetchBody> extract(ScriptExecutionContext&, JSC::ExecState&, JSC::JSValue, String&);
     static FetchBody loadingBody() { return { }; }
@@ -104,16 +104,16 @@
     void consumeText(Ref<DeferredPromise>&&, const String&);
     void consumeBlob(FetchBodyOwner&, Ref<DeferredPromise>&&);
 
-    const Blob& blobBody() const { return std::experimental::get<Ref<const Blob>>(m_data).get(); }
-    FormData& formDataBody() { return std::experimental::get<Ref<FormData>>(m_data).get(); }
-    const FormData& formDataBody() const { return std::experimental::get<Ref<FormData>>(m_data).get(); }
-    const ArrayBuffer& arrayBufferBody() const { return std::experimental::get<Ref<const ArrayBuffer>>(m_data).get(); }
-    const ArrayBufferView& arrayBufferViewBody() const { return std::experimental::get<Ref<const ArrayBufferView>>(m_data).get(); }
-    String& textBody() { return std::experimental::get<String>(m_data); }
-    const String& textBody() const { return std::experimental::get<String>(m_data); }
-    const URLSearchParams& urlSearchParamsBody() const { return std::experimental::get<Ref<const URLSearchParams>>(m_data).get(); }
+    const Blob& blobBody() const { return WTF::get<Ref<const Blob>>(m_data).get(); }
+    FormData& formDataBody() { return WTF::get<Ref<FormData>>(m_data).get(); }
+    const FormData& formDataBody() const { return WTF::get<Ref<FormData>>(m_data).get(); }
+    const ArrayBuffer& arrayBufferBody() const { return WTF::get<Ref<const ArrayBuffer>>(m_data).get(); }
+    const ArrayBufferView& arrayBufferViewBody() const { return WTF::get<Ref<const ArrayBufferView>>(m_data).get(); }
+    String& textBody() { return WTF::get<String>(m_data); }
+    const String& textBody() const { return WTF::get<String>(m_data); }
+    const URLSearchParams& urlSearchParamsBody() const { return WTF::get<Ref<const URLSearchParams>>(m_data).get(); }
 
-    std::experimental::variant<std::nullptr_t, Ref<const Blob>, Ref<FormData>, Ref<const ArrayBuffer>, Ref<const ArrayBufferView>, Ref<const URLSearchParams>, String> m_data { nullptr };
+    Variant<std::nullptr_t, Ref<const Blob>, Ref<FormData>, Ref<const ArrayBuffer>, Ref<const ArrayBufferView>, Ref<const URLSearchParams>, String> m_data { nullptr };
 
     FetchBodyConsumer m_consumer { FetchBodyConsumer::Type::None };
     RefPtr<DeferredPromise> m_consumePromise;

Modified: trunk/Source/WebCore/bindings/generic/IDLTypes.h (207516 => 207517)


--- trunk/Source/WebCore/bindings/generic/IDLTypes.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/bindings/generic/IDLTypes.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -115,7 +115,7 @@
 struct IDLDOMException : IDLUnsupportedType { };
 
 template<typename... Ts>
-struct IDLUnion : IDLType<std::experimental::variant<typename Ts::ImplementationType...>> {
+struct IDLUnion : IDLType<Variant<typename Ts::ImplementationType...>> {
     using TypeList = brigand::list<Ts...>;
 };
 

Modified: trunk/Source/WebCore/dom/ExceptionOr.h (207516 => 207517)


--- trunk/Source/WebCore/dom/ExceptionOr.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/dom/ExceptionOr.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -43,7 +43,7 @@
     ReturnType&& releaseReturnValue();
 
 private:
-    std::experimental::variant<Exception, ReturnType> m_value;
+    Variant<Exception, ReturnType> m_value;
 };
 
 template<> class ExceptionOr<void> {
@@ -75,17 +75,17 @@
 
 template<typename ReturnType> inline bool ExceptionOr<ReturnType>::hasException() const
 {
-    return std::experimental::holds_alternative<Exception>(m_value);
+    return WTF::holds_alternative<Exception>(m_value);
 }
 
 template<typename ReturnType> inline Exception&& ExceptionOr<ReturnType>::releaseException()
 {
-    return std::experimental::get<Exception>(WTFMove(m_value));
+    return WTF::get<Exception>(WTFMove(m_value));
 }
 
 template<typename ReturnType> inline ReturnType&& ExceptionOr<ReturnType>::releaseReturnValue()
 {
-    return std::experimental::get<ReturnType>(WTFMove(m_value));
+    return WTF::get<ReturnType>(WTFMove(m_value));
 }
 
 inline ExceptionOr<void>::ExceptionOr(Exception&& exception)

Modified: trunk/Source/WebCore/dom/MessageEvent.cpp (207516 => 207517)


--- trunk/Source/WebCore/dom/MessageEvent.cpp	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/dom/MessageEvent.cpp	2016-10-19 02:43:44 UTC (rev 207517)
@@ -177,7 +177,7 @@
         [](const RefPtr<MessagePort>& messagePort) -> EventTarget* { return const_cast<EventTarget*>(static_cast<const EventTarget*>(messagePort.get())); }
     );
 
-    return std::experimental::visit(visitor, m_source.value());
+    return WTF::visit(visitor, m_source.value());
 }
 
 RefPtr<SerializedScriptValue> MessageEvent::trySerializeData(ExecState* exec)

Modified: trunk/Source/WebCore/dom/MessageEvent.h (207516 => 207517)


--- trunk/Source/WebCore/dom/MessageEvent.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/dom/MessageEvent.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -38,7 +38,7 @@
 
 class Blob;
 
-using MessageEventSource = std::experimental::variant<RefPtr<DOMWindow>, RefPtr<MessagePort>>;
+using MessageEventSource = Variant<RefPtr<DOMWindow>, RefPtr<MessagePort>>;
 
 class MessageEvent final : public Event {
 public:

Modified: trunk/Source/WebCore/dom/Node.cpp (207516 => 207517)


--- trunk/Source/WebCore/dom/Node.cpp	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/dom/Node.cpp	2016-10-19 02:43:44 UTC (rev 207517)
@@ -445,7 +445,7 @@
     );
 
     for (const auto& variant : vector)
-        std::experimental::visit(visitor, variant);
+        WTF::visit(visitor, variant);
 
     return nodeSet;
 }
@@ -482,7 +482,7 @@
     );
 
     for (auto& variant : nodeOrStringVector)
-        std::experimental::visit(visitor, variant);
+        WTF::visit(visitor, variant);
 
     if (nodes.size() == 1)
         return WTFMove(nodes.first());

Modified: trunk/Source/WebCore/dom/Node.h (207516 => 207517)


--- trunk/Source/WebCore/dom/Node.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/dom/Node.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -62,7 +62,7 @@
 class TouchEvent;
 class UIRequestEvent;
 
-using NodeOrString = std::experimental::variant<RefPtr<Node>, String>;
+using NodeOrString = Variant<RefPtr<Node>, String>;
 
 class NodeRareDataBase {
 public:

Modified: trunk/Source/WebCore/html/HTMLOptionsCollection.h (207516 => 207517)


--- trunk/Source/WebCore/html/HTMLOptionsCollection.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/html/HTMLOptionsCollection.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -41,8 +41,8 @@
     HTMLOptionElement* item(unsigned offset) const final;
     HTMLOptionElement* namedItem(const AtomicString& name) const final;
 
-    using OptionOrOptGroupElement = std::experimental::variant<RefPtr<HTMLOptionElement>, RefPtr<HTMLOptGroupElement>>;
-    using HTMLElementOrInt = std::experimental::variant<RefPtr<HTMLElement>, int>;
+    using OptionOrOptGroupElement = Variant<RefPtr<HTMLOptionElement>, RefPtr<HTMLOptGroupElement>>;
+    using HTMLElementOrInt = Variant<RefPtr<HTMLElement>, int>;
     WEBCORE_EXPORT ExceptionOr<void> add(const OptionOrOptGroupElement&, Optional<HTMLElementOrInt> before);
     WEBCORE_EXPORT void remove(int index);
     void remove(HTMLOptionElement&);

Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (207516 => 207517)


--- trunk/Source/WebCore/html/HTMLSelectElement.cpp	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp	2016-10-19 02:43:44 UTC (rev 207517)
@@ -230,9 +230,9 @@
             [this](int index) -> HTMLElement* { return item(index); }
         );
 
-        beforeElement = std::experimental::visit(visitor, before.value());
+        beforeElement = WTF::visit(visitor, before.value());
     }
-    HTMLElement& toInsert = std::experimental::visit([](const auto& htmlElement) -> HTMLElement& {
+    HTMLElement& toInsert = WTF::visit([](const auto& htmlElement) -> HTMLElement& {
         return *htmlElement;
     }, element);
 

Modified: trunk/Source/WebCore/html/HTMLSelectElement.h (207516 => 207517)


--- trunk/Source/WebCore/html/HTMLSelectElement.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/html/HTMLSelectElement.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -51,8 +51,8 @@
 
     bool usesMenuList() const;
 
-    using OptionOrOptGroupElement = std::experimental::variant<RefPtr<HTMLOptionElement>, RefPtr<HTMLOptGroupElement>>;
-    using HTMLElementOrInt = std::experimental::variant<RefPtr<HTMLElement>, int>;
+    using OptionOrOptGroupElement = Variant<RefPtr<HTMLOptionElement>, RefPtr<HTMLOptGroupElement>>;
+    using HTMLElementOrInt = Variant<RefPtr<HTMLElement>, int>;
     WEBCORE_EXPORT ExceptionOr<void> add(const OptionOrOptGroupElement&, Optional<HTMLElementOrInt> before);
 
     using Node::remove;

Modified: trunk/Source/WebCore/html/track/TrackEvent.cpp (207516 => 207517)


--- trunk/Source/WebCore/html/track/TrackEvent.cpp	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/html/track/TrackEvent.cpp	2016-10-19 02:43:44 UTC (rev 207517)
@@ -43,7 +43,7 @@
     : Event(type, initializer, isTrusted)
 {
     if (initializer.track) {
-        m_track = std::experimental::visit([](const auto& trackbase) -> TrackBase* {
+        m_track = WTF::visit([](const auto& trackbase) -> TrackBase* {
             return trackbase.get();
         }, *initializer.track);
     }

Modified: trunk/Source/WebCore/html/track/TrackEvent.h (207516 => 207517)


--- trunk/Source/WebCore/html/track/TrackEvent.h	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebCore/html/track/TrackEvent.h	2016-10-19 02:43:44 UTC (rev 207517)
@@ -44,7 +44,7 @@
         return adoptRef(*new TrackEvent(type, canBubble, cancelable, WTFMove(track)));
     }
 
-    using TrackEventTrack = std::experimental::variant<RefPtr<VideoTrack>, RefPtr<AudioTrack>, RefPtr<TextTrack>>;
+    using TrackEventTrack = Variant<RefPtr<VideoTrack>, RefPtr<AudioTrack>, RefPtr<TextTrack>>;
 
     struct Init : public EventInit {
         Optional<TrackEventTrack> track;

Modified: trunk/Source/WebKit/mac/ChangeLog (207516 => 207517)


--- trunk/Source/WebKit/mac/ChangeLog	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-10-19 02:43:44 UTC (rev 207517)
@@ -1,3 +1,16 @@
+2016-10-18  Sam Weinig  <s...@webkit.org>
+
+        Replace std::experimental::variant with WTF::Variant (or similar)
+        https://bugs.webkit.org/show_bug.cgi?id=163626
+
+        Reviewed by Chris Dumez.
+
+        Rename std::experimental::variant, Variant. Move helpers get/holds_alternative/etc.
+        into the WTF namespace.
+
+        * DOM/DOMHTMLSelectElement.mm:
+        (-[DOMHTMLSelectElement add:before:]):
+
 2016-10-18  Simon Fraser  <simon.fra...@apple.com>
 
         Add a MiniBrowser menu item to apply page scale in WK1 and WK2

Modified: trunk/Source/WebKit/mac/DOM/DOMHTMLSelectElement.mm (207516 => 207517)


--- trunk/Source/WebKit/mac/DOM/DOMHTMLSelectElement.mm	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Source/WebKit/mac/DOM/DOMHTMLSelectElement.mm	2016-10-19 02:43:44 UTC (rev 207517)
@@ -185,7 +185,7 @@
         raiseTypeErrorException();
 
     auto& coreElement = *core(element);
-    std::experimental::variant<RefPtr<WebCore::HTMLOptionElement>, RefPtr<WebCore::HTMLOptGroupElement>> variantElement;
+    Variant<RefPtr<WebCore::HTMLOptionElement>, RefPtr<WebCore::HTMLOptGroupElement>> variantElement;
     if (is<WebCore::HTMLOptionElement>(coreElement))
         variantElement = &downcast<WebCore::HTMLOptionElement>(coreElement);
     else if (is<WebCore::HTMLOptGroupElement>(coreElement))

Modified: trunk/Tools/ChangeLog (207516 => 207517)


--- trunk/Tools/ChangeLog	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Tools/ChangeLog	2016-10-19 02:43:44 UTC (rev 207517)
@@ -1,3 +1,16 @@
+2016-10-18  Sam Weinig  <s...@webkit.org>
+
+        Replace std::experimental::variant with WTF::Variant (or similar)
+        https://bugs.webkit.org/show_bug.cgi?id=163626
+
+        Reviewed by Chris Dumez.
+
+        Rename std::experimental::variant, Variant. Move helpers get/holds_alternative/etc.
+        into the WTF namespace.
+
+        * TestWebKitAPI/Tests/WTF/Variant.cpp:
+        (TestWebKitAPI::TEST):
+
 2016-10-18  Simon Fraser  <simon.fra...@apple.com>
 
         Add a MiniBrowser menu item to apply page scale in WK1 and WK2

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Variant.cpp (207516 => 207517)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/Variant.cpp	2016-10-19 02:33:49 UTC (rev 207516)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Variant.cpp	2016-10-19 02:43:44 UTC (rev 207517)
@@ -37,9 +37,9 @@
 
 TEST(WTF_Variant, Initial)
 {
-    std::experimental::variant<int, double> v1;
+    Variant<int, double> v1;
     EXPECT_TRUE(v1.index() == 0);
-    EXPECT_TRUE(std::experimental::get<int>(v1) == 0);
+    EXPECT_TRUE(WTF::get<int>(v1) == 0);
 
     struct T {
         T() : value(15) { }
@@ -46,28 +46,28 @@
         int value;
     };
 
-    std::experimental::variant<T, int> v2;
+    Variant<T, int> v2;
     EXPECT_TRUE(v2.index() == 0);
-    EXPECT_TRUE(std::experimental::get<T>(v2).value == 15);
+    EXPECT_TRUE(WTF::get<T>(v2).value == 15);
 }
 
 TEST(WTF_Variant, Basic)
 {
-    std::experimental::variant<int, double> variant = 1;
+    Variant<int, double> variant = 1;
     EXPECT_TRUE(variant.index() == 0);
-    EXPECT_TRUE(std::experimental::get<int>(variant) == 1);
-    EXPECT_TRUE(*std::experimental::get_if<int>(variant) == 1);
-    EXPECT_TRUE(std::experimental::get_if<double>(variant) == nullptr);
-    EXPECT_TRUE(std::experimental::holds_alternative<int>(variant));
-    EXPECT_FALSE(std::experimental::holds_alternative<double>(variant));
+    EXPECT_TRUE(WTF::get<int>(variant) == 1);
+    EXPECT_TRUE(*WTF::get_if<int>(variant) == 1);
+    EXPECT_TRUE(WTF::get_if<double>(variant) == nullptr);
+    EXPECT_TRUE(WTF::holds_alternative<int>(variant));
+    EXPECT_FALSE(WTF::holds_alternative<double>(variant));
 
     variant = 1.0;
     EXPECT_TRUE(variant.index() == 1);
-    EXPECT_TRUE(std::experimental::get<double>(variant) == 1);
-    EXPECT_TRUE(*std::experimental::get_if<double>(variant) == 1.0);
-    EXPECT_TRUE(std::experimental::get_if<int>(variant) == nullptr);
-    EXPECT_TRUE(std::experimental::holds_alternative<double>(variant));
-    EXPECT_FALSE(std::experimental::holds_alternative<int>(variant));
+    EXPECT_TRUE(WTF::get<double>(variant) == 1);
+    EXPECT_TRUE(*WTF::get_if<double>(variant) == 1.0);
+    EXPECT_TRUE(WTF::get_if<int>(variant) == nullptr);
+    EXPECT_TRUE(WTF::holds_alternative<double>(variant));
+    EXPECT_FALSE(WTF::holds_alternative<int>(variant));
 }
 
 TEST(WTF_Variant, BasicVisitor)
@@ -94,18 +94,18 @@
 
     Type type = Type::None;
 
-    std::experimental::variant<int, float, String> variant = 8;
-    std::experimental::visit(Visitor(type), variant);
+    Variant<int, float, String> variant = 8;
+    WTF::visit(Visitor(type), variant);
     EXPECT_TRUE(Type::Int == type);
 
 
     variant = 1.0f;
-    std::experimental::visit(Visitor(type), variant);
+    WTF::visit(Visitor(type), variant);
     EXPECT_TRUE(Type::Float == type);
 
 
     variant = "hello";
-    std::experimental::visit(Visitor(type), variant);
+    WTF::visit(Visitor(type), variant);
     EXPECT_TRUE(Type::String == type);
 }
 
@@ -126,18 +126,18 @@
         [&](String) { type = Type::String; }
     );
 
-    std::experimental::variant<int, float, String> variant = 8;
-    std::experimental::visit(visitor, variant);
+    Variant<int, float, String> variant = 8;
+    WTF::visit(visitor, variant);
     EXPECT_TRUE(Type::Int == type);
 
 
     variant = 1.0f;
-    std::experimental::visit(visitor, variant);
+    WTF::visit(visitor, variant);
     EXPECT_TRUE(Type::Float == type);
 
 
     variant = "hello";
-    std::experimental::visit(visitor, variant);
+    WTF::visit(visitor, variant);
     EXPECT_TRUE(Type::String == type);
 }
 
@@ -147,7 +147,7 @@
 
     {
         auto uniquePtr = std::make_unique<ConstructorDestructorCounter>();
-        std::experimental::variant<std::unique_ptr<ConstructorDestructorCounter>, int> v = WTFMove(uniquePtr);
+        Variant<std::unique_ptr<ConstructorDestructorCounter>, int> v = WTFMove(uniquePtr);
 
         EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
         EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
@@ -162,7 +162,7 @@
     {
         RefLogger a("a");
         RefPtr<RefLogger> ref(&a);
-        std::experimental::variant<RefPtr<RefLogger>, int> v = ref;
+        Variant<RefPtr<RefLogger>, int> v = ref;
     }
 
     ASSERT_STREQ("ref(a) ref(a) deref(a) deref(a) ", takeLogStr().c_str());
@@ -170,7 +170,7 @@
     {
         RefLogger a("a");
         RefPtr<RefLogger> ref(&a);
-        std::experimental::variant<RefPtr<RefLogger>, int> v = WTFMove(ref);
+        Variant<RefPtr<RefLogger>, int> v = WTFMove(ref);
     }
 
     ASSERT_STREQ("ref(a) deref(a) ", takeLogStr().c_str());
@@ -181,7 +181,7 @@
     {
         RefLogger a("a");
         Ref<RefLogger> ref(a);
-        std::experimental::variant<Ref<RefLogger>, int> v = WTFMove(ref);
+        Variant<Ref<RefLogger>, int> v = WTFMove(ref);
     }
 
     ASSERT_STREQ("ref(a) deref(a) ", takeLogStr().c_str());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to