Clean up / optimize call sites constructing vectors
https://bugs.webkit.org/show_bug.cgi?id=236748
Reviewed by Dean Jackson.
Clean up / optimize call sites constructing vectors:
- Use Vector::map() / WTF::map() where appropriate
Source/JavaScriptCore:
- Replace Vector::reserveCapacity() with Vector::reserveInitialCapacity()
where appropriate
- Replace Vector::append() with Vector::uncheckedAppend() where appropriate
- Leverage the fact that Vector<Ref<Foo>> is now copyable (Because Ref<> now has
a copy constructor)
- Call crossThreadCopy() to isolate-copy a Vector() without iterating.
- Leverage Vector constructor that takes in an intialization list in more cases
- Leverage Vector::from() in more cases to simplify vector construction in some
case.
- Drop unnecessary calls to Vector::reserve*Capacity() before calling
Vector::append(T*, size_t) since the append() implementation already does this
for us.
- Leverage copyToVector() and copyToVectorOf<> in more cases
- Call shrinkToFit() in some cases where we reserve capacity and then append()
but may not append() as much as we reserved.
(JSC::B3::Air::Code::setNumEntrypoints):
- bytecompiler/NodesCodegen.cpp:
(JSC::ArrayPatternNode::emitDirectBinding):
- dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::setLiveValues):
- dfg/DFGLivenessAnalysisPhase.cpp:
- dfg/DFGScoreBoard.h:
(JSC::DFG::ScoreBoard::ScoreBoard):
- inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::parseBreakpointOptions):
- inspector/remote/socket/RemoteInspectorMessageParser.cpp:
(Inspector::MessageParser::pushReceivedData):
- parser/VariableEnvironment.cpp:
(JSC::CompactTDZEnvironment::CompactTDZEnvironment):
(JSC::Wasm::Worklist::Worklist):
Source/WebCore:
- Replace Vector::reserveCapacity() with Vector::reserveInitialCapacity()
where appropriate
- Replace Vector::append() with Vector::uncheckedAppend() where appropriate
- Leverage the fact that Vector<Ref<Foo>> is now copyable (Because Ref<> now has
a copy constructor)
- Call crossThreadCopy() to isolate-copy a Vector() without iterating.
- Leverage Vector constructor that takes in an intialization list in more cases
- Leverage Vector::from() in more cases to simplify vector construction in some
case.
- Drop unnecessary calls to Vector::reserve*Capacity() before calling
Vector::append(T*, size_t) since the append() implementation already does this
for us.
- Leverage copyToVector() and copyToVectorOf<> in more cases
- Call shrinkToFit() in some cases where we reserve capacity and then append()
but may not append() as much as we reserved.
- Modules/async-clipboard/Clipboard.cpp:
(WebCore::Clipboard::read):
(WebCore::Clipboard::ItemWriter::didSetAllData):
- Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::updateKeyStatuses):
- Modules/entriesapi/FileSystemEntriesCallback.cpp:
(WebCore::FileSystemEntriesCallback::scheduleCallback):
(WebCore::copyVector): Deleted.
- Modules/entriesapi/HTMLInputElementEntriesAPI.cpp:
(WebCore::HTMLInputElementEntriesAPI::webkitEntries):
- Modules/geolocation/GeolocationController.cpp:
(WebCore::GeolocationController::positionChanged):
(WebCore::GeolocationController::errorOccurred):
- Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::stop):
- Modules/indexeddb/IDBGetAllResult.cpp:
(WebCore::IDBGetAllResult::isolatedCopy):
- Modules/indexeddb/IDBGetResult.cpp:
(WebCore::IDBGetResult::isolatedCopy):
- Modules/indexeddb/IDBKeyPath.cpp:
(WebCore::isolatedCopy): Deleted.
- Modules/indexeddb/IDBKeyPath.h:
(WebCore::isolatedCopy): Deleted.
- Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::abortInProgressOperations):
- Modules/indexeddb/client/IDBConnectionProxy.cpp:
(WebCore::IDBClient::removeItemsMatchingCurrentThread):
- Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::deleteAllIndexes):
- Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::currentData):
- Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
(WebCore::IDBDatabaseInfo::objectStoreNames const):
- Modules/indexeddb/shared/IDBIndexInfo.cpp:
(WebCore::IDBIndexInfo::isolatedCopy const):
- Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
(WebCore::IDBObjectStoreInfo::isolatedCopy const):
(WebCore::IDBObjectStoreInfo::indexNames const):
- Modules/indexeddb/shared/IDBTransactionInfo.cpp:
(WebCore::IDBTransactionInfo::isolatedCopy):
- Modules/indexeddb/shared/IndexKey.cpp:
(WebCore::IndexKey::isolatedCopy const):
- Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::clone):
- Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::capabilityStringVector):
- Modules/mediastream/MediaTrackConstraints.cpp:
(WebCore::convertAdvancedToInternalForm):
- Modules/mediastream/SFrameUtils.cpp:
(WebCore::toRbsp):
- Modules/remoteplayback/RemotePlayback.cpp:
(WebCore::RemotePlayback::availabilityChanged):
- Modules/speech/SpeechRecognition.cpp:
(WebCore::SpeechRecognition::didReceiveResult):
- Modules/webauthn/cbor/CBORValue.cpp:
(cbor::CBORValue::CBORValue):
- Modules/webauthn/fido/AuthenticatorGetInfoResponse.cpp:
(fido::toArrayValue):
- Modules/webauthn/fido/DeviceRequestConverter.cpp:
(fido::convertParametersToCBOR):
- Modules/webauthn/fido/Pin.cpp:
(fido::pin::encodeRawPublicKey):
- Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::databaseNames):
(WebCore::isolatedCopy): Deleted.
- accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::notificationPostTimerFired):
- accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::setMathscripts):
(WebCore::AXIsolatedObject::setObjectVectorProperty):
- accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::objectsForIDs const):
(WebCore::AXIsolatedTree::collectNodeChangesForSubtree):
- animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
- bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readString):
(WebCore::SerializedScriptValue::blobURLs const):
- crypto/mac/CryptoAlgorithmECDSAMac.cpp:
(WebCore::signECDSA):
(WebCore::verifyECDSA):
- crypto/mac/CryptoKeyECMac.cpp:
(WebCore::CryptoKeyEC::platformExportSpki const):
(WebCore::CryptoKeyEC::platformExportPkcs8 const):
- crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::CryptoKeyRSA::exportSpki const):
(WebCore::CryptoKeyRSA::exportPkcs8 const):
(WebCore::CSSBasicShapePolygon::cssText const):
- css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::copyPropertiesInSet):
(WebCore::ComputedStyleExtractor::copyProperties):
(WebCore::iterateClients):
(WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts):
(WebCore::CSSFontFaceSet::fontFace):
- css/CSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::StyleRuleKeyframes):
(WebCore::StyleProperties::copyPropertiesInSet const):
(WebCore::DeferredStyleProperties::DeferredStyleProperties):
(WebCore::DeferredStyleGroupRuleList::DeferredStyleGroupRuleList):
(WebCore::StyleRuleGroup::StyleRuleGroup):
- css/calc/CSSCalcOperationNode.h:
- css/calc/CSSCalcValue.cpp:
(WebCore::createCSS):
- display/css/DisplayBoxDecorationPainter.cpp:
(WebCore::Display::BorderPainter::clipBorderSidePolygon const):
(WebCore::Display::BorderPainter::drawLineForBoxSide const):
(WebCore::DOMRectList::DOMRectList):
(WebCore::Document::updateElementsAffectedByMediaQueries):
(WebCore::Document::didAssociateFormControlsTimerFired):
(WebCore::UniqueElementData::UniqueElementData):
- dom/EventListenerMap.cpp:
(WebCore::EventListenerMap::eventTypes const):
- dom/TreeScopeOrderedMap.cpp:
(WebCore::TreeScopeOrderedMap::keys const):
- editing/CompositeEditCommand.cpp:
(WebCore::copyMarkers):
(WebCore::editableTextListsAtPositionInDescendingOrder):
(WebCore::FileList::paths const):
(WebCore::HistoryItem::HistoryItem):
(WebCore::m_formData):
(WebCore::m_identifier):
(WebCore::FileInputType::setFiles):
(WebCore::FileInputType::filesChosen):
- html/LinkIconCollector.cpp:
(WebCore::LinkIconCollector::iconsOfTypes):
- html/URLSearchParams.cpp:
(WebCore::URLSearchParams::getAll const):
- layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::layoutInlineContent):
- loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::startIconLoading):
(WebCore::DocumentLoader::setActiveContentRuleListActionPatterns):
- loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::getNewCues):
- loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createFromSelection):
- page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::preferredAudioCharacteristics const):
(WebCore::DOMWindow::dispatchAllPendingBeforeUnloadEvents):
- page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::create):
(WebCore::Page::replaceRangesWithText):
- page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::responseHeaders const):
- page/csp/ContentSecurityPolicyResponseHeaders.cpp:
(WebCore::ContentSecurityPolicyResponseHeaders::isolatedCopy const):
- page/mac/ImageOverlayControllerMac.mm:
(WebCore::ImageOverlayController::updateDataDetectorHighlights):
- page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::buildSelectionHighlight):
(WebCore::ServicesOverlayController::handleClick):
- page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::childrenOfNode const):
- page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::convertOffsetInfo):
(WebCore::makeCalculated):
- platform/animation/AnimationList.cpp:
(WebCore::AnimationList::AnimationList):
- platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::audioMediaSelectionOptions const):
- platform/encryptedmedia/CDMProxy.cpp:
(WebCore::KeyStore::convertToJSKeyStatusVector const):
- platform/graphics/FloatPolygon.cpp:
(WebCore::FloatPolygon::overlappingEdges const):
- platform/graphics/FloatQuad.cpp:
(WebCore::boundingBoxes):
- platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
- platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::removeTiles):
(WebCore::TileGrid::removeAllTiles):
- platform/graphics/ca/TileGrid.h:
- platform/graphics/cg/ImageUtilitiesCG.cpp:
(WebCore::findImagesForTranscoding):
(WebCore::transcodeImages):
- platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::findClosestFont):
(WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
- platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::fitnessDistance):
- platform/network/CacheValidation.cpp:
(WebCore::collectVaryingRequestHeadersInternal):
- platform/network/FormData.cpp:
(WebCore::FormData::isolatedCopy const):
- platform/network/SocketStreamHandleImpl.cpp:
(WebCore::SocketStreamHandleImpl::platformSendHandshake):
- platform/network/cocoa/NetworkStorageSessionCocoa.mm:
- platform/text/LocaleICU.cpp:
(WebCore::LocaleICU::createLabelVector):
(WebCore::createFallbackMonthLabels):
(WebCore::createFallbackAMPMLabels):
- platform/text/LocaleNone.cpp:
(WebCore::LocaleNone::monthLabels):
(WebCore::LocaleNone::shortMonthLabels):
(WebCore::LocaleNone::timeAMPMLabels):
- platform/text/cocoa/LocaleCocoa.mm:
(WebCore::LocaleCocoa::monthLabels):
(WebCore::LocaleCocoa::shortMonthLabels):
(WebCore::LocaleCocoa::standAloneMonthLabels):
(WebCore::LocaleCocoa::shortStandAloneMonthLabels):
(WebCore::LocaleCocoa::timeAMPMLabels):
- plugins/DOMMimeTypeArray.cpp:
(WebCore::DOMMimeTypeArray::supportedPropertyNames const):
(WebCore::DOMMimeTypeArray::supportedPropertyNames): Deleted.
- plugins/DOMMimeTypeArray.h:
- plugins/DOMPlugin.cpp:
(WebCore::makeMimeTypes):
(WebCore::DOMPlugin::supportedPropertyNames const):
(WebCore::DOMPlugin::supportedPropertyNames): Deleted.
- plugins/DOMPlugin.h:
- plugins/DOMPluginArray.cpp:
(WebCore::DOMPluginArray::supportedPropertyNames const):
(WebCore::DOMPluginArray::supportedPropertyNames): Deleted.
- plugins/DOMPluginArray.h:
- rendering/LayerAncestorClippingStack.cpp:
(WebCore::LayerAncestorClippingStack::LayerAncestorClippingStack):
(WebCore::LayerAncestorClippingStack::compositedClipData const):
- rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::clipBorderSidePolygon):
- rendering/RenderElement.cpp:
(WebCore::RenderElement::drawLineForBoxSide const):
- rendering/RenderGrid.cpp:
(WebCore::RenderGrid::trackSizesForComputedStyle const):
- style/ClassChangeInvalidation.cpp:
(WebCore::Style::collectClasses):
- style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertTo100PercentMinusLength):
- testing/MockCDMFactory.cpp:
(WebCore::MockCDMInstanceSession::updateLicense):
(WebCore::MockCDMInstanceSession::removeSessionData):
- workers/service/server/SWServer.cpp:
(WebCore::SWServer::getRegistrations):
Source/WebKit:
- Replace Vector::reserveCapacity() with Vector::reserveInitialCapacity()
where appropriate
- Replace Vector::append() with Vector::uncheckedAppend() where appropriate
- Leverage the fact that Vector<Ref<Foo>> is now copyable (Because Ref<> now has
a copy constructor)
- Call crossThreadCopy() to isolate-copy a Vector() without iterating.
- Leverage Vector constructor that takes in an intialization list in more cases
- Leverage Vector::from() in more cases to simplify vector construction in some
case.
- Drop unnecessary calls to Vector::reserve*Capacity() before calling
Vector::append(T*, size_t) since the append() implementation already does this
for us.
- Leverage copyToVector() and copyToVectorOf<> in more cases
- Call shrinkToFit() in some cases where we reserve capacity and then append()
but may not append() as much as we reserved.
- NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
(WebKit::LocalStorageDatabaseTracker::originDetailsCrossThreadCopy):
- NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::cacheInfos):
(API::Array::createStringArray):
(API::Array::copy):
- Shared/API/APIDictionary.cpp:
(API::Dictionary::keys const):
(WebKit::transformGraph):
- Shared/WebContextMenuItem.cpp:
(WebKit::WebContextMenuItem::create):
(WebKit::WebContextMenuItem::submenuItemsAsAPIArray const):
- Shared/WebContextMenuItemData.cpp:
(WebKit::kitItems):
(WebKit::coreItems):
- UIProcess/API/APIWebAuthenticationPanel.cpp:
(API::WebAuthenticationPanel::WebAuthenticationPanel):
- UIProcess/API/APIWebsitePolicies.cpp:
(API::WebsitePolicies::copy const):
(API::WebsitePolicies::data):
- UIProcess/API/C/WKPage.cpp:
(API::toAPIObjectVector):
(WKPageSetPageContextMenuClient):
(WKPageSetPageFindMatchesClient):
(WKPageSetPageLoaderClient):
- UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenManagerProxy::forEachSession):
- UIProcess/Gamepad/UIGamepadProvider.cpp:
(WebKit::UIGamepadProvider::snapshotGamepads):
- UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::allNetworkProcesses):
(WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
- UIProcess/Notifications/WebNotificationManagerProxy.cpp:
(WebKit::WebNotificationManagerProxy::providerDidRemoveNotificationPolicies):
- UIProcess/Notifications/WebNotificationProvider.cpp:
(WebKit::WebNotificationProvider::clearNotifications):
- UIProcess/StatisticsRequest.cpp:
(WebKit::StatisticsRequest::completedRequest):
- UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::removeAllUserScripts):
(WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
- UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
(WebKit::WebAuthenticationPanelClient::selectAssertionResponse const):
- UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
(WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived):
- UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::addItem):
(WebKit::WebBackForwardList::clear):
(WebKit::WebBackForwardList::restoreFromState):
- UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld):
(WebKit::WebPageProxy::speechSynthesisVoiceList):
- UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchDataAndApply):
(WebKit::WebsiteDataStore::parametersFromEachWebsiteDataStore):
- UIProcess/mac/WKTextFinderClient.mm:
(-[WKTextFinderClient replaceMatches:withString:inSelectionOnly:resultCollector:]):
- WebProcess/GPU/media/RemoteRemoteCommandListener.cpp:
(WebKit::RemoteRemoteCommandListener::updateSupportedCommands):
- WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(contextMenuItems):
(WKBundlePageCopyOriginsWithApplicationCache):
- WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp:
(WebKit::InjectedBundlePageContextMenuClient::getCustomMenuFromDefaultItems):
- WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
(WebKit::InjectedBundlePageFormClient::didAssociateFormControls):
- WebProcess/Network/WebSocketStream.cpp:
(WebKit::WebSocketStream::networkProcessCrashed):
- WebProcess/Network/webrtc/WebRTCResolver.cpp:
(WebKit::WebRTCResolver::setResolvedAddress):
- WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
(WebKit::WebResourceLoadObserver::takeStatistics):
- WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::replaceMatches):
- WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
(WebKit::toKeyframeValueVector):
(WebKit::PlatformCAAnimationRemote::setValues):
(WebKit::PlatformCAAnimationRemote::setTimingFunctions):
- WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
- WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::trackedRepaintRects):
(WebKit::dumpHistoryItem):
Source/WTF:
- Replace Vector::reserveCapacity() with Vector::reserveInitialCapacity()
where appropriate
- Replace Vector::append() with Vector::uncheckedAppend() where appropriate
- Leverage the fact that Vector<Ref<Foo>> is now copyable (Because Ref<> now has
a copy constructor)
- Call crossThreadCopy() to isolate-copy a Vector() without iterating.
- Leverage Vector constructor that takes in an intialization list in more cases
- Leverage Vector::from() in more cases to simplify vector construction in some
case.
- Drop unnecessary calls to Vector::reserve*Capacity() before calling
Vector::append(T*, size_t) since the append() implementation already does this
for us.
- Leverage copyToVector() and copyToVectorOf<> in more cases
- Call shrinkToFit() in some cases where we reserve capacity and then append()
but may not append() as much as we reserved.
(WTF::userPreferredLanguages):
(WTF::isolatedCopy): Deleted.
|