Ignore:
Timestamp:
Oct 12, 2021, 1:43:49 PM (4 years ago)
Author:
[email protected]
Message:

Use STL instead of WTF::get_if, WTF::Monostate, WTF::visit, and WTF::holds_alternative
https://bugs.webkit.org/show_bug.cgi?id=231582

Patch by Alex Christensen <[email protected]> on 2021-10-12
Reviewed by Darin Adler.

Source/JavaScriptCore:

  • jit/AssemblyHelpers.cpp:

(JSC::AssemblyHelpers::branchIfValue):

  • jsc.cpp:

(JSC_DEFINE_HOST_FUNCTION):

  • parser/Lexer.cpp:

(JSC::Lexer<T>::lexWithoutClearingLineTerminator):

  • parser/VariableEnvironment.h:

(JSC::CompactTDZEnvironment::toTDZEnvironment const):

  • runtime/CacheUpdate.cpp:

(JSC::CacheUpdate::isGlobal const):

  • runtime/CachedTypes.cpp:

(JSC::CachedCompactTDZEnvironment::encode):

  • wasm/WasmLLIntGenerator.cpp:

(JSC::Wasm::LLIntGenerator::ControlType::isLoop):
(JSC::Wasm::LLIntGenerator::ControlType::isTopLevel):
(JSC::Wasm::LLIntGenerator::ControlType::isBlock):
(JSC::Wasm::LLIntGenerator::ControlType::isIf):
(JSC::Wasm::LLIntGenerator::ControlType::isTry):
(JSC::Wasm::LLIntGenerator::ControlType::isAnyCatch):
(JSC::Wasm::LLIntGenerator::ControlType::isCatch):
(JSC::Wasm::LLIntGenerator::ControlType::targetLabelForBranch const):
(JSC::Wasm::LLIntGenerator::ControlType::branchTargetArity const):
(JSC::Wasm::LLIntGenerator::ControlType::branchTargetType const):
(JSC::Wasm::LLIntGenerator::addElse):
(JSC::Wasm::LLIntGenerator::addCatchToUnreachable):
(JSC::Wasm::LLIntGenerator::addCatchAllToUnreachable):
(JSC::Wasm::LLIntGenerator::addRethrow):
(JSC::Wasm::LLIntGenerator::addEndToUnreachable):

Source/WebCore:

  • Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:

(WebCore::ApplePayPaymentHandler::handlesIdentifier):

  • Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:

(WebCore::ClipboardItemBindingsDataSource::invokeCompletionHandler):
(WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::sanitizeDataIfNeeded):

  • Modules/cache/DOMCache.cpp:

(WebCore::DOMCache::requestFromInfo):

  • Modules/fetch/FetchBody.h:

(WebCore::FetchBody::isBlob const):
(WebCore::FetchBody::isFormData const):
(WebCore::FetchBody::isArrayBuffer const):
(WebCore::FetchBody::isArrayBufferView const):
(WebCore::FetchBody::isURLSearchParams const):
(WebCore::FetchBody::isText const):

  • Modules/fetch/FetchHeaders.cpp:

(WebCore::fillHeaderMap):

  • Modules/fetch/FetchRequest.cpp:

(WebCore::FetchRequest::create):

  • Modules/indexeddb/IDBCursor.cpp:

(WebCore::IDBCursor::continuePrimaryKey):

  • Modules/indexeddb/IDBDatabase.cpp:

(WebCore::IDBDatabase::createObjectStore):
(WebCore::IDBDatabase::transaction):

  • Modules/indexeddb/IDBKeyPath.cpp:

(WebCore::isIDBKeyPathValid):
(WebCore::isolatedCopy):
(WebCore::loggingString):

  • Modules/indexeddb/IDBObjectStore.cpp:

(WebCore::IDBObjectStore::createIndex):

  • Modules/indexeddb/IDBRequest.cpp:

(WebCore::IDBRequest::requestedIndexRecordType const):

  • Modules/indexeddb/server/IDBSerialization.cpp:

(WebCore::serializeIDBKeyPath):

  • Modules/mediacontrols/MediaControlsHost.cpp:

(WebCore::MediaControlsHost::displayNameForTrack):
(WebCore::MediaControlsHost::showMediaControlsContextMenu):

  • Modules/mediastream/RTCPeerConnection.cpp:

(WebCore::RTCPeerConnection::addTransceiver):
(WebCore::certificateTypeFromAlgorithmIdentifier):

  • Modules/mediastream/RTCRtpSFrameTransform.cpp:

(WebCore::RTCRtpSFrameTransform::setEncryptionKey):

  • Modules/speech/SpeechRecognitionUpdate.cpp:

(WebCore::SpeechRecognitionUpdate::create):

  • Modules/speech/SpeechRecognitionUpdate.h:
  • Modules/webxr/WebXRWebGLLayer.cpp:

(WebCore::WebXRWebGLLayer::create):

  • animation/AnimationEffect.cpp:

(WebCore::AnimationEffect::updateTiming):

  • animation/KeyframeEffect.cpp:

(WebCore::processIterableKeyframes):
(WebCore::processPropertyIndexedKeyframes):
(WebCore::KeyframeEffect::create):

  • bindings/js/BufferSource.h:

(WebCore::BufferSource::data const):
(WebCore::BufferSource::length const):

  • bindings/js/IDBBindingUtilities.cpp:

(WebCore::injectIDBKeyIntoScriptValue):
(WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath):
(WebCore::canInjectIDBKeyIntoScriptValue):
(WebCore::createKeyPathArray):
(WebCore::deserializeIDBValueWithKeyInjection):

  • crypto/SubtleCrypto.cpp:

(WebCore::normalizeCryptoAlgorithmParameters):

  • css/CSSCustomPropertyValue.cpp:

(WebCore::CSSCustomPropertyValue::createEmpty):
(WebCore::CSSCustomPropertyValue::equals const):
(WebCore::CSSCustomPropertyValue::customCSSText const):
(WebCore::CSSCustomPropertyValue::tokens const):

  • css/CSSCustomPropertyValue.h:
  • css/StyleRule.h:
  • css/typedom/CSSUnparsedValue.cpp:

(WebCore::CSSUnparsedValue::serialize const):

  • dom/DocumentMarker.h:

(WebCore::DocumentMarker::description const):

  • dom/Element.cpp:

(WebCore::Element::scrollIntoView):
(WebCore::Element::animate):

  • dom/EventTarget.cpp:

(WebCore::EventTarget::addEventListenerForBindings):
(WebCore::EventTarget::removeEventListenerForBindings):

  • editing/Editor.cpp:

(WebCore::Editor::advanceToNextMisspelling):

  • html/HTMLMediaElement.h:

(WebCore::HTMLMediaElement::hasMediaStreamSrcObject const):

  • html/URLSearchParams.cpp:

(WebCore::URLSearchParams::create):

  • html/canvas/CanvasStyle.cpp:

(WebCore::CanvasStyle::isEquivalentColor const):
(WebCore::CanvasStyle::isEquivalent const):

  • html/canvas/CanvasStyle.h:

(WebCore::CanvasStyle::isValid const):
(WebCore::CanvasStyle::isCurrentColor const):
(WebCore::CanvasStyle::canvasGradient const):
(WebCore::CanvasStyle::canvasPattern const):

  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::InspectorScopedShaderProgramHighlight::saveBlendValue):
(WebCore::InspectorScopedShaderProgramHighlight::hasBufferBinding):
(WebCore::InspectorScopedShaderProgramHighlight::hasFramebufferParameterAttachment):
(WebCore::WebGLRenderingContextBase::bufferData):
(WebCore::WebGLRenderingContextBase::bufferSubData):
(WebCore::WebGLRenderingContextBase::getTexImageSourceSize):
(WebCore::WebGLRenderingContextBase::texImageSourceHelper):

  • html/track/VTTCue.cpp:

(WebCore::VTTCue::setLine):
(WebCore::VTTCue::setPosition):

  • inspector/InspectorCanvas.cpp:

(WebCore::InspectorCanvas::canvasContext const):
(WebCore::InspectorCanvas::canvasElement const):
(WebCore::InspectorCanvas::scriptExecutionContext const):
(WebCore::InspectorCanvas::resolveContext const):
(WebCore:: const):
(WebCore::InspectorCanvas::buildObjectForCanvas):
(WebCore::InspectorCanvas::indexForData):

  • inspector/InspectorCanvas.h:
  • inspector/InspectorShaderProgram.cpp:

(WebCore::InspectorShaderProgram::program const):
(WebCore::InspectorShaderProgram::requestShaderSource):
(WebCore::InspectorShaderProgram::updateShader):
(WebCore::InspectorShaderProgram::buildObjectForShaderProgram):

  • inspector/InspectorShaderProgram.h:
  • inspector/agents/InspectorIndexedDBAgent.cpp:

(WebCore::Inspector::keyPathFromIDBKeyPath):

  • layout/integration/InlineIteratorBox.h:

(WebCore::InlineIterator::Box::legacyInlineBox const):
(WebCore::InlineIterator::Box::inlineBox const):

  • platform/PasteboardCustomData.cpp:

(WebCore::copyPlatformData):
(WebCore::PasteboardCustomData::readBuffer const):
(WebCore::PasteboardCustomData::readString const):
(WebCore::PasteboardCustomData::forEachPlatformString const):
(WebCore::PasteboardCustomData::forEachPlatformStringOrBuffer const):

  • platform/SharedBuffer.cpp:

(WebCore::SharedBuffer::takeData):
(WebCore::SharedBuffer::DataSegment::data const):
(WebCore::SharedBuffer::DataSegment::containsMappedFileData const):
(WebCore::SharedBuffer::DataSegment::size const):

  • platform/cf/SharedBufferCF.cpp:

(WebCore::SharedBuffer::createCFData const):
(WebCore::SharedBuffer::hintMemoryNotNeededSoon const):

  • platform/generic/KeyedDecoderGeneric.cpp:

(WebCore::KeyedDecoderGeneric::getPointerFromDictionaryStack):

  • platform/graphics/DecodingOptions.h:

(WebCore::DecodingOptions::has const):

  • platform/graphics/FontCascadeFonts.cpp:

(WebCore::realizeNextFallback):

  • platform/graphics/InlinePathData.h:
  • platform/graphics/Path.h:

(WebCore::Path::hasInlineData const):

  • platform/graphics/cg/PathCG.cpp:

(WebCore::Path::createCGPath const):
(WebCore::Path::ensurePlatformPath):
(WebCore::Path::Path):
(WebCore::Path::transform):
(WebCore::Path::clear):

  • platform/graphics/displaylists/DisplayListItemBuffer.cpp:

(WebCore::DisplayList::safeCopy):

  • platform/graphics/displaylists/DisplayListItemType.cpp:

(WebCore::DisplayList::paddedSizeOfTypeAndItemInBytes):
(WebCore::DisplayList::displayListItemType):

  • platform/graphics/displaylists/DisplayListResourceHeap.h:

(WebCore::DisplayList::ResourceHeap::deleteAllFonts):
(WebCore::DisplayList::ResourceHeap::get const):
(WebCore::DisplayList::ResourceHeap::remove):

  • platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:

(WebCore::CDMProxyClearKey::cencSetDecryptionKey):

  • platform/graphics/gstreamer/eme/CDMProxyThunder.cpp:

(WebCore::CDMProxyThunder::getDecryptionSession const):

  • platform/ios/PlatformPasteboardIOS.mm:

(WebCore::createItemProviderRegistrationList):

  • platform/mac/PlatformPasteboardMac.mm:

(WebCore::PlatformPasteboard::write):
(WebCore::createPasteboardItem):

  • platform/mock/MockMediaDevice.h:

(WebCore::MockMediaDevice::isMicrophone const):
(WebCore::MockMediaDevice::isSpeaker const):
(WebCore::MockMediaDevice::isCamera const):
(WebCore::MockMediaDevice::isDisplay const):

  • platform/mock/MockRealtimeVideoSource.cpp:

(WebCore::MockRealtimeVideoSource::mockDisplayType const):

  • platform/mock/MockRealtimeVideoSource.h:

(WebCore::MockRealtimeVideoSource::mockCamera const):
(WebCore::MockRealtimeVideoSource::mockDisplay const):

  • platform/network/DNS.h:

(WebCore::IPAddress::isIPv4 const):
(WebCore::IPAddress::isIPv6 const):

  • platform/network/FormData.cpp:

(WebCore::FormData::imageOrMediaFilesCount const):
(WebCore::FormData::appendData):
(WebCore::FormData::appendMultiPartKeyValuePairItems):
(WebCore::FormData::appendNonMultiPartKeyValuePairItems):
(WebCore::FormData::flatten const):
(WebCore::FormData::containsBlobElement const):
(WebCore::FormData::prepareForUpload):
(WebCore::FormData::asSharedBuffer const):
(WebCore::FormData::asBlobURL const):

  • platform/network/ResourceRequestBase.cpp:

(WebCore::ResourceRequestBase::hasUpload const):

  • platform/network/cf/FormDataStreamCFNet.cpp:

(WebCore::setHTTPBody):

  • platform/network/curl/CurlContext.cpp:

(WebCore::CurlHandle::enableSSLForHost):

  • platform/network/curl/CurlSSLHandle.cpp:

(WebCore::CurlSSLHandle::clearCACertInfo):

  • platform/network/curl/CurlSSLVerifier.cpp:

(WebCore::CurlSSLVerifier::CurlSSLVerifier):

  • platform/network/soup/ResourceRequestSoup.cpp:

(WebCore::ResourceRequest::updateSoupMessageBody const):

  • platform/network/soup/WebKitFormDataInputStream.cpp:

(webkitFormDataInputStreamNew):

  • platform/win/PasteboardWin.cpp:

(WebCore::Pasteboard::writeCustomData):

  • platform/xr/PlatformXR.h:

(PlatformXR::Device::FrameData::View::encode const):

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::setChildrenInline):
(WebCore::RenderBlockFlow::deleteLines):
(WebCore::RenderBlockFlow::invalidateLineLayoutPath):

  • rendering/RenderBlockFlow.h:

(WebCore::RenderBlockFlow::hasLineLayout const):
(WebCore::RenderBlockFlow::hasLegacyLineLayout const):
(WebCore::RenderBlockFlow::hasModernLineLayout const):

  • style/StyleBuilder.cpp:

(WebCore::Style::Builder::applyCustomProperty):
(WebCore::Style::Builder::applyProperty):

  • workers/service/ServiceWorkerJobData.cpp:

(WebCore::ServiceWorkerJobData::serviceWorkerPageIdentifier const):

  • workers/service/context/ServiceWorkerThread.cpp:

(WebCore::ServiceWorkerThread::queueTaskToPostMessage):

  • workers/service/server/SWServerJobQueue.cpp:

(WebCore::SWServerJobQueue::cancelJobsFromServiceWorker):

Source/WebKit:

  • NetworkProcess/NetworkConnectionToWebProcess.cpp:

(WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):

  • NetworkProcess/NetworkResourceLoadParameters.cpp:

(WebKit::NetworkResourceLoadParameters::encode const):

  • NetworkProcess/cache/NetworkCacheDataCurl.cpp:

(WebKit::NetworkCache::Data::Data):

  • Platform/IPC/ArgumentCoders.h:

(IPC::ArgumentCoder<std::monostate>::encode):
(IPC::ArgumentCoder<std::monostate>::decode):
(IPC::ArgumentCoder<Monostate>::encode): Deleted.
(IPC::ArgumentCoder<Monostate>::decode): Deleted.

  • Platform/IPC/FormDataReference.h:

(IPC::FormDataReference::encode const):

  • Platform/IPC/MessageReceiveQueueMap.cpp:

(IPC::MessageReceiveQueueMap::get const):

  • Platform/IPC/unix/ConnectionUnix.cpp:

(IPC::Connection::sendOutputMessage):

  • Shared/WebCoreArgumentCoders.cpp:

(IPC::ArgumentCoder<PasteboardCustomData::Entry>::encode):
(IPC::ArgumentCoder<IDBKeyPath>::encode):
(IPC::ArgumentCoder<ServiceWorkerOrClientData>::encode):
(IPC::ArgumentCoder<ServiceWorkerOrClientIdentifier>::encode):

  • Shared/WebPreferencesStore.cpp:

(WebKit::valueForKey):

  • UIProcess/ProcessThrottler.cpp:

(WebKit::ProcessThrottler::isValidBackgroundActivity):
(WebKit::ProcessThrottler::isValidForegroundActivity):
(WebKit::ProcessThrottler::TimedActivity::updateTimer):

  • UIProcess/WebAuthentication/Authenticator.cpp:

(WebKit::Authenticator::handleRequest):

  • UIProcess/WebAuthentication/AuthenticatorManager.cpp:

(WebKit::WebCore::getRpId):
(WebKit::WebCore::getUserName):
(WebKit::AuthenticatorManager::respondReceived):
(WebKit::AuthenticatorManager::invokePendingCompletionHandler):

  • UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp:

(WebKit::getClientDataType):
(WebKit::getUserVerificationRequirement):

  • UIProcess/gtk/WebPasteboardProxyGtk.cpp:

(WebKit::WebPasteboardProxy::writeCustomData):

  • WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:

(WebKit::ImageBufferShareableBitmapBackend::create):

  • WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
  • WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:

(WebKit::ImageBufferShareableIOSurfaceBackend::create):

  • WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:

(WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):

  • WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:

(WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):

  • WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:

(WebKit::WebEditorClient::executePendingEditorCommands):

  • WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:

(WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):

Source/WTF:

  • wtf/Variant.h:

(WTF::switchOn):
(): Deleted.
(WTF::visit): Deleted.
(WTF::get_if): Deleted.

Tools:

  • TestWebKitAPI/Tests/WTF/Variant.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebKitCocoa/PrivateClickMeasurement.mm:

(addValuesToTable):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSCustomPropertyValue.cpp

    r279358 r284016  
    3333Ref<CSSCustomPropertyValue> CSSCustomPropertyValue::createEmpty(const AtomString& name)
    3434{
    35     return adoptRef(*new CSSCustomPropertyValue(name, Monostate { }));
     35    return adoptRef(*new CSSCustomPropertyValue(name, std::monostate { }));
    3636}
    3737
     
    4040    if (m_name != other.m_name || m_value.index() != other.m_value.index())
    4141        return false;
    42     return WTF::switchOn(m_value, [&](const Monostate&) {
     42    return WTF::switchOn(m_value, [&](const std::monostate&) {
    4343        return true;
    4444    }, [&](const Ref<CSSVariableReferenceValue>& value) {
     
    5858{
    5959    if (m_stringValue.isNull()) {
    60         WTF::switchOn(m_value, [&](const Monostate&) {
     60        WTF::switchOn(m_value, [&](const std::monostate&) {
    6161            m_stringValue = emptyString();
    6262        }, [&](const Ref<CSSVariableReferenceValue>& value) {
     
    7878{
    7979    Vector<CSSParserToken> result;
    80     WTF::switchOn(m_value, [&](const Monostate&) {
     80    WTF::switchOn(m_value, [&](const std::monostate&) {
    8181        // Do nothing.
    8282    }, [&](const Ref<CSSVariableReferenceValue>&) {
Note: See TracChangeset for help on using the changeset viewer.