Ignore:
Timestamp:
Oct 11, 2021, 10:22:53 AM (4 years ago)
Author:
[email protected]
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/JavaScriptCore:

  • 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.

  1. 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.

  1. It adds a few explicit WTF:: and #include <wtf/Variant.h> that will be needed after removing Variant from Forward.h.
  2. 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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Lexer.cpp

    r281429 r283906  
    15511551
    15521552    if (LIKELY(maximumDigits >= 0 && m_current != 'n'))
    1553         return NumberParseResult { hexValue };
     1553        return NumberParseResult { static_cast<double>(hexValue) };
    15541554
    15551555    // No more place in the hexValue buffer.
     
    16101610
    16111611    if (LIKELY(!isASCIIDigitOrSeparator(m_current) && digit >= 0 && m_current != 'n'))
    1612         return NumberParseResult { binaryValue };
     1612        return NumberParseResult { static_cast<double>(binaryValue) };
    16131613
    16141614    for (int i = maximumDigits - 1; i > digit; --i)
     
    16661666
    16671667    if (LIKELY(!isASCIIDigitOrSeparator(m_current) && digit >= 0 && m_current != 'n'))
    1668         return NumberParseResult { octalValue };
     1668        return NumberParseResult { static_cast<double>(octalValue) };
    16691669
    16701670    for (int i = maximumDigits - 1; i > digit; --i)
     
    17251725
    17261726        if (digit >= 0 && m_current != '.' && !isASCIIAlphaCaselessEqual(m_current, 'e') && m_current != 'n')
    1727             return NumberParseResult { decimalValue };
     1727            return NumberParseResult { static_cast<double>(decimalValue) };
    17281728
    17291729        for (int i = maximumDigits - 1; i > digit; --i)
Note: See TracChangeset for help on using the changeset viewer.