Title: [283906] trunk
Revision
283906
Author
[email protected]
Date
2021-10-11 10:22:53 -0700 (Mon, 11 Oct 2021)

Log Message

Prepare to switch from WTF::Variant to std::variant
https://bugs.webkit.org/show_bug.cgi?id=231239

Patch by Alex Christensen <[email protected]> on 2021-10-11
Reviewed by Chris Dumez.

Source/_javascript_Core:

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileCallDOM):
* parser/Lexer.cpp:
(JSC::Lexer<T>::parseHex):
(JSC::Lexer<T>::parseBinary):
(JSC::Lexer<T>::parseOctal):
(JSC::Lexer<T>::parseDecimal):
* runtime/CachePayload.cpp:
(JSC::CachePayload::data const):
(JSC::CachePayload::size const):
* runtime/CacheUpdate.cpp:
(JSC::CacheUpdate::CacheUpdate):

Source/WebCore:

* Modules/cache/DOMCacheEngine.cpp:
(WebCore::DOMCacheEngine::isolatedResponseBody):
(WebCore::DOMCacheEngine::copyResponseBody):
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::loadingException const):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::sourceObjectStoreIdentifier const):
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::showMediaControlsContextMenu):
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::addIceCandidate):
* Modules/mediastream/RTCRtpTransform.cpp:
(WebCore::RTCRtpTransform::isAttached const):
(WebCore::operator==):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::LibWebRTCRtpSenderBackend::videoSource):
(WebCore::LibWebRTCRtpSenderBackend::hasSource const):
(WebCore::operator==): Deleted.
* Modules/webxr/WebXRFrame.cpp:
(WebCore::WebXRFrame::getViewerPose):
* Modules/webxr/WebXRWebGLLayer.cpp:
(WebCore::WebXRWebGLLayer::canvas const):
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::intPointAttributeValue const):
(WebCore::AXIsolatedObject::objectAttributeValue const):
(WebCore::AXIsolatedObject::rectAttributeValue const):
(WebCore::AXIsolatedObject::vectorAttributeValue const):
(WebCore::AXIsolatedObject::optionSetAttributeValue const):
(WebCore::AXIsolatedObject::pairAttributeValue const):
(WebCore::AXIsolatedObject::uint64AttributeValue const):
(WebCore::AXIsolatedObject::urlAttributeValue const):
(WebCore::AXIsolatedObject::pathAttributeValue const):
(WebCore::AXIsolatedObject::colorAttributeValue const):
(WebCore::AXIsolatedObject::floatAttributeValue const):
(WebCore::AXIsolatedObject::doubleAttributeValue const):
(WebCore::AXIsolatedObject::unsignedAttributeValue const):
* bindings/IDLTypes.h:
* bindings/js/JSDOMConvertWebGL.cpp:
(WebCore::convertToJSValue):
* bindings/js/JSPaymentMethodChangeEventCustom.cpp:
(WebCore::JSPaymentMethodChangeEvent::methodDetails const):
* bindings/js/JSValueInWrappedObject.h:
(WebCore::JSValueInWrappedObject::operator JSC::JSValue const):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontWeight):
* dom/MessageEvent.cpp:
(WebCore::MessageEvent::memoryCost const):
* editing/Editor.cpp:
(WebCore::Editor::advanceToNextMisspelling):
* editing/TextManipulationController.cpp:
(WebCore::TextManipulationController::ExclusionRule::match const):
* html/URLSearchParams.cpp:
(WebCore::URLSearchParams::create):
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::canvasContext const):
(WebCore::InspectorCanvas::canvasElement const):
(WebCore::InspectorCanvas::scriptExecutionContext const):
(WebCore::InspectorCanvas::buildObjectForCanvas):
(WebCore::InspectorCanvas::indexForData):
* inspector/InspectorShaderProgram.cpp:
(WebCore::InspectorShaderProgram::program const):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::DataSegment::data const):
(WebCore::SharedBuffer::DataSegment::size const):
* platform/cf/SharedBufferCF.cpp:
(WebCore::SharedBuffer::createCFData const):
(WebCore::SharedBuffer::hintMemoryNotNeededSoon const):
* platform/generic/KeyedDecoderGeneric.cpp:
(WebCore::KeyedDecoderGeneric::Dictionary::add):
(WebCore::KeyedDecoderGeneric::getPointerFromDictionaryStack):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfTrack):
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
(WebCore::TextureMapperPlatformLayerBuffer::clone):
* platform/mock/MockMediaDevice.h:
(WebCore::MockMediaDevice::encode const):
* platform/network/FormData.cpp:
(WebCore::FormData::imageOrMediaFilesCount const):
(WebCore::FormDataElement::lengthInBytes const):
(WebCore::FormDataElement::isolatedCopy const):
(WebCore::FormData::appendData):
(WebCore::FormData::flatten const):
(WebCore::FormData::prepareForUpload):
(WebCore::FormData::asBlobURL const):
* platform/network/cf/FormDataStreamCFNet.cpp:
(WebCore::advanceCurrentStream):
(WebCore::setHTTPBody):
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlHandle::enableSSLForHost):
* platform/network/curl/CurlFormDataStream.cpp:
(WebCore::CurlFormDataStream::read):
* platform/network/curl/CurlSSLVerifier.cpp:
(WebCore::CurlSSLVerifier::CurlSSLVerifier):
* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::updateSoupMessageBody const):
* style/StyleResolveForFontRaw.cpp:
(WebCore::Style::resolveForFontRaw):

Source/WebKit:

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
* Platform/IPC/FormDataReference.h:
(IPC::FormDataReference::encode const):
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
(WebKit::MediaSampleCursor::locateIterator const):
* UIProcess/API/APIWebAuthenticationPanel.h:
* UIProcess/Automation/SimulatedInputDispatcher.h:
* UIProcess/Cocoa/WKSafeBrowsingWarning.h:

Source/WTF:

This is the pieces of bug 231086 that can be done without changing behavior.

1. It makes WTF::get_if look more like std::get_if by taking a pointer to a variant instead of a reference.
2. std::visit is pickier than WTF::visit.  The former allows taking lambdas with different return types as long
as the return types can be converted to the overall desired return type.  std::visit has a static_assert that the
return types of all the lambdas are all exactly the same type, so I explicitly declare the return type of many lambdas.
3. It also resolves some types that will become ambiguous by using WTF::in_place,
which will become wrapped by std::in_place_type then removed.
4. It adds a few explicit WTF:: and #include <wtf/Variant.h> that will be needed after removing Variant from Forward.h.
5. It removes the fast malloc check in the one place a Variant is dynamically allocated in KeyedDecoderGeneric.cpp
(which is for non-cocoa platforms) because std::variant isn't fast allocated.

* wtf/LikelyDenseUnsignedIntegerSet.h:
(WTF::LikelyDenseUnsignedIntegerSet::iterator::operator* const):
* wtf/Variant.h:
(WTF::get_if):

Tools:

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (283905 => 283906)


--- trunk/Source/_javascript_Core/ChangeLog	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-10-11 17:22:53 UTC (rev 283906)
@@ -1,3 +1,23 @@
+2021-10-11  Alex Christensen  <[email protected]>
+
+        Prepare to switch from WTF::Variant to std::variant
+        https://bugs.webkit.org/show_bug.cgi?id=231239
+
+        Reviewed by Chris Dumez.
+
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileCallDOM):
+        * parser/Lexer.cpp:
+        (JSC::Lexer<T>::parseHex):
+        (JSC::Lexer<T>::parseBinary):
+        (JSC::Lexer<T>::parseOctal):
+        (JSC::Lexer<T>::parseDecimal):
+        * runtime/CachePayload.cpp:
+        (JSC::CachePayload::data const):
+        (JSC::CachePayload::size const):
+        * runtime/CacheUpdate.cpp:
+        (JSC::CacheUpdate::CacheUpdate):
+
 2021-10-11  Keith Miller  <[email protected]>
 
         SourceID should have a type name and only be 32-bits

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (283905 => 283906)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -10548,13 +10548,14 @@
 
     // FIXME: We should have a way to call functions with the vector of registers.
     // https://bugs.webkit.org/show_bug.cgi?id=163099
-    Vector<Variant<SpeculateCellOperand, SpeculateInt32Operand, SpeculateBooleanOperand>, JSC_DOMJIT_SIGNATURE_MAX_ARGUMENTS_INCLUDING_THIS> operands;
+    using OperandVariant = Variant<SpeculateCellOperand, SpeculateInt32Operand, SpeculateBooleanOperand>;
+    Vector<OperandVariant, JSC_DOMJIT_SIGNATURE_MAX_ARGUMENTS_INCLUDING_THIS> operands;
     Vector<GPRReg, JSC_DOMJIT_SIGNATURE_MAX_ARGUMENTS_INCLUDING_THIS> regs;
 
     auto appendCell = [&](Edge& edge) {
         SpeculateCellOperand operand(this, edge);
         regs.append(operand.gpr());
-        operands.append(WTFMove(operand));
+        operands.append(OperandVariant(WTF::in_place<SpeculateCellOperand>, WTFMove(operand)));
     };
 
     auto appendString = [&](Edge& edge) {
@@ -10562,19 +10563,19 @@
         GPRReg gpr = operand.gpr();
         regs.append(gpr);
         speculateString(edge, gpr);
-        operands.append(WTFMove(operand));
+        operands.append(OperandVariant(WTF::in_place<SpeculateCellOperand>, WTFMove(operand)));
     };
 
     auto appendInt32 = [&](Edge& edge) {
         SpeculateInt32Operand operand(this, edge);
         regs.append(operand.gpr());
-        operands.append(WTFMove(operand));
+        operands.append(OperandVariant(WTF::in_place<SpeculateInt32Operand>, WTFMove(operand)));
     };
 
     auto appendBoolean = [&](Edge& edge) {
         SpeculateBooleanOperand operand(this, edge);
         regs.append(operand.gpr());
-        operands.append(WTFMove(operand));
+        operands.append(OperandVariant(WTF::in_place<SpeculateBooleanOperand>, WTFMove(operand)));
     };
 
     unsigned index = 0;

Modified: trunk/Source/_javascript_Core/parser/Lexer.cpp (283905 => 283906)


--- trunk/Source/_javascript_Core/parser/Lexer.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/_javascript_Core/parser/Lexer.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -1550,7 +1550,7 @@
     } while (isASCIIHexDigitOrSeparator(m_current) && maximumDigits >= 0);
 
     if (LIKELY(maximumDigits >= 0 && m_current != 'n'))
-        return NumberParseResult { hexValue };
+        return NumberParseResult { static_cast<double>(hexValue) };
 
     // No more place in the hexValue buffer.
     // The values are shifted out and placed into the m_buffer8 vector.
@@ -1609,7 +1609,7 @@
     } while (isASCIIBinaryDigitOrSeparator(m_current) && digit >= 0);
 
     if (LIKELY(!isASCIIDigitOrSeparator(m_current) && digit >= 0 && m_current != 'n'))
-        return NumberParseResult { binaryValue };
+        return NumberParseResult { static_cast<double>(binaryValue) };
 
     for (int i = maximumDigits - 1; i > digit; --i)
         record8(digits[i]);
@@ -1665,7 +1665,7 @@
     } while (isASCIIOctalDigitOrSeparator(m_current) && digit >= 0);
 
     if (LIKELY(!isASCIIDigitOrSeparator(m_current) && digit >= 0 && m_current != 'n'))
-        return NumberParseResult { octalValue };
+        return NumberParseResult { static_cast<double>(octalValue) };
 
     for (int i = maximumDigits - 1; i > digit; --i)
          record8(digits[i]);
@@ -1724,7 +1724,7 @@
         } while (isASCIIDigitOrSeparator(m_current) && digit >= 0);
 
         if (digit >= 0 && m_current != '.' && !isASCIIAlphaCaselessEqual(m_current, 'e') && m_current != 'n')
-            return NumberParseResult { decimalValue };
+            return NumberParseResult { static_cast<double>(decimalValue) };
 
         for (int i = maximumDigits - 1; i > digit; --i)
             record8(digits[i]);

Modified: trunk/Source/_javascript_Core/runtime/CachePayload.cpp (283905 => 283906)


--- trunk/Source/_javascript_Core/runtime/CachePayload.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/_javascript_Core/runtime/CachePayload.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -61,21 +61,21 @@
     return WTF::switchOn(m_data,
         [](const FileSystem::MappedFileData& data) {
             return static_cast<const uint8_t*>(data.data());
-        },
-        [](const std::pair<MallocPtr<uint8_t, VMMalloc>, size_t>& data) {
+        }, [](const std::pair<MallocPtr<uint8_t, VMMalloc>, size_t>& data) -> const uint8_t* {
             return data.first.get();
-        });
+        }
+    );
 }
 
 size_t CachePayload::size() const
 {
     return WTF::switchOn(m_data,
-        [](const FileSystem::MappedFileData& data) {
+        [](const FileSystem::MappedFileData& data) -> size_t {
             return data.size();
-        },
-        [](const std::pair<MallocPtr<uint8_t, VMMalloc>, size_t>& data) {
+        }, [](const std::pair<MallocPtr<uint8_t, VMMalloc>, size_t>& data) -> size_t {
             return data.second;
-        });
+        }
+    );
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/CacheUpdate.cpp (283905 => 283906)


--- trunk/Source/_javascript_Core/runtime/CacheUpdate.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/_javascript_Core/runtime/CacheUpdate.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -38,13 +38,7 @@
 {
 }
 
-CacheUpdate::CacheUpdate(CacheUpdate&& other)
-{
-    if (WTF::holds_alternative<GlobalUpdate>(other.m_update))
-        new (this) CacheUpdate(WTFMove(WTF::get<GlobalUpdate>(other.m_update)));
-    else
-        new (this) CacheUpdate(WTFMove(WTF::get<FunctionUpdate>(other.m_update)));
-}
+CacheUpdate::CacheUpdate(CacheUpdate&&) = default;
 
 CacheUpdate& CacheUpdate::operator=(CacheUpdate&& other)
 {

Modified: trunk/Source/WTF/ChangeLog (283905 => 283906)


--- trunk/Source/WTF/ChangeLog	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WTF/ChangeLog	2021-10-11 17:22:53 UTC (rev 283906)
@@ -1,3 +1,27 @@
+2021-10-11  Alex Christensen  <[email protected]>
+
+        Prepare to switch from WTF::Variant to std::variant
+        https://bugs.webkit.org/show_bug.cgi?id=231239
+
+        Reviewed by Chris Dumez.
+
+        This is the pieces of bug 231086 that can be done without changing behavior.
+
+        1. It makes WTF::get_if look more like std::get_if by taking a pointer to a variant instead of a reference.
+        2. std::visit is pickier than WTF::visit.  The former allows taking lambdas with different return types as long
+        as the return types can be converted to the overall desired return type.  std::visit has a static_assert that the
+        return types of all the lambdas are all exactly the same type, so I explicitly declare the return type of many lambdas.
+        3. It also resolves some types that will become ambiguous by using WTF::in_place,
+        which will become wrapped by std::in_place_type then removed.
+        4. It adds a few explicit WTF:: and #include <wtf/Variant.h> that will be needed after removing Variant from Forward.h.
+        5. It removes the fast malloc check in the one place a Variant is dynamically allocated in KeyedDecoderGeneric.cpp
+        (which is for non-cocoa platforms) because std::variant isn't fast allocated.
+
+        * wtf/LikelyDenseUnsignedIntegerSet.h:
+        (WTF::LikelyDenseUnsignedIntegerSet::iterator::operator* const):
+        * wtf/Variant.h:
+        (WTF::get_if):
+
 2021-10-08  Tim Horton  <[email protected]>
 
         defaultAlternateFormControlDesignEnabled() can't read UIUserInterfaceIdiom in the Web Content process

Modified: trunk/Source/WTF/wtf/LikelyDenseUnsignedIntegerSet.h (283905 => 283906)


--- trunk/Source/WTF/wtf/LikelyDenseUnsignedIntegerSet.h	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WTF/wtf/LikelyDenseUnsignedIntegerSet.h	2021-10-11 17:22:53 UTC (rev 283906)
@@ -205,8 +205,8 @@
         IndexType operator*() const
         {
             return WTF::switchOn(m_underlying,
-                [&](const BitVector::iterator& it) { return *it + m_shift; },
-                [](const typename Set::iterator& it) { return *it; });
+                [&](const BitVector::iterator& it) -> IndexType { return *it + m_shift; },
+                [](const typename Set::iterator& it) -> IndexType { return *it; });
         }
 
         bool operator==(const iterator& other) const

Modified: trunk/Source/WTF/wtf/Variant.h (283905 => 283906)


--- trunk/Source/WTF/wtf/Variant.h	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WTF/wtf/Variant.h	2021-10-11 17:22:53 UTC (rev 283906)
@@ -238,17 +238,17 @@
 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;
@@ -1822,26 +1822,26 @@
 }
 
 template<typename _Type,typename ... _Types>
-constexpr std::add_pointer_t<_Type> get_if(Variant<_Types...>& __v){
-    return (__type_index<_Type,_Types...>::__value!=__v.index())?nullptr:std::addressof(get<_Type>(__v));
+constexpr std::add_pointer_t<_Type> get_if(Variant<_Types...>* __v) {
+    return (__type_index<_Type, _Types...>::__value != __v->index()) ? nullptr : std::addressof(get<_Type>(*__v));
 }
 
 template<typename _Type,typename ... _Types>
-constexpr std::add_pointer_t<_Type const> get_if(Variant<_Types...> const& __v){
-    return (__type_index<_Type,_Types...>::__value!=__v.index())?nullptr:std::addressof(get<_Type>(__v));
+constexpr std::add_pointer_t<_Type const> get_if(Variant<_Types...> const* __v) {
+    return (__type_index<_Type, _Types...>::__value != __v->index()) ? nullptr : std::addressof(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){
-    return ((_Index!=__v.index())?nullptr:
-        std::addressof(__variant_accessor<_Index,_Types...>::get(__v)));
+constexpr std::add_pointer_t<typename __indexed_type<_Index, _Types...>::__type> get_if(Variant<_Types...>* __v) {
+    return ((_Index != __v->index()) ? nullptr :
+        std::addressof(__variant_accessor<_Index, _Types...>::get(*__v)));
 }
 
 template<ptrdiff_t _Index,typename ... _Types>
-constexpr std::add_pointer_t<typename __indexed_type<_Index,_Types...>::__type const> get_if(
-    Variant<_Types...> const& __v){
-    return ((_Index!=__v.index())?nullptr:
-        std::addressof(__variant_accessor<_Index,_Types...>::get(__v)));
+constexpr std::add_pointer_t<typename __indexed_type<_Index, _Types...>::__type const> get_if(
+    Variant<_Types...> const* __v) {
+    return ((_Index != __v->index()) ? nullptr :
+        std::addressof(__variant_accessor<_Index, _Types...>::get(*__v)));
 }
 
 template<typename _Type,typename ... _Types>

Modified: trunk/Source/WebCore/ChangeLog (283905 => 283906)


--- trunk/Source/WebCore/ChangeLog	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/ChangeLog	2021-10-11 17:22:53 UTC (rev 283906)
@@ -1,3 +1,108 @@
+2021-10-11  Alex Christensen  <[email protected]>
+
+        Prepare to switch from WTF::Variant to std::variant
+        https://bugs.webkit.org/show_bug.cgi?id=231239
+
+        Reviewed by Chris Dumez.
+
+        * Modules/cache/DOMCacheEngine.cpp:
+        (WebCore::DOMCacheEngine::isolatedResponseBody):
+        (WebCore::DOMCacheEngine::copyResponseBody):
+        * Modules/fetch/FetchBodyOwner.cpp:
+        (WebCore::FetchBodyOwner::loadingException const):
+        * Modules/indexeddb/IDBRequest.cpp:
+        (WebCore::IDBRequest::sourceObjectStoreIdentifier const):
+        * Modules/mediacontrols/MediaControlsHost.cpp:
+        (WebCore::MediaControlsHost::showMediaControlsContextMenu):
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::addIceCandidate):
+        * Modules/mediastream/RTCRtpTransform.cpp:
+        (WebCore::RTCRtpTransform::isAttached const):
+        (WebCore::operator==):
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+        (WebCore::LibWebRTCRtpSenderBackend::videoSource):
+        (WebCore::LibWebRTCRtpSenderBackend::hasSource const):
+        (WebCore::operator==): Deleted.
+        * Modules/webxr/WebXRFrame.cpp:
+        (WebCore::WebXRFrame::getViewerPose):
+        * Modules/webxr/WebXRWebGLLayer.cpp:
+        (WebCore::WebXRWebGLLayer::canvas const):
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::intPointAttributeValue const):
+        (WebCore::AXIsolatedObject::objectAttributeValue const):
+        (WebCore::AXIsolatedObject::rectAttributeValue const):
+        (WebCore::AXIsolatedObject::vectorAttributeValue const):
+        (WebCore::AXIsolatedObject::optionSetAttributeValue const):
+        (WebCore::AXIsolatedObject::pairAttributeValue const):
+        (WebCore::AXIsolatedObject::uint64AttributeValue const):
+        (WebCore::AXIsolatedObject::urlAttributeValue const):
+        (WebCore::AXIsolatedObject::pathAttributeValue const):
+        (WebCore::AXIsolatedObject::colorAttributeValue const):
+        (WebCore::AXIsolatedObject::floatAttributeValue const):
+        (WebCore::AXIsolatedObject::doubleAttributeValue const):
+        (WebCore::AXIsolatedObject::unsignedAttributeValue const):
+        * bindings/IDLTypes.h:
+        * bindings/js/JSDOMConvertWebGL.cpp:
+        (WebCore::convertToJSValue):
+        * bindings/js/JSPaymentMethodChangeEventCustom.cpp:
+        (WebCore::JSPaymentMethodChangeEvent::methodDetails const):
+        * bindings/js/JSValueInWrappedObject.h:
+        (WebCore::JSValueInWrappedObject::operator JSC::JSValue const):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeFontWeight):
+        * dom/MessageEvent.cpp:
+        (WebCore::MessageEvent::memoryCost const):
+        * editing/Editor.cpp:
+        (WebCore::Editor::advanceToNextMisspelling):
+        * editing/TextManipulationController.cpp:
+        (WebCore::TextManipulationController::ExclusionRule::match const):
+        * html/URLSearchParams.cpp:
+        (WebCore::URLSearchParams::create):
+        * inspector/InspectorCanvas.cpp:
+        (WebCore::InspectorCanvas::canvasContext const):
+        (WebCore::InspectorCanvas::canvasElement const):
+        (WebCore::InspectorCanvas::scriptExecutionContext const):
+        (WebCore::InspectorCanvas::buildObjectForCanvas):
+        (WebCore::InspectorCanvas::indexForData):
+        * inspector/InspectorShaderProgram.cpp:
+        (WebCore::InspectorShaderProgram::program const):
+        * platform/SharedBuffer.cpp:
+        (WebCore::SharedBuffer::DataSegment::data const):
+        (WebCore::SharedBuffer::DataSegment::size const):
+        * platform/cf/SharedBufferCF.cpp:
+        (WebCore::SharedBuffer::createCFData const):
+        (WebCore::SharedBuffer::hintMemoryNotNeededSoon const):
+        * platform/generic/KeyedDecoderGeneric.cpp:
+        (WebCore::KeyedDecoderGeneric::Dictionary::add):
+        (WebCore::KeyedDecoderGeneric::getPointerFromDictionaryStack):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfTrack):
+        * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
+        (WebCore::TextureMapperPlatformLayerBuffer::clone):
+        * platform/mock/MockMediaDevice.h:
+        (WebCore::MockMediaDevice::encode const):
+        * platform/network/FormData.cpp:
+        (WebCore::FormData::imageOrMediaFilesCount const):
+        (WebCore::FormDataElement::lengthInBytes const):
+        (WebCore::FormDataElement::isolatedCopy const):
+        (WebCore::FormData::appendData):
+        (WebCore::FormData::flatten const):
+        (WebCore::FormData::prepareForUpload):
+        (WebCore::FormData::asBlobURL const):
+        * platform/network/cf/FormDataStreamCFNet.cpp:
+        (WebCore::advanceCurrentStream):
+        (WebCore::setHTTPBody):
+        * platform/network/curl/CurlContext.cpp:
+        (WebCore::CurlHandle::enableSSLForHost):
+        * platform/network/curl/CurlFormDataStream.cpp:
+        (WebCore::CurlFormDataStream::read):
+        * platform/network/curl/CurlSSLVerifier.cpp:
+        (WebCore::CurlSSLVerifier::CurlSSLVerifier):
+        * platform/network/soup/ResourceRequestSoup.cpp:
+        (WebCore::ResourceRequest::updateSoupMessageBody const):
+        * style/StyleResolveForFontRaw.cpp:
+        (WebCore::Style::resolveForFontRaw):
+
 2021-10-11  Antti Koivisto  <[email protected]>
 
         [LFC][Integration] Use inline box isFirstBox/isLastBox bits in iterator

Modified: trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp (283905 => 283906)


--- trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -129,11 +129,11 @@
 
 ResponseBody isolatedResponseBody(const ResponseBody& body)
 {
-    return WTF::switchOn(body, [](const Ref<FormData>& formData) {
+    return WTF::switchOn(body, [](const Ref<FormData>& formData) -> ResponseBody {
         return formData->isolatedCopy();
-    }, [](const Ref<SharedBuffer>& buffer) {
+    }, [](const Ref<SharedBuffer>& buffer) -> ResponseBody {
         return buffer->copy();
-    }, [](const std::nullptr_t&) {
+    }, [](const std::nullptr_t&) -> ResponseBody {
         return DOMCacheEngine::ResponseBody { };
     });
 }
@@ -140,11 +140,11 @@
 
 ResponseBody copyResponseBody(const ResponseBody& body)
 {
-    return WTF::switchOn(body, [](const Ref<FormData>& formData) {
+    return WTF::switchOn(body, [](const Ref<FormData>& formData) -> ResponseBody {
         return formData.copyRef();
-    }, [](const Ref<SharedBuffer>& buffer) {
+    }, [](const Ref<SharedBuffer>& buffer) -> ResponseBody {
         return buffer.copyRef();
-    }, [](const std::nullptr_t&) {
+    }, [](const std::nullptr_t&) -> ResponseBody {
         return DOMCacheEngine::ResponseBody { };
     });
 }

Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp (283905 => 283906)


--- trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -388,9 +388,9 @@
 
 std::optional<Exception> FetchBodyOwner::loadingException() const
 {
-    return WTF::switchOn(m_loadingError, [](const ResourceError& error) {
+    return WTF::switchOn(m_loadingError, [](const ResourceError& error) -> std::optional<Exception> {
         return Exception { TypeError, error.sanitizedDescription() };
-    }, [](const Exception& exception) {
+    }, [](const Exception& exception) -> std::optional<Exception> {
         return Exception { exception };
     }, [](auto&&) -> std::optional<Exception> {
         return std::nullopt;

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (283905 => 283906)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -206,9 +206,9 @@
         return 0;
 
     return WTF::switchOn(m_source.value(),
-        [] (const RefPtr<IDBObjectStore>& objectStore) { return objectStore->info().identifier(); },
-        [] (const RefPtr<IDBIndex>& index) { return index->info().objectStoreIdentifier(); },
-        [] (const RefPtr<IDBCursor>&) { return 0; }
+        [] (const RefPtr<IDBObjectStore>& objectStore) -> uint64_t { return objectStore->info().identifier(); },
+        [] (const RefPtr<IDBIndex>& index) -> uint64_t { return index->info().objectStoreIdentifier(); },
+        [] (const RefPtr<IDBCursor>&) -> uint64_t { return 0; }
     );
 }
 

Modified: trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp (283905 => 283906)


--- trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -681,13 +681,13 @@
 #endif // ENABLE(VIDEO_PRESENTATION_MODE)
             [&] (RefPtr<AudioTrack>& selectedAudioTrack) {
                 for (auto& track : idMap.values()) {
-                    if (auto* audioTrack = WTF::get_if<RefPtr<AudioTrack>>(track))
+                    if (auto* audioTrack = WTF::get_if<RefPtr<AudioTrack>>(&track))
                         (*audioTrack)->setEnabled(*audioTrack == selectedAudioTrack);
                 }
             },
             [&] (RefPtr<TextTrack>& selectedTextTrack) {
                 for (auto& track : idMap.values()) {
-                    if (auto* textTrack = WTF::get_if<RefPtr<TextTrack>>(track))
+                    if (auto* textTrack = WTF::get_if<RefPtr<TextTrack>>(&track))
                         (*textTrack)->setMode(TextTrack::Mode::Disabled);
                 }
                 mediaElement.setSelectedTextTrack(selectedTextTrack.get());

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (283905 => 283906)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -331,7 +331,7 @@
     std::optional<Exception> exception;
     RefPtr<RTCIceCandidate> candidate;
     if (rtcCandidate) {
-        candidate = switchOn(*rtcCandidate, [&exception](RTCIceCandidateInit& init) -> RefPtr<RTCIceCandidate> {
+        candidate = WTF::switchOn(*rtcCandidate, [&exception](RTCIceCandidateInit& init) -> RefPtr<RTCIceCandidate> {
             if (init.candidate.isEmpty())
                 return nullptr;
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpTransform.cpp (283905 => 283906)


--- trunk/Source/WebCore/Modules/mediastream/RTCRtpTransform.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpTransform.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -52,7 +52,7 @@
 
 bool RTCRtpTransform::isAttached() const
 {
-    return switchOn(m_transform, [&](const RefPtr<RTCRtpSFrameTransform>& sframeTransform) {
+    return WTF::switchOn(m_transform, [&](const RefPtr<RTCRtpSFrameTransform>& sframeTransform) {
         return sframeTransform->isAttached();
     }, [&](const RefPtr<RTCRtpScriptTransform>& scriptTransform) {
         return scriptTransform->isAttached();
@@ -131,14 +131,14 @@
 
 bool operator==(const RTCRtpTransform& a, const RTCRtpTransform& b)
 {
-    return switchOn(a.m_transform, [&](const RefPtr<RTCRtpSFrameTransform>& sframeTransformA) {
-        return switchOn(b.m_transform, [&](const RefPtr<RTCRtpSFrameTransform>& sframeTransformB) {
+    return WTF::switchOn(a.m_transform, [&](const RefPtr<RTCRtpSFrameTransform>& sframeTransformA) {
+        return WTF::switchOn(b.m_transform, [&](const RefPtr<RTCRtpSFrameTransform>& sframeTransformB) {
             return sframeTransformA.get() == sframeTransformB.get();
         }, [&](const RefPtr<RTCRtpScriptTransform>&) {
             return false;
         });
     }, [&](const RefPtr<RTCRtpScriptTransform>& scriptTransformA) {
-        return switchOn(b.m_transform, [&](const RefPtr<RTCRtpSFrameTransform>&) {
+        return WTF::switchOn(b.m_transform, [&](const RefPtr<RTCRtpSFrameTransform>&) {
             return false;
         }, [&](const RefPtr<RTCRtpScriptTransform>& scriptTransformB) {
             return scriptTransformA.get() == scriptTransformB.get();

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp (283905 => 283906)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -59,17 +59,6 @@
     stopSource();
 }
 
-static bool operator==(const LibWebRTCRtpSenderBackend::Source& a, const LibWebRTCRtpSenderBackend::Source& b)
-{
-    return switchOn(a, [&b](const Ref<RealtimeOutgoingAudioSource>& source) {
-        return WTF::holds_alternative<Ref<RealtimeOutgoingAudioSource>>(b) && source.ptr() == WTF::get<Ref<RealtimeOutgoingAudioSource>>(b).ptr();
-    }, [&b](const Ref<RealtimeOutgoingVideoSource>& source) {
-        return WTF::holds_alternative<Ref<RealtimeOutgoingVideoSource>>(b) && source.ptr() == WTF::get<Ref<RealtimeOutgoingVideoSource>>(b).ptr();
-    }, [&b](std::nullptr_t) {
-        return WTF::holds_alternative<std::nullptr_t>(b);
-    });
-}
-
 void LibWebRTCRtpSenderBackend::startSource()
 {
     // We asynchronously start the sources to guarantee media goes through the transform if a transform is set when creating the track.
@@ -184,7 +173,7 @@
 
 RealtimeOutgoingVideoSource* LibWebRTCRtpSenderBackend::videoSource()
 {
-    return switchOn(m_source,
+    return WTF::switchOn(m_source,
         [](Ref<RealtimeOutgoingVideoSource>& source) { return source.ptr(); },
         [](const auto&) -> RealtimeOutgoingVideoSource* { return nullptr; }
     );
@@ -192,7 +181,7 @@
 
 bool LibWebRTCRtpSenderBackend::hasSource() const
 {
-    return switchOn(m_source,
+    return WTF::switchOn(m_source,
         [](const std::nullptr_t&) { return false; },
         [](const auto&) { return true; }
     );

Modified: trunk/Source/WebCore/Modules/webxr/WebXRFrame.cpp (283905 => 283906)


--- trunk/Source/WebCore/Modules/webxr/WebXRFrame.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/Modules/webxr/WebXRFrame.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -200,7 +200,7 @@
         auto transform = WebXRRigidTransform::create(pose->transform().rawTransform() * offset);
 
         // Set projection matrix for each view
-        std::array<float, 16> projection = switchOn(frameData.views[index].projection, [&](const PlatformXR::Device::FrameData::Fov& fov) {
+        std::array<float, 16> projection = WTF::switchOn(frameData.views[index].projection, [&](const PlatformXR::Device::FrameData::Fov& fov) {
             double near = m_session->renderState().depthNear();
             double far = m_session->renderState().depthFar();
             return TransformationMatrix::fromProjection(fov.up, fov.down, fov.left, fov.right, near, far).toColumnMajorFloatArray();

Modified: trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp (283905 => 283906)


--- trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -273,7 +273,7 @@
         auto canvas = baseContext->canvas();
         return WTF::switchOn(canvas, [](const RefPtr<HTMLCanvasElement>& canvas) {
             return canvas.get();
-        }, [](const RefPtr<OffscreenCanvas>) {
+        }, [](const RefPtr<OffscreenCanvas>) -> HTMLCanvasElement* {
             ASSERT_NOT_REACHED("baseLayer of a WebXRWebGLLayer must be an HTMLCanvasElement");
             return nullptr;
         });

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (283905 => 283906)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -807,7 +807,7 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (IntPoint& typedValue) { return typedValue; },
+        [] (IntPoint& typedValue) -> IntPoint { return typedValue; },
         [] (auto&) { return IntPoint(); }
     );
 }
@@ -816,7 +816,7 @@
 {
     auto value = m_propertyMap.get(propertyName);
     AXID nodeID = WTF::switchOn(value,
-        [] (AXID& typedValue) { return typedValue; },
+        [] (AXID& typedValue) -> AXID { return typedValue; },
         [] (auto&) { return InvalidAXID; }
     );
 
@@ -828,7 +828,7 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (T& typedValue) { return typedValue; },
+        [] (T& typedValue) -> T { return typedValue; },
         [] (auto&) { return T { }; }
     );
 }
@@ -838,7 +838,7 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (Vector<T>& typedValue) { return typedValue; },
+        [] (Vector<T>& typedValue) -> Vector<T> { return typedValue; },
         [] (auto&) { return Vector<T>(); }
     );
 }
@@ -848,7 +848,7 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (T& typedValue) { return typedValue; },
+        [] (T& typedValue) -> OptionSet<T> { return typedValue; },
         [] (auto&) { return OptionSet<T>(); }
     );
 }
@@ -858,7 +858,7 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (std::pair<T, T>& typedValue) { return typedValue; },
+        [] (std::pair<T, T>& typedValue) -> std::pair<T, T> { return typedValue; },
         [] (auto&) { return std::pair<T, T>(0, 1); }
     );
 }
@@ -867,8 +867,8 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (uint64_t& typedValue) { return typedValue; },
-        [] (auto&) { return 0; }
+        [] (uint64_t& typedValue) -> uint64_t { return typedValue; },
+        [] (auto&) -> uint64_t { return 0; }
     );
 }
 
@@ -876,7 +876,7 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (URL& typedValue) { return typedValue; },
+        [] (URL& typedValue) -> URL { return typedValue; },
         [] (auto&) { return URL(); }
     );
 }
@@ -885,7 +885,7 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (Path& typedValue) { return typedValue; },
+        [] (Path& typedValue) -> Path { return typedValue; },
         [] (auto&) { return Path(); }
     );
 }
@@ -894,7 +894,7 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (Color& typedValue) { return typedValue; },
+        [] (Color& typedValue) -> Color { return typedValue; },
         [] (auto&) { return Color(); }
     );
 }
@@ -903,8 +903,8 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (float& typedValue) { return typedValue; },
-        [] (auto&) { return 0; }
+        [] (float& typedValue) -> float { return typedValue; },
+        [] (auto&) { return 0.0f; }
     );
 }
 
@@ -912,8 +912,8 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (double& typedValue) { return typedValue; },
-        [] (auto&) { return 0; }
+        [] (double& typedValue) -> double { return typedValue; },
+        [] (auto&) { return 0.0; }
     );
 }
 
@@ -921,8 +921,8 @@
 {
     auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
-        [] (unsigned& typedValue) { return typedValue; },
-        [] (auto&) { return 0; }
+        [] (unsigned& typedValue) -> unsigned { return typedValue; },
+        [] (auto&) { return 0u; }
     );
 }
 

Modified: trunk/Source/WebCore/bindings/IDLTypes.h (283905 => 283906)


--- trunk/Source/WebCore/bindings/IDLTypes.h	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/bindings/IDLTypes.h	2021-10-11 17:22:53 UTC (rev 283906)
@@ -31,6 +31,7 @@
 #include <wtf/Brigand.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/URL.h>
+#include <wtf/Variant.h>
 
 #if ENABLE(WEBGL)
 #include "WebGLAny.h"

Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp (283905 => 283906)


--- trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -80,49 +80,39 @@
 JSValue convertToJSValue(JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const WebGLAny& any)
 {
     return WTF::switchOn(any,
-        [] (std::nullptr_t) {
+        [] (std::nullptr_t) -> JSValue {
             return jsNull();
-        },
-        [] (bool value) {
+        }, [] (bool value) -> JSValue {
             return jsBoolean(value);
-        },
-        [] (int value) {
+        }, [] (int value) -> JSValue {
             return jsNumber(value);
-        },
-        [] (unsigned value) {
+        }, [] (unsigned value) -> JSValue {
             return jsNumber(value);
-        },
-        [] (long long value) {
+        }, [] (long long value) -> JSValue {
             return jsNumber(value);
-        },
-        [] (float value) {
+        }, [] (float value) -> JSValue {
             return jsNumber(value);
-        },
-        [&] (const String& value) {
+        }, [&] (const String& value) -> JSValue {
             return jsStringWithCache(lexicalGlobalObject.vm(), value);
-        },
-        [&] (const Vector<bool>& values) {
+        }, [&] (const Vector<bool>& values) -> JSValue {
             MarkedArgumentBuffer list;
             for (auto& value : values)
                 list.append(jsBoolean(value));
             RELEASE_ASSERT(!list.hasOverflowed());
             return constructArray(&globalObject, static_cast<JSC::ArrayAllocationProfile*>(nullptr), list);
-        },
-        [&] (const Vector<int>& values) {
+        }, [&] (const Vector<int>& values) -> JSValue {
             MarkedArgumentBuffer list;
             for (auto& value : values)
                 list.append(jsNumber(value));
             RELEASE_ASSERT(!list.hasOverflowed());
             return constructArray(&globalObject, static_cast<JSC::ArrayAllocationProfile*>(nullptr), list);
-        },
-        [&] (const Vector<unsigned>& values) {
+        }, [&] (const Vector<unsigned>& values) -> JSValue {
             MarkedArgumentBuffer list;
             for (auto& value : values)
                 list.append(jsNumber(value));
             RELEASE_ASSERT(!list.hasOverflowed());
             return constructArray(&globalObject, static_cast<JSC::ArrayAllocationProfile*>(nullptr), list);
-        },
-        [&] (const RefPtr<Float32Array>& array) {
+        }, [&] (const RefPtr<Float32Array>& array) {
             return toJS(&lexicalGlobalObject, &globalObject, array.get());
         },
         [&] (const RefPtr<Int32Array>& array) {

Modified: trunk/Source/WebCore/bindings/js/JSPaymentMethodChangeEventCustom.cpp (283905 => 283906)


--- trunk/Source/WebCore/bindings/js/JSPaymentMethodChangeEventCustom.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/bindings/js/JSPaymentMethodChangeEventCustom.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -33,9 +33,9 @@
 JSC::JSValue JSPaymentMethodChangeEvent::methodDetails(JSC::JSGlobalObject& lexicalGlobalObject) const
 {
     return cachedPropertyValue(lexicalGlobalObject, *this, wrapped().cachedMethodDetails(), [this, &lexicalGlobalObject] {
-        return WTF::switchOn(wrapped().methodDetails(), [](JSC::JSValue methodDetails) {
+        return WTF::switchOn(wrapped().methodDetails(), [](JSC::JSValue methodDetails) -> JSC::JSValue {
             return methodDetails ? methodDetails : JSC::jsNull();
-        }, [&lexicalGlobalObject](const PaymentMethodChangeEvent::MethodDetailsFunction& function) {
+        }, [&lexicalGlobalObject](const PaymentMethodChangeEvent::MethodDetailsFunction& function) -> JSC::JSValue {
             return function(lexicalGlobalObject).get();
         });
     });

Modified: trunk/Source/WebCore/bindings/js/JSValueInWrappedObject.h (283905 => 283906)


--- trunk/Source/WebCore/bindings/js/JSValueInWrappedObject.h	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/bindings/js/JSValueInWrappedObject.h	2021-10-11 17:22:53 UTC (rev 283906)
@@ -82,7 +82,7 @@
 {
     return WTF::switchOn(m_value, [] (JSC::JSValue value) {
         return value;
-    }, [] (const Weak& value) {
+    }, [] (const Weak& value) -> JSC::JSValue {
         return value.get();
     });
 }

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (283905 => 283906)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -918,7 +918,7 @@
 static RefPtr<CSSPrimitiveValue> consumeFontWeight(CSSParserTokenRange& range)
 {
     if (auto result = consumeFontWeightRaw(range)) {
-        return switchOn(*result, [] (CSSValueID valueID) {
+        return WTF::switchOn(*result, [] (CSSValueID valueID) {
             return CSSValuePool::singleton().createIdentifierValue(valueID);
         }, [] (double weightNumber) {
             return CSSValuePool::singleton().createValue(weightNumber, CSSUnitType::CSS_NUMBER);

Modified: trunk/Source/WebCore/dom/MessageEvent.cpp (283905 => 283906)


--- trunk/Source/WebCore/dom/MessageEvent.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/dom/MessageEvent.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -129,15 +129,15 @@
 
 size_t MessageEvent::memoryCost() const
 {
-    return WTF::switchOn(m_data, [] (const JSValueInWrappedObject&) {
+    return WTF::switchOn(m_data, [] (const JSValueInWrappedObject&) -> size_t {
         return 0;
-    }, [] (const Ref<SerializedScriptValue>& data) {
+    }, [] (const Ref<SerializedScriptValue>& data) -> size_t {
         return data->memoryCost();
-    }, [] (const String& string) {
+    }, [] (const String& string) -> size_t {
         return string.sizeInBytes();
-    }, [] (const Ref<Blob>& blob) {
+    }, [] (const Ref<Blob>& blob) -> size_t {
         return blob->size();
-    }, [] (const Ref<ArrayBuffer>& buffer) {
+    }, [] (const Ref<ArrayBuffer>& buffer) -> size_t {
         return buffer->byteLength();
     });
 }

Modified: trunk/Source/WebCore/editing/Editor.cpp (283905 => 283906)


--- trunk/Source/WebCore/editing/Editor.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/editing/Editor.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -2273,7 +2273,7 @@
 
     if (unifiedTextCheckerEnabled()) {
         auto foundItem = TextCheckingHelper(*client(), spellingSearchRange).findFirstMisspelledWordOrUngrammaticalPhrase(isGrammarCheckingEnabled());
-        if (auto word = WTF::get_if<TextCheckingHelper::MisspelledWord>(foundItem))
+        if (auto* word = WTF::get_if<TextCheckingHelper::MisspelledWord>(&foundItem))
             misspelledWord = WTFMove(*word);
         else
             ungrammaticalPhrase = WTF::get<TextCheckingHelper::UngrammaticalPhrase>(WTFMove(foundItem));
@@ -2300,7 +2300,7 @@
         
         if (unifiedTextCheckerEnabled()) {
             auto foundItem = TextCheckingHelper(*client(), spellingSearchRange).findFirstMisspelledWordOrUngrammaticalPhrase(isGrammarCheckingEnabled());
-            if (auto word = WTF::get_if<TextCheckingHelper::MisspelledWord>(foundItem))
+            if (auto* word = WTF::get_if<TextCheckingHelper::MisspelledWord>(&foundItem))
                 misspelledWord = WTFMove(*word);
             else
                 ungrammaticalPhrase = WTF::get<TextCheckingHelper::UngrammaticalPhrase>(WTFMove(foundItem));

Modified: trunk/Source/WebCore/editing/TextManipulationController.cpp (283905 => 283906)


--- trunk/Source/WebCore/editing/TextManipulationController.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/editing/TextManipulationController.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -51,7 +51,7 @@
 
 inline bool TextManipulationController::ExclusionRule::match(const Element& element) const
 {
-    return switchOn(rule, [&element] (ElementRule rule) {
+    return WTF::switchOn(rule, [&element] (ElementRule rule) {
         return rule.localName == element.localName();
     }, [&element] (AttributeRule rule) {
         return equalIgnoringASCIICase(element.getAttribute(rule.name), rule.value);

Modified: trunk/Source/WebCore/html/URLSearchParams.cpp (283905 => 283906)


--- trunk/Source/WebCore/html/URLSearchParams.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/html/URLSearchParams.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -51,9 +51,9 @@
             pairs.append({pair[0], pair[1]});
         }
         return adoptRef(*new URLSearchParams(WTFMove(pairs)));
-    }, [&](const Vector<WTF::KeyValuePair<String, String>>& pairs) {
+    }, [&](const Vector<WTF::KeyValuePair<String, String>>& pairs) -> ExceptionOr<Ref<URLSearchParams>> {
         return adoptRef(*new URLSearchParams(pairs));
-    }, [&](const String& string) {
+    }, [&](const String& string) -> ExceptionOr<Ref<URLSearchParams>> {
         return adoptRef(*new URLSearchParams(string, nullptr));
     });
     return WTF::visit(visitor, variant);

Modified: trunk/Source/WebCore/inspector/InspectorCanvas.cpp (283905 => 283906)


--- trunk/Source/WebCore/inspector/InspectorCanvas.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/inspector/InspectorCanvas.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -111,7 +111,7 @@
 
 CanvasRenderingContext* InspectorCanvas::canvasContext() const
 {
-    if (auto* contextWrapper = WTF::get_if<std::reference_wrapper<CanvasRenderingContext>>(m_context))
+    if (auto* contextWrapper = WTF::get_if<std::reference_wrapper<CanvasRenderingContext>>(&m_context))
         return &contextWrapper->get();
     return nullptr;
 }
@@ -124,8 +124,7 @@
             if (is<HTMLCanvasElement>(context.canvasBase()))
                 return &downcast<HTMLCanvasElement>(context.canvasBase());
             return nullptr;
-        },
-        [] (Monostate) {
+        }, [] (Monostate) -> HTMLCanvasElement* {
             ASSERT_NOT_REACHED();
             return nullptr;
         }
@@ -139,8 +138,7 @@
         [] (std::reference_wrapper<CanvasRenderingContext> contextWrapper) {
             auto& context = contextWrapper.get();
             return context.canvasBase().scriptExecutionContext();
-        },
-        [] (Monostate) {
+        }, [] (Monostate) -> ScriptExecutionContext* {
             ASSERT_NOT_REACHED();
             return nullptr;
         }
@@ -893,8 +891,7 @@
                 return Protocol::Canvas::ContextType::WebGL2;
 #endif
             return std::nullopt;
-        },
-        [] (Monostate) {
+        }, [] (Monostate) -> ContextTypeType {
             ASSERT_NOT_REACHED();
             return std::nullopt;
         }
@@ -920,8 +917,7 @@
     auto contextAttributes = WTF::switchOn(m_context,
         [] (std::reference_wrapper<CanvasRenderingContext> contextWrapper) {
             return buildObjectForCanvasContextAttributes(contextWrapper);
-        },
-        [] (Monostate) {
+        }, [] (Monostate) -> RefPtr<Inspector::Protocol::Canvas::ContextAttributes> {
             ASSERT_NOT_REACHED();
             return nullptr;
         }
@@ -1040,8 +1036,8 @@
         if (data == item)
             return true;
 
-        auto traceA = WTF::get_if<RefPtr<ScriptCallStack>>(data);
-        auto traceB = WTF::get_if<RefPtr<ScriptCallStack>>(item);
+        auto traceA = WTF::get_if<RefPtr<ScriptCallStack>>(&data);
+        auto traceB = WTF::get_if<RefPtr<ScriptCallStack>>(&item);
         if (traceA && *traceA && traceB && *traceB)
             return (*traceA)->isEqual((*traceB).get());
 

Modified: trunk/Source/WebCore/inspector/InspectorShaderProgram.cpp (283905 => 283906)


--- trunk/Source/WebCore/inspector/InspectorShaderProgram.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/inspector/InspectorShaderProgram.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -66,7 +66,7 @@
 #if ENABLE(WEBGL)
 WebGLProgram* InspectorShaderProgram::program() const
 {
-    if (auto* programWrapper = WTF::get_if<std::reference_wrapper<WebGLProgram>>(m_program))
+    if (auto* programWrapper = WTF::get_if<std::reference_wrapper<WebGLProgram>>(&m_program))
         return &programWrapper->get();
     return nullptr;
 }

Modified: trunk/Source/WebCore/platform/SharedBuffer.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/SharedBuffer.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/SharedBuffer.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -342,18 +342,18 @@
 const uint8_t* SharedBuffer::DataSegment::data() const
 {
     auto visitor = WTF::makeVisitor(
-        [](const Vector<uint8_t>& data) { return data.data(); },
+        [](const Vector<uint8_t>& data) -> const uint8_t* { return data.data(); },
 #if USE(CF)
-        [](const RetainPtr<CFDataRef>& data) { return CFDataGetBytePtr(data.get()); },
+        [](const RetainPtr<CFDataRef>& data) -> const uint8_t* { return CFDataGetBytePtr(data.get()); },
 #endif
 #if USE(GLIB)
-        [](const GRefPtr<GBytes>& data) { return static_cast<const uint8_t*>(g_bytes_get_data(data.get(), nullptr)); },
+        [](const GRefPtr<GBytes>& data) -> const uint8_t* { return static_cast<const uint8_t*>(g_bytes_get_data(data.get(), nullptr)); },
 #endif
 #if USE(GSTREAMER)
-        [](const RefPtr<GstMappedOwnedBuffer>& data) { return data->data(); },
+        [](const RefPtr<GstMappedOwnedBuffer>& data) -> const uint8_t* { return data->data(); },
 #endif
-        [](const FileSystem::MappedFileData& data) { return static_cast<const uint8_t*>(data.data()); },
-        [](const Provider& provider) { return provider.data(); }
+        [](const FileSystem::MappedFileData& data) -> const uint8_t* { return static_cast<const uint8_t*>(data.data()); },
+        [](const Provider& provider) -> const uint8_t* { return provider.data(); }
     );
     return WTF::visit(visitor, m_immutableData);
 }
@@ -426,18 +426,18 @@
 size_t SharedBuffer::DataSegment::size() const
 {
     auto visitor = WTF::makeVisitor(
-        [](const Vector<uint8_t>& data) { return data.size(); },
+        [](const Vector<uint8_t>& data) -> size_t { return data.size(); },
 #if USE(CF)
-        [](const RetainPtr<CFDataRef>& data) { return CFDataGetLength(data.get()); },
+        [](const RetainPtr<CFDataRef>& data) -> size_t { return CFDataGetLength(data.get()); },
 #endif
 #if USE(GLIB)
-        [](const GRefPtr<GBytes>& data) { return g_bytes_get_size(data.get()); },
+        [](const GRefPtr<GBytes>& data) -> size_t { return g_bytes_get_size(data.get()); },
 #endif
 #if USE(GSTREAMER)
-        [](const RefPtr<GstMappedOwnedBuffer>& data) { return data->size(); },
+        [](const RefPtr<GstMappedOwnedBuffer>& data) -> size_t { return data->size(); },
 #endif
-        [](const FileSystem::MappedFileData& data) { return data.size(); },
-        [](const Provider& provider) { return provider.size(); }
+        [](const FileSystem::MappedFileData& data) -> size_t { return data.size(); },
+        [](const Provider& provider) -> size_t { return provider.size(); }
     );
     return WTF::visit(visitor, m_immutableData);
 }

Modified: trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -44,7 +44,7 @@
 RetainPtr<CFDataRef> SharedBuffer::createCFData() const
 {
     if (m_segments.size() == 1) {
-        if (auto data = ""
+        if (auto* data = ""
             return *data;
     }
     auto cfData = adoptCF(CFDataCreateMutable(nullptr, size()));
@@ -64,7 +64,7 @@
 {
     for (const auto& entry : m_segments) {
         if (entry.segment->hasOneRef()) {
-            if (auto data = ""
+            if (auto* data = ""
                 OSAllocator::hintMemoryNotNeededSoon(const_cast<UInt8*>(CFDataGetBytePtr(data->get())), CFDataGetLength(data->get()));
         }
     }

Modified: trunk/Source/WebCore/platform/generic/KeyedDecoderGeneric.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/generic/KeyedDecoderGeneric.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/generic/KeyedDecoderGeneric.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -41,7 +41,7 @@
     using Node = Variant<Vector<uint8_t>, bool, uint32_t, uint64_t, int32_t, int64_t, float, double, String, std::unique_ptr<Dictionary>, std::unique_ptr<Array>>;
 
     template <typename T>
-    void add(const String& key, T&& value) { m_map.add(key, makeUnique<Node>(std::forward<T>(value))); }
+    void add(const String& key, T&& value) { m_map.add(key, makeUniqueWithoutFastMallocCheck<Node>(std::forward<T>(value))); }
     Node* get(const String& key) { return m_map.get(key); }
 
 private:
@@ -223,7 +223,7 @@
     if (!node)
         return nullptr;
 
-    return WTF::get_if<T>(*node);
+    return WTF::get_if<T>(node);
 }
 
 template<typename T>

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -1016,7 +1016,7 @@
     default:
         ASSERT_NOT_REACHED();
     }
-    HashMap<AtomString, RefPtr<TrackPrivateType>>& tracks = *get<HashMap<AtomString, RefPtr<TrackPrivateType>>*>(variantTracks);
+    HashMap<AtomString, RefPtr<TrackPrivateType>>& tracks = *WTF::get<HashMap<AtomString, RefPtr<TrackPrivateType>>*>(variantTracks);
 
     // Ignore notifications after a EOS. We don't want the tracks to disappear when the video is finished.
     if (m_isEndReached && (type == TrackType::Audio || type == TrackType::Video))
@@ -1071,16 +1071,16 @@
         ASSERT(streamId == track->id());
         tracks.add(streamId, track.copyRef());
 
-        Variant<AudioTrackPrivate&, VideoTrackPrivate&, InbandTextTrackPrivate&> variantTrack(track.get());
+        Variant<AudioTrackPrivate*, VideoTrackPrivate*, InbandTextTrackPrivate*> variantTrack(&track.get());
         switch (variantTrack.index()) {
         case TrackType::Audio:
-            m_player->addAudioTrack(get<AudioTrackPrivate&>(variantTrack));
+            m_player->addAudioTrack(*WTF::get<AudioTrackPrivate*>(variantTrack));
             break;
         case TrackType::Video:
-            m_player->addVideoTrack(get<VideoTrackPrivate&>(variantTrack));
+            m_player->addVideoTrack(*WTF::get<VideoTrackPrivate*>(variantTrack));
             break;
         case TrackType::Text:
-            m_player->addTextTrack(get<InbandTextTrackPrivate&>(variantTrack));
+            m_player->addTextTrack(*WTF::get<InbandTextTrackPrivate*>(variantTrack));
             break;
         }
     }

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -83,12 +83,12 @@
             static_cast<BitmapTextureGL&>(clonedTexture.get()).copyFromExternalTexture(texture.id);
             return makeUnique<TextureMapperPlatformLayerBuffer>(WTFMove(clonedTexture), m_extraFlags);
         },
-        [](const YUVTexture&)
+        [](const YUVTexture&) -> std::unique_ptr<TextureMapperPlatformLayerBuffer>
         {
             notImplemented();
             return nullptr;
         },
-        [](const ExternalOESTexture&)
+        [](const ExternalOESTexture&) -> std::unique_ptr<TextureMapperPlatformLayerBuffer>
         {
             notImplemented();
             return nullptr;

Modified: trunk/Source/WebCore/platform/mock/MockMediaDevice.h (283905 => 283906)


--- trunk/Source/WebCore/platform/mock/MockMediaDevice.h	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/mock/MockMediaDevice.h	2021-10-11 17:22:53 UTC (rev 283906)
@@ -201,7 +201,7 @@
     {
         encoder << persistentId;
         encoder << label;
-        switchOn(properties, [&](const MockMicrophoneProperties& properties) {
+        WTF::switchOn(properties, [&](const MockMicrophoneProperties& properties) {
             encoder << (uint8_t)1;
             encoder << properties;
         }, [&](const MockSpeakerProperties& properties) {

Modified: trunk/Source/WebCore/platform/network/FormData.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/network/FormData.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/network/FormData.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -127,7 +127,7 @@
 {
     unsigned imageOrMediaFilesCount = 0;
     for (auto& element : m_elements) {
-        auto* encodedFileData = WTF::get_if<FormDataElement::EncodedFileData>(element.data);
+        auto* encodedFileData = WTF::get_if<FormDataElement::EncodedFileData>(&element.data);
         if (!encodedFileData)
             continue;
 
@@ -140,7 +140,7 @@
 
 uint64_t FormDataElement::lengthInBytes(const Function<uint64_t(const URL&)>& blobSize) const
 {
-    return switchOn(data,
+    return WTF::switchOn(data,
         [] (const Vector<uint8_t>& bytes) {
             return static_cast<uint64_t>(bytes.size());
         }, [] (const FormDataElement::EncodedFileData& fileData) {
@@ -162,7 +162,7 @@
 
 FormDataElement FormDataElement::isolatedCopy() const
 {
-    return switchOn(data,
+    return WTF::switchOn(data,
         [] (const Vector<uint8_t>& bytes) {
             return FormDataElement(Vector { bytes.data(), bytes.size() });
         }, [] (const FormDataElement::EncodedFileData& fileData) {
@@ -177,7 +177,7 @@
 {
     m_lengthInBytes = std::nullopt;
     if (!m_elements.isEmpty()) {
-        if (auto* vector = WTF::get_if<Vector<uint8_t>>(m_elements.last().data)) {
+        if (auto* vector = WTF::get_if<Vector<uint8_t>>(&m_elements.last().data)) {
             vector->append(static_cast<const uint8_t*>(data), size);
             return;
         }
@@ -293,7 +293,7 @@
     // Concatenate all the byte arrays, but omit any files.
     Vector<uint8_t> data;
     for (auto& element : m_elements) {
-        if (auto* vector = WTF::get_if<Vector<uint8_t>>(element.data))
+        if (auto* vector = WTF::get_if<Vector<uint8_t>>(&element.data))
             data.append(vector->data(), vector->size());
     }
     return data;
@@ -367,7 +367,7 @@
 {
     Vector<String> generatedFiles;
     for (auto& element : m_elements) {
-        auto* fileData = WTF::get_if<FormDataElement::EncodedFileData>(element.data);
+        auto* fileData = WTF::get_if<FormDataElement::EncodedFileData>(&element.data);
         if (!fileData)
             continue;
         if (FileSystem::fileTypeFollowingSymlinks(fileData->filename) != FileSystem::FileType::Directory)
@@ -425,7 +425,7 @@
     if (m_elements.size() != 1)
         return { };
 
-    if (auto* blobData = WTF::get_if<FormDataElement::EncodedBlobData>(m_elements.first().data))
+    if (auto* blobData = WTF::get_if<FormDataElement::EncodedBlobData>(&m_elements.first().data))
         return blobData->url;
     return { };
 }

Modified: trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -137,7 +137,7 @@
     // Create the new stream.
     FormDataElement& nextInput = form->remainingElements.last();
 
-    bool success = switchOn(nextInput.data,
+    bool success = WTF::switchOn(nextInput.data,
         [form] (Vector<uint8_t>& bytes) {
             size_t size = bytes.size();
             MallocPtr<uint8_t, WTF::VectorMalloc> data = ""
@@ -397,7 +397,7 @@
     // Handle the common special case of one piece of form data, with no files.
     auto& elements = formData->elements();
     if (elements.size() == 1 && !formData->alwaysStream()) {
-        if (auto* vector = WTF::get_if<Vector<uint8_t>>(elements[0].data)) {
+        if (auto* vector = WTF::get_if<Vector<uint8_t>>(&elements[0].data)) {
             auto data = "" vector->data(), vector->size()));
             CFURLRequestSetHTTPRequestBody(request, data.get());
             return;

Modified: trunk/Source/WebCore/platform/network/curl/CurlContext.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/network/curl/CurlContext.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/network/curl/CurlContext.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -351,7 +351,7 @@
 #if OS(WINDOWS)
     curl_easy_setopt(m_handle, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
 #else
-    if (auto* path = WTF::get_if<String>(sslHandle.getCACertInfo()))
+    if (auto* path = WTF::get_if<String>(&sslHandle.getCACertInfo()))
         setCACertPath(path->utf8().data());
 #endif
 }

Modified: trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -128,7 +128,7 @@
                 return readFromData(bytes, bufferPosition, bufferSize);
             }, [&] (const FormDataElement::EncodedFileData& fileData) {
                 return readFromFile(fileData, bufferPosition, bufferSize);
-            }, [] (const FormDataElement::EncodedBlobData&) {
+            }, [] (const FormDataElement::EncodedBlobData&) -> std::optional<size_t> {
                 ASSERT_NOT_REACHED();
                 return std::nullopt;
             }

Modified: trunk/Source/WebCore/platform/network/curl/CurlSSLVerifier.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/network/curl/CurlSSLVerifier.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/network/curl/CurlSSLVerifier.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -44,7 +44,7 @@
     SSL_CTX_set_verify(ctx, SSL_CTX_get_verify_mode(ctx), verifyCallback);
 
 #if defined(LIBRESSL_VERSION_NUMBER)
-    if (auto data = ""
+    if (auto data = ""
         SSL_CTX_load_verify_mem(ctx, static_cast<void*>(const_cast<uint8_t*>(data->data())), data->size());
 #endif
 

Modified: trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp (283905 => 283906)


--- trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -101,7 +101,7 @@
     // Handle the common special case of one piece of form data, with no files.
     auto& elements = formData->elements();
     if (elements.size() == 1 && !formData->alwaysStream()) {
-        if (auto* vector = WTF::get_if<Vector<uint8_t>>(elements[0].data)) {
+        if (auto* vector = WTF::get_if<Vector<uint8_t>>(&elements[0].data)) {
 #if USE(SOUP2)
             soup_message_body_append(soupMessage->request_body, SOUP_MEMORY_TEMPORARY, vector->data(), vector->size());
 #else

Modified: trunk/Source/WebCore/style/StyleResolveForFontRaw.cpp (283905 => 283906)


--- trunk/Source/WebCore/style/StyleResolveForFontRaw.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebCore/style/StyleResolveForFontRaw.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -158,7 +158,7 @@
     }
 
     if (fontRaw.weight) {
-        auto weight = switchOn(*fontRaw.weight, [&] (CSSValueID ident) {
+        auto weight = WTF::switchOn(*fontRaw.weight, [&] (CSSValueID ident) {
             switch (ident) {
             case CSSValueNormal:
                 return normalWeightValue();
@@ -179,7 +179,7 @@
     }
 
     fontDescription.setKeywordSizeFromIdentifier(CSSValueInvalid);
-    float size = switchOn(fontRaw.size, [&] (CSSValueID ident) {
+    float size = WTF::switchOn(fontRaw.size, [&] (CSSValueID ident) {
         switch (ident) {
         case CSSValueXxSmall:
         case CSSValueXSmall:
@@ -199,7 +199,7 @@
             return 0.f;
         }
     }, [&] (const CSSPropertyParserHelpers::LengthOrPercentRaw& lengthOrPercent) {
-        return switchOn(lengthOrPercent, [&] (const CSSPropertyParserHelpers::LengthRaw& length) {
+        return WTF::switchOn(lengthOrPercent, [&] (const CSSPropertyParserHelpers::LengthRaw& length) {
             auto fontCascade = FontCascade(FontCascadeDescription(fontDescription));
             fontCascade.update(context.cssFontSelector());
             // FIXME: Passing null for the RenderView parameter means that vw and vh units will evaluate to

Modified: trunk/Source/WebKit/ChangeLog (283905 => 283906)


--- trunk/Source/WebKit/ChangeLog	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebKit/ChangeLog	2021-10-11 17:22:53 UTC (rev 283906)
@@ -1,5 +1,24 @@
 2021-10-11  Alex Christensen  <[email protected]>
 
+        Prepare to switch from WTF::Variant to std::variant
+        https://bugs.webkit.org/show_bug.cgi?id=231239
+
+        Reviewed by Chris Dumez.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
+        * NetworkProcess/NetworkResourceLoadParameters.cpp:
+        (WebKit::NetworkResourceLoadParameters::encode const):
+        * Platform/IPC/FormDataReference.h:
+        (IPC::FormDataReference::encode const):
+        * Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
+        (WebKit::MediaSampleCursor::locateIterator const):
+        * UIProcess/API/APIWebAuthenticationPanel.h:
+        * UIProcess/Automation/SimulatedInputDispatcher.h:
+        * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
+
+2021-10-11  Alex Christensen  <[email protected]>
+
         Add AdAttributionDaemon sandbox on iOS
         https://bugs.webkit.org/show_bug.cgi?id=231308
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (283905 => 283906)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -470,7 +470,7 @@
     Vector<RefPtr<WebCore::BlobDataFileReference>> files;
     if (auto* body = loadParameters.request.httpBody()) {
         for (auto& element : body->elements()) {
-            if (auto* blobData = WTF::get_if<FormDataElement::EncodedBlobData>(element.data))
+            if (auto* blobData = WTF::get_if<FormDataElement::EncodedBlobData>(&element.data))
                 files.appendVector(blobRegistry.filesInBlob(blobData->url));
         }
         const_cast<WebCore::ResourceRequest&>(loadParameters.request).setHTTPBody(body->resolveBlobReferences(&blobRegistry));

Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp (283905 => 283906)


--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -53,7 +53,7 @@
 
         Vector<SandboxExtension::Handle> requestBodySandboxExtensions;
         for (const FormDataElement& element : request.httpBody()->elements()) {
-            if (auto* fileData = WTF::get_if<FormDataElement::EncodedFileData>(element.data)) {
+            if (auto* fileData = WTF::get_if<FormDataElement::EncodedFileData>(&element.data)) {
                 const String& path = fileData->filename;
                 if (auto handle = SandboxExtension::createHandle(path, SandboxExtension::Type::ReadOnly))
                     requestBodySandboxExtensions.append(WTFMove(*handle));

Modified: trunk/Source/WebKit/Platform/IPC/FormDataReference.h (283905 => 283906)


--- trunk/Source/WebKit/Platform/IPC/FormDataReference.h	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebKit/Platform/IPC/FormDataReference.h	2021-10-11 17:22:53 UTC (rev 283906)
@@ -52,7 +52,7 @@
 
         Vector<WebKit::SandboxExtension::Handle> sandboxExtensionHandles;
         for (auto& element : m_data->elements()) {
-            if (auto* fileData = WTF::get_if<WebCore::FormDataElement::EncodedFileData>(element.data)) {
+            if (auto* fileData = WTF::get_if<WebCore::FormDataElement::EncodedFileData>(&element.data)) {
                 const String& path = fileData->filename;
                 if (auto handle = WebKit::SandboxExtension::createHandle(path, WebKit::SandboxExtension::Type::ReadOnly))
                     sandboxExtensionHandles.append(WTFMove(*handle));

Modified: trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaSampleCursor.cpp (283905 => 283906)


--- trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaSampleCursor.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaSampleCursor.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -153,13 +153,11 @@
             else
                 return std::nullopt;
             return locateIterator(samples, hasAllSamples);
-        },
-        [&](const auto& otherIterator) {
+        }, [&](const auto& otherIterator) -> std::optional<Iterator> {
             assertIsHeld(m_locatorLock);
             m_locator = otherIterator->second->presentationTime();
             return locateIterator(samples, hasAllSamples);
-        },
-        [&](const Iterator& iterator) {
+        }, [&](const Iterator& iterator) -> std::optional<Iterator> {
             return iterator;
         }
     );

Modified: trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.h (283905 => 283906)


--- trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.h	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.h	2021-10-11 17:22:53 UTC (rev 283906)
@@ -30,6 +30,7 @@
 #include "APIObject.h"
 #include <WebCore/AuthenticatorTransport.h>
 #include <wtf/UniqueRef.h>
+#include <wtf/Variant.h>
 #include <wtf/WeakPtr.h>
 #include <wtf/text/WTFString.h>
 

Modified: trunk/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h (283905 => 283906)


--- trunk/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h	2021-10-11 17:22:53 UTC (rev 283906)
@@ -34,6 +34,7 @@
 #include <wtf/ListHashSet.h>
 #include <wtf/RunLoop.h>
 #include <wtf/Seconds.h>
+#include <wtf/Variant.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h (283905 => 283906)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h	2021-10-11 17:22:53 UTC (rev 283906)
@@ -28,6 +28,7 @@
 #import <wtf/CompletionHandler.h>
 #import <wtf/RefPtr.h>
 #import <wtf/RetainPtr.h>
+#import <wtf/Variant.h>
 #import <wtf/WeakObjCPtr.h>
 
 #if PLATFORM(MAC)

Modified: trunk/Tools/ChangeLog (283905 => 283906)


--- trunk/Tools/ChangeLog	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Tools/ChangeLog	2021-10-11 17:22:53 UTC (rev 283906)
@@ -1,3 +1,15 @@
+2021-10-11  Alex Christensen  <[email protected]>
+
+        Prepare to switch from WTF::Variant to std::variant
+        https://bugs.webkit.org/show_bug.cgi?id=231239
+
+        Reviewed by Chris Dumez.
+
+        * TestWebKitAPI/Tests/WTF/Hasher.cpp:
+        (TestWebKitAPI::add):
+        * TestWebKitAPI/Tests/WTF/Variant.cpp:
+        (TestWebKitAPI::TEST):
+
 2021-10-11  Jonathan Bedard  <[email protected]>
 
         [build.webkit.org] Build iOS 15 as universal binary (Follow-up fix)

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Hasher.cpp (283905 => 283906)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/Hasher.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Hasher.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -200,7 +200,7 @@
 
 void add(Hasher& hasher, const HasherAddCustom2&)
 {
-    add(hasher, { 1, 2, 3, 4 });
+    add(hasher, std::initializer_list<int> { 1, 2, 3, 4 });
 }
 
 TEST(WTF, Hasher_custom)

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Variant.cpp (283905 => 283906)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/Variant.cpp	2021-10-11 17:19:41 UTC (rev 283905)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Variant.cpp	2021-10-11 17:22:53 UTC (rev 283906)
@@ -56,8 +56,8 @@
     Variant<int, double> variant = 1;
     EXPECT_TRUE(variant.index() == 0);
     EXPECT_TRUE(WTF::get<int>(variant) == 1);
-    EXPECT_TRUE(*WTF::get_if<int>(variant) == 1);
-    EXPECT_TRUE(WTF::get_if<double>(variant) == nullptr);
+    EXPECT_EQ(*WTF::get_if<int>(&variant), 1);
+    EXPECT_EQ(WTF::get_if<double>(&variant), nullptr);
     EXPECT_TRUE(WTF::holds_alternative<int>(variant));
     EXPECT_FALSE(WTF::holds_alternative<double>(variant));
 
@@ -64,8 +64,8 @@
     variant = 1.0;
     EXPECT_TRUE(variant.index() == 1);
     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_EQ(*WTF::get_if<double>(&variant), 1.0);
+    EXPECT_EQ(WTF::get_if<int>(&variant), nullptr);
     EXPECT_TRUE(WTF::holds_alternative<double>(variant));
     EXPECT_FALSE(WTF::holds_alternative<int>(variant));
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to