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/JavaScriptCore:
- dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileCallDOM):
(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):
(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):
(WebCore::MessageEvent::memoryCost const):
(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.
- It makes WTF::get_if look more like std::get_if by taking a pointer to a variant instead of a reference.
- 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.
- 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.
- It adds a few explicit WTF:: and #include <wtf/Variant.h> that will be needed after removing Variant from Forward.h.
- 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::get_if):
Tools:
- TestWebKitAPI/Tests/WTF/Hasher.cpp:
(TestWebKitAPI::add):
- TestWebKitAPI/Tests/WTF/Variant.cpp:
(TestWebKitAPI::TEST):