Title: [287294] trunk/Source
Revision
287294
Author
commit-qu...@webkit.org
Date
2021-12-20 18:25:46 -0800 (Mon, 20 Dec 2021)

Log Message

[WebIDL] convertVariadicArguments() should return a FixedVector
https://bugs.webkit.org/show_bug.cgi?id=232639

Patch by Alexey Shvayka <ashva...@apple.com> on 2021-12-20
Reviewed by Yusuke Suzuki.

Source/WebCore:

Since it's highly unlikely (CSSNumericArray is immutable) that we would need to
mutate variadic arguments before processing them or storing, and we know their size
upfront, it makes the most sense to save some memory by utilizing a FixedVector.

This patch reduces sizeof(ScheduledAction) by 8, enabling memory-neutral addition
of a field like m_incumbentGlobalObject.

No new tests, no behavior change.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::addTrack):
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::addTrack):
* Modules/mediastream/RTCPeerConnection.h:
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::setStreams):
(WebCore::RTCRtpSender::setMediaStreamIds):
* Modules/mediastream/RTCRtpSender.h:
* Modules/mediastream/RTCRtpSenderBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::addTrack):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::LibWebRTCPeerConnectionBackend::addTrack):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
(WebCore::LibWebRTCRtpSenderBackend::setMediaStreamIds):
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
* bindings/js/JSDOMConvertVariadic.h:
(WebCore::convertVariadicArguments):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::addArguments):
* bindings/js/ScheduledAction.h:
* css/typedom/CSSNumericValue.cpp:
(WebCore::CSSNumericValue::add):
(WebCore::CSSNumericValue::sub):
(WebCore::CSSNumericValue::mul):
(WebCore::CSSNumericValue::div):
(WebCore::CSSNumericValue::min):
(WebCore::CSSNumericValue::max):
(WebCore::CSSNumericValue::equals):
(WebCore::CSSNumericValue::toSum):
* css/typedom/CSSNumericValue.h:
* css/typedom/numeric/CSSMathMax.cpp:
(WebCore::CSSMathMax::create):
(WebCore::CSSMathMax::CSSMathMax):
* css/typedom/numeric/CSSMathMax.h:
* css/typedom/numeric/CSSMathMin.cpp:
(WebCore::CSSMathMin::create):
(WebCore::CSSMathMin::CSSMathMin):
* css/typedom/numeric/CSSMathMin.h:
* css/typedom/numeric/CSSMathProduct.cpp:
(WebCore::CSSMathProduct::create):
(WebCore::CSSMathProduct::CSSMathProduct):
* css/typedom/numeric/CSSMathProduct.h:
* css/typedom/numeric/CSSMathSum.cpp:
(WebCore::CSSMathSum::create):
(WebCore::CSSMathSum::CSSMathSum):
* css/typedom/numeric/CSSMathSum.h:
* css/typedom/numeric/CSSNumericArray.cpp:
(WebCore::CSSNumericArray::create):
(WebCore::CSSNumericArray::CSSNumericArray):
* css/typedom/numeric/CSSNumericArray.h:
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::append):
(WebCore::ContainerNode::prepend):
(WebCore::ContainerNode::replaceChildren):
* dom/ContainerNode.h:
* dom/Document.cpp:
(WebCore::Document::write):
(WebCore::Document::writeln):
* dom/Document.h:
* dom/DocumentTouch.cpp:
(WebCore::DocumentTouch::createTouchList):
* dom/DocumentTouch.h:
* dom/Node.cpp:
(WebCore::nodeSetPreTransformedFromNodeOrStringVector):
(WebCore::Node::convertNodesOrStringsIntoNode):
(WebCore::Node::before):
(WebCore::Node::after):
(WebCore::Node::replaceWith):
* dom/Node.h:
* dom/TouchList.h:
(WebCore::TouchList::create):
(WebCore::TouchList::TouchList):
* html/DOMTokenList.cpp:
(WebCore::DOMTokenList::add):
(WebCore::DOMTokenList::remove):
* html/DOMTokenList.h:
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):
* html/HTMLCanvasElement.h:
* html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::getContext):
* html/OffscreenCanvas.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::setTimeout):
(WebCore::DOMWindow::setInterval):
* page/DOMWindow.h:
* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::importScripts):
* workers/DedicatedWorkerGlobalScope.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::setTimeout):
(WebCore::WorkerGlobalScope::setInterval):
(WebCore::WorkerGlobalScope::importScripts):
* workers/WorkerGlobalScope.h:

Source/WebKit:

Add / remove tokens one by one because there is no way to retrieve
the size of va_list in advance so we could construct a FixedVector.

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
(webkit_dom_dom_token_list_add):
(webkit_dom_dom_token_list_remove):

Source/WTF:

Introduce std::initializer_list constructor for FixedVector and a WTF::map() overload.

* wtf/FixedVector.h:
(WTF::FixedVector::FixedVector):
(WTF::map):
* wtf/VectorTraits.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (287293 => 287294)


--- trunk/Source/WTF/ChangeLog	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WTF/ChangeLog	2021-12-21 02:25:46 UTC (rev 287294)
@@ -1,3 +1,17 @@
+2021-12-20  Alexey Shvayka  <ashva...@apple.com>
+
+        [WebIDL] convertVariadicArguments() should return a FixedVector
+        https://bugs.webkit.org/show_bug.cgi?id=232639
+
+        Reviewed by Yusuke Suzuki.
+
+        Introduce std::initializer_list constructor for FixedVector and a WTF::map() overload.
+
+        * wtf/FixedVector.h:
+        (WTF::FixedVector::FixedVector):
+        (WTF::map):
+        * wtf/VectorTraits.h:
+
 2021-12-20  Fujii Hironori  <hironori.fu...@sony.com>
 
         MSVC reports "wtf/RetainPtr.h(196): error C3861: 'CFAutorelease': identifier not found " with /permissive- on Windows

Modified: trunk/Source/WTF/wtf/FixedVector.h (287293 => 287294)


--- trunk/Source/WTF/wtf/FixedVector.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WTF/wtf/FixedVector.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -47,6 +47,16 @@
     { }
     FixedVector(FixedVector&& other) = default;
 
+    FixedVector(std::initializer_list<T> initializerList)
+        : m_storage(initializerList.size() ? Storage::create(initializerList.size()).moveToUniquePtr() : nullptr)
+    {
+        size_t index = 0;
+        for (const auto& element : initializerList) {
+            m_storage->at(index) = element;
+            index++;
+        }
+    }
+
     FixedVector& operator=(const FixedVector& other)
     {
         FixedVector tmp(other);
@@ -167,6 +177,20 @@
     a.swap(b);
 }
 
+template<typename T, typename MapFunction, typename ReturnType = typename std::invoke_result<MapFunction, const T&>::type>
+FixedVector<ReturnType> map(const FixedVector<T>& source, MapFunction&& mapFunction)
+{
+    FixedVector<ReturnType> result(source.size());
+
+    size_t resultIndex = 0;
+    for (const auto& item : source) {
+        result[resultIndex] = mapFunction(item);
+        resultIndex++;
+    }
+
+    return result;
+}
+
 } // namespace WTF
 
 using WTF::FixedVector;

Modified: trunk/Source/WTF/wtf/VectorTraits.h (287293 => 287294)


--- trunk/Source/WTF/wtf/VectorTraits.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WTF/wtf/VectorTraits.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -70,6 +70,7 @@
 
     template<typename P> struct VectorTraits<RefPtr<P>> : SimpleClassVectorTraits { };
     template<typename P> struct VectorTraits<std::unique_ptr<P>> : SimpleClassVectorTraits { };
+    template<typename P> struct VectorTraits<std::reference_wrapper<P>> : SimpleClassVectorTraits { };
     template<typename P> struct VectorTraits<Ref<P>> : SimpleClassVectorTraits { };
     template<> struct VectorTraits<AtomString> : SimpleClassVectorTraits { };
 

Modified: trunk/Source/WebCore/ChangeLog (287293 => 287294)


--- trunk/Source/WebCore/ChangeLog	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/ChangeLog	2021-12-21 02:25:46 UTC (rev 287294)
@@ -1,5 +1,121 @@
 2021-12-20  Alexey Shvayka  <ashva...@apple.com>
 
+        [WebIDL] convertVariadicArguments() should return a FixedVector
+        https://bugs.webkit.org/show_bug.cgi?id=232639
+
+        Reviewed by Yusuke Suzuki.
+
+        Since it's highly unlikely (CSSNumericArray is immutable) that we would need to
+        mutate variadic arguments before processing them or storing, and we know their size
+        upfront, it makes the most sense to save some memory by utilizing a FixedVector.
+
+        This patch reduces sizeof(ScheduledAction) by 8, enabling memory-neutral addition
+        of a field like m_incumbentGlobalObject.
+
+        No new tests, no behavior change.
+
+        * Modules/mediastream/PeerConnectionBackend.cpp:
+        (WebCore::PeerConnectionBackend::addTrack):
+        * Modules/mediastream/PeerConnectionBackend.h:
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::addTrack):
+        * Modules/mediastream/RTCPeerConnection.h:
+        * Modules/mediastream/RTCRtpSender.cpp:
+        (WebCore::RTCRtpSender::setStreams):
+        (WebCore::RTCRtpSender::setMediaStreamIds):
+        * Modules/mediastream/RTCRtpSender.h:
+        * Modules/mediastream/RTCRtpSenderBackend.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+        (WebCore::LibWebRTCMediaEndpoint::addTrack):
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
+        (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
+        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+        (WebCore::LibWebRTCRtpSenderBackend::setMediaStreamIds):
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
+        * bindings/js/JSDOMConvertVariadic.h:
+        (WebCore::convertVariadicArguments):
+        * bindings/js/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::addArguments):
+        * bindings/js/ScheduledAction.h:
+        * css/typedom/CSSNumericValue.cpp:
+        (WebCore::CSSNumericValue::add):
+        (WebCore::CSSNumericValue::sub):
+        (WebCore::CSSNumericValue::mul):
+        (WebCore::CSSNumericValue::div):
+        (WebCore::CSSNumericValue::min):
+        (WebCore::CSSNumericValue::max):
+        (WebCore::CSSNumericValue::equals):
+        (WebCore::CSSNumericValue::toSum):
+        * css/typedom/CSSNumericValue.h:
+        * css/typedom/numeric/CSSMathMax.cpp:
+        (WebCore::CSSMathMax::create):
+        (WebCore::CSSMathMax::CSSMathMax):
+        * css/typedom/numeric/CSSMathMax.h:
+        * css/typedom/numeric/CSSMathMin.cpp:
+        (WebCore::CSSMathMin::create):
+        (WebCore::CSSMathMin::CSSMathMin):
+        * css/typedom/numeric/CSSMathMin.h:
+        * css/typedom/numeric/CSSMathProduct.cpp:
+        (WebCore::CSSMathProduct::create):
+        (WebCore::CSSMathProduct::CSSMathProduct):
+        * css/typedom/numeric/CSSMathProduct.h:
+        * css/typedom/numeric/CSSMathSum.cpp:
+        (WebCore::CSSMathSum::create):
+        (WebCore::CSSMathSum::CSSMathSum):
+        * css/typedom/numeric/CSSMathSum.h:
+        * css/typedom/numeric/CSSNumericArray.cpp:
+        (WebCore::CSSNumericArray::create):
+        (WebCore::CSSNumericArray::CSSNumericArray):
+        * css/typedom/numeric/CSSNumericArray.h:
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::append):
+        (WebCore::ContainerNode::prepend):
+        (WebCore::ContainerNode::replaceChildren):
+        * dom/ContainerNode.h:
+        * dom/Document.cpp:
+        (WebCore::Document::write):
+        (WebCore::Document::writeln):
+        * dom/Document.h:
+        * dom/DocumentTouch.cpp:
+        (WebCore::DocumentTouch::createTouchList):
+        * dom/DocumentTouch.h:
+        * dom/Node.cpp:
+        (WebCore::nodeSetPreTransformedFromNodeOrStringVector):
+        (WebCore::Node::convertNodesOrStringsIntoNode):
+        (WebCore::Node::before):
+        (WebCore::Node::after):
+        (WebCore::Node::replaceWith):
+        * dom/Node.h:
+        * dom/TouchList.h:
+        (WebCore::TouchList::create):
+        (WebCore::TouchList::TouchList):
+        * html/DOMTokenList.cpp:
+        (WebCore::DOMTokenList::add):
+        (WebCore::DOMTokenList::remove):
+        * html/DOMTokenList.h:
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::getContext):
+        * html/HTMLCanvasElement.h:
+        * html/OffscreenCanvas.cpp:
+        (WebCore::OffscreenCanvas::getContext):
+        * html/OffscreenCanvas.h:
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::setTimeout):
+        (WebCore::DOMWindow::setInterval):
+        * page/DOMWindow.h:
+        * workers/DedicatedWorkerGlobalScope.cpp:
+        (WebCore::DedicatedWorkerGlobalScope::importScripts):
+        * workers/DedicatedWorkerGlobalScope.h:
+        * workers/WorkerGlobalScope.cpp:
+        (WebCore::WorkerGlobalScope::setTimeout):
+        (WebCore::WorkerGlobalScope::setInterval):
+        (WebCore::WorkerGlobalScope::importScripts):
+        * workers/WorkerGlobalScope.h:
+
+2021-12-20  Alexey Shvayka  <ashva...@apple.com>
+
         Introduce a fast path for replacing an attribute event listener
         https://bugs.webkit.org/show_bug.cgi?id=234441
 

Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -414,7 +414,7 @@
     m_peerConnection.updateNegotiationNeededFlag(eventId);
 }
 
-ExceptionOr<Ref<RTCRtpSender>> PeerConnectionBackend::addTrack(MediaStreamTrack&, Vector<String>&&)
+ExceptionOr<Ref<RTCRtpSender>> PeerConnectionBackend::addTrack(MediaStreamTrack&, FixedVector<String>&&)
 {
     return Exception { NotSupportedError, "Not implemented"_s };
 }

Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -39,6 +39,7 @@
 #include "RTCRtpSendParameters.h"
 #include "RTCSessionDescription.h"
 #include "RTCSignalingState.h"
+#include <wtf/FixedVector.h>
 #include <wtf/LoggerHelper.h>
 #include <wtf/WeakPtr.h>
 
@@ -114,7 +115,7 @@
     virtual void getStats(RTCRtpSender&, Ref<DeferredPromise>&&) = 0;
     virtual void getStats(RTCRtpReceiver&, Ref<DeferredPromise>&&) = 0;
 
-    virtual ExceptionOr<Ref<RTCRtpSender>> addTrack(MediaStreamTrack&, Vector<String>&&);
+    virtual ExceptionOr<Ref<RTCRtpSender>> addTrack(MediaStreamTrack&, FixedVector<String>&&);
     virtual void removeTrack(RTCRtpSender&) { }
 
     virtual ExceptionOr<Ref<RTCRtpTransceiver>> addTransceiver(const String&, const RTCRtpTransceiverInit&);

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -131,7 +131,7 @@
     stop();
 }
 
-ExceptionOr<Ref<RTCRtpSender>> RTCPeerConnection::addTrack(Ref<MediaStreamTrack>&& track, const Vector<std::reference_wrapper<MediaStream>>& streams)
+ExceptionOr<Ref<RTCRtpSender>> RTCPeerConnection::addTrack(Ref<MediaStreamTrack>&& track, const FixedVector<std::reference_wrapper<MediaStream>>& streams)
 {
     INFO_LOG(LOGIDENTIFIER);
 
@@ -143,11 +143,9 @@
             return Exception { InvalidAccessError };
     }
 
-    Vector<String> mediaStreamIds;
-    for (auto stream : streams)
-        mediaStreamIds.append(stream.get().id());
-
-    return m_backend->addTrack(track.get(), WTFMove(mediaStreamIds));
+    return m_backend->addTrack(track.get(), WTF::map(streams, [](auto& stream) -> String {
+        return stream.get().id();
+    }));
 }
 
 ExceptionOr<void> RTCPeerConnection::removeTrack(RTCRtpSender& sender)

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -148,7 +148,7 @@
 
     const Vector<RefPtr<RTCRtpTransceiver>>& currentTransceivers() const { return m_transceiverSet.list(); }
 
-    ExceptionOr<Ref<RTCRtpSender>> addTrack(Ref<MediaStreamTrack>&&, const Vector<std::reference_wrapper<MediaStream>>&);
+    ExceptionOr<Ref<RTCRtpSender>> addTrack(Ref<MediaStreamTrack>&&, const FixedVector<std::reference_wrapper<MediaStream>>&);
     ExceptionOr<void> removeTrack(RTCRtpSender&);
 
     using AddTransceiverTrackOrKind = std::variant<RefPtr<MediaStreamTrack>, String>;

Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -162,7 +162,7 @@
     return m_backend->setParameters(parameters, WTFMove(promise));
 }
 
-ExceptionOr<void> RTCRtpSender::setStreams(const Vector<std::reference_wrapper<MediaStream>>& streams)
+ExceptionOr<void> RTCRtpSender::setStreams(const FixedVector<std::reference_wrapper<MediaStream>>& streams)
 {
     return setMediaStreamIds(WTF::map(streams, [](auto& stream) -> String {
         return stream.get().id();
@@ -169,7 +169,7 @@
     }));
 }
 
-ExceptionOr<void> RTCRtpSender::setMediaStreamIds(const Vector<String>& streamIds)
+ExceptionOr<void> RTCRtpSender::setMediaStreamIds(const FixedVector<String>& streamIds)
 {
     if (!m_connection || m_connection->isClosed() || !m_backend)
         return Exception { InvalidStateError, "connection is closed"_s };

Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.h (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpSender.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -71,8 +71,8 @@
     const String& trackId() const { return m_trackId; }
     const String& trackKind() const { return m_trackKind; }
 
-    ExceptionOr<void> setMediaStreamIds(const Vector<String>&);
-    ExceptionOr<void> setStreams(const Vector<std::reference_wrapper<MediaStream>>&);
+    ExceptionOr<void> setMediaStreamIds(const FixedVector<String>&);
+    ExceptionOr<void> setStreams(const FixedVector<std::reference_wrapper<MediaStream>>&);
 
     bool isStopped() const { return !m_backend; }
     void stop();

Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpSenderBackend.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -26,8 +26,8 @@
 
 #if ENABLE(WEB_RTC)
 
+#include <wtf/FixedVector.h>
 #include <wtf/Forward.h>
-#include <wtf/Vector.h>
 
 namespace WebCore {
 
@@ -51,7 +51,7 @@
     virtual void setParameters(const RTCRtpSendParameters&, DOMPromiseDeferred<void>&&) = 0;
     virtual std::unique_ptr<RTCDTMFSenderBackend> createDTMFBackend() = 0;
     virtual Ref<RTCRtpTransformBackend> rtcRtpTransformBackend() = 0;
-    virtual void setMediaStreamIds(const Vector<String>&) = 0;
+    virtual void setMediaStreamIds(const FixedVector<String>&) = 0;
     virtual std::unique_ptr<RTCDtlsTransportBackend> dtlsTransportBackend() = 0;
 };
 

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -185,7 +185,7 @@
     startLoggingStats();
 }
 
-bool LibWebRTCMediaEndpoint::addTrack(LibWebRTCRtpSenderBackend& sender, MediaStreamTrack& track, const Vector<String>& mediaStreamIds)
+bool LibWebRTCMediaEndpoint::addTrack(LibWebRTCRtpSenderBackend& sender, MediaStreamTrack& track, const FixedVector<String>& mediaStreamIds)
 {
     ASSERT(m_backend);
 

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -96,7 +96,7 @@
     void stop();
     bool isStopped() const { return !m_backend; }
 
-    bool addTrack(LibWebRTCRtpSenderBackend&, MediaStreamTrack&, const Vector<String>&);
+    bool addTrack(LibWebRTCRtpSenderBackend&, MediaStreamTrack&, const FixedVector<String>&);
     void removeTrack(LibWebRTCRtpSenderBackend&);
 
     struct Backends {

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -322,7 +322,7 @@
     return nullptr;
 }
 
-ExceptionOr<Ref<RTCRtpSender>> LibWebRTCPeerConnectionBackend::addTrack(MediaStreamTrack& track, Vector<String>&& mediaStreamIds)
+ExceptionOr<Ref<RTCRtpSender>> LibWebRTCPeerConnectionBackend::addTrack(MediaStreamTrack& track, FixedVector<String>&& mediaStreamIds)
 {
     auto senderBackend = makeUnique<LibWebRTCRtpSenderBackend>(*this, nullptr);
     if (!m_endpoint->addTrack(*senderBackend, track, mediaStreamIds))

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -83,7 +83,7 @@
 
     void getStatsSucceeded(const DeferredPromise&, Ref<RTCStatsReport>&&);
 
-    ExceptionOr<Ref<RTCRtpSender>> addTrack(MediaStreamTrack&, Vector<String>&&) final;
+    ExceptionOr<Ref<RTCRtpSender>> addTrack(MediaStreamTrack&, FixedVector<String>&&) final;
     void removeTrack(RTCRtpSender&) final;
 
     ExceptionOr<Ref<RTCRtpTransceiver>> addTransceiver(const String&, const RTCRtpTransceiverInit&) final;

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


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -163,7 +163,7 @@
     return backend ? makeUnique<LibWebRTCDtlsTransportBackend>(WTFMove(backend)) : nullptr;
 }
 
-void LibWebRTCRtpSenderBackend::setMediaStreamIds(const Vector<String>& streamIds)
+void LibWebRTCRtpSenderBackend::setMediaStreamIds(const FixedVector<String>& streamIds)
 {
     std::vector<std::string> ids;
     for (auto& id : streamIds)

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h (287293 => 287294)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -67,7 +67,7 @@
     std::unique_ptr<RTCDTMFSenderBackend> createDTMFBackend() final;
     Ref<RTCRtpTransformBackend> rtcRtpTransformBackend() final;
     std::unique_ptr<RTCDtlsTransportBackend> dtlsTransportBackend() final;
-    void setMediaStreamIds(const Vector<String>&) final;
+    void setMediaStreamIds(const FixedVector<String>&) final;
 
     void startSource();
     void stopSource();

Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertVariadic.h (287293 => 287294)


--- trunk/Source/WebCore/bindings/js/JSDOMConvertVariadic.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertVariadic.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -27,6 +27,7 @@
 
 #include "IDLTypes.h"
 #include "JSDOMConvertBase.h"
+#include <wtf/FixedVector.h>
 
 namespace WebCore {
 
@@ -46,7 +47,7 @@
     }
 };
 
-template<typename IDLType> Vector<typename VariadicConverter<IDLType>::Item> convertVariadicArguments(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame& callFrame, size_t startIndex)
+template<typename IDLType> FixedVector<typename VariadicConverter<IDLType>::Item> convertVariadicArguments(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame& callFrame, size_t startIndex)
 {
     auto& vm = JSC::getVM(&lexicalGlobalObject);
     auto scope = DECLARE_THROW_SCOPE(vm);
@@ -55,15 +56,16 @@
     if (startIndex >= length)
         return { };
 
-    Vector<typename VariadicConverter<IDLType>::Item> result;
-    result.reserveInitialCapacity(length - startIndex);
+    FixedVector<typename VariadicConverter<IDLType>::Item> result(length - startIndex);
 
+    size_t resultIndex = 0;
     for (size_t i = startIndex; i < length; ++i) {
         auto value = VariadicConverter<IDLType>::convert(lexicalGlobalObject, callFrame.uncheckedArgument(i));
         EXCEPTION_ASSERT_UNUSED(scope, !!scope.exception() == !value);
         if (!value)
             return { };
-        result.uncheckedAppend(WTFMove(*value));
+        result[resultIndex] = WTFMove(*value);
+        resultIndex++;
     }
 
     return result;

Modified: trunk/Source/WebCore/bindings/js/ScheduledAction.cpp (287293 => 287294)


--- trunk/Source/WebCore/bindings/js/ScheduledAction.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/bindings/js/ScheduledAction.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -70,7 +70,7 @@
 
 ScheduledAction::~ScheduledAction() = default;
 
-void ScheduledAction::addArguments(Vector<JSC::Strong<JSC::Unknown>>&& arguments)
+void ScheduledAction::addArguments(FixedVector<JSC::Strong<JSC::Unknown>>&& arguments)
 {
     m_arguments = WTFMove(arguments);
 }

Modified: trunk/Source/WebCore/bindings/js/ScheduledAction.h (287293 => 287294)


--- trunk/Source/WebCore/bindings/js/ScheduledAction.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/bindings/js/ScheduledAction.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -22,7 +22,6 @@
 #include <_javascript_Core/Strong.h>
 #include <_javascript_Core/StrongInlines.h>
 #include <memory>
-#include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
 namespace JSC {
@@ -43,7 +42,7 @@
     static std::unique_ptr<ScheduledAction> create(DOMWrapperWorld&, String&&);
     ~ScheduledAction();
 
-    void addArguments(Vector<JSC::Strong<JSC::Unknown>>&&);
+    void addArguments(FixedVector<JSC::Strong<JSC::Unknown>>&&);
 
     enum class Type { Code, Function };
     Type type() const;
@@ -60,7 +59,7 @@
 
     Ref<DOMWrapperWorld> m_isolatedWorld;
     JSC::Strong<JSC::Unknown> m_function;
-    Vector<JSC::Strong<JSC::Unknown>> m_arguments;
+    FixedVector<JSC::Strong<JSC::Unknown>> m_arguments;
     String m_code;
 };
 

Modified: trunk/Source/WebCore/css/typedom/CSSNumericValue.cpp (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/CSSNumericValue.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/CSSNumericValue.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -44,7 +44,7 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(CSSNumericValue);
 
-Ref<CSSNumericValue> CSSNumericValue::add(Vector<CSSNumberish>&& values)
+Ref<CSSNumericValue> CSSNumericValue::add(FixedVector<CSSNumberish>&& values)
 {
     UNUSED_PARAM(values);
     // FIXME: add impl.
@@ -52,7 +52,7 @@
     return *this;
 }
 
-Ref<CSSNumericValue> CSSNumericValue::sub(Vector<CSSNumberish>&& values)
+Ref<CSSNumericValue> CSSNumericValue::sub(FixedVector<CSSNumberish>&& values)
 {
     UNUSED_PARAM(values);
     // FIXME: add impl.
@@ -60,7 +60,7 @@
     return *this;
 }
 
-Ref<CSSNumericValue> CSSNumericValue::mul(Vector<CSSNumberish>&& values)
+Ref<CSSNumericValue> CSSNumericValue::mul(FixedVector<CSSNumberish>&& values)
 {
     UNUSED_PARAM(values);
     // FIXME: add impl.
@@ -68,7 +68,7 @@
     return *this;
 }
 
-Ref<CSSNumericValue> CSSNumericValue::div(Vector<CSSNumberish>&& values)
+Ref<CSSNumericValue> CSSNumericValue::div(FixedVector<CSSNumberish>&& values)
 {
     UNUSED_PARAM(values);
     // FIXME: add impl.
@@ -75,7 +75,7 @@
 
     return *this;
 }
-Ref<CSSNumericValue> CSSNumericValue::min(Vector<CSSNumberish>&& values)
+Ref<CSSNumericValue> CSSNumericValue::min(FixedVector<CSSNumberish>&& values)
 {
     UNUSED_PARAM(values);
     // FIXME: add impl.
@@ -82,7 +82,7 @@
 
     return *this;
 }
-Ref<CSSNumericValue> CSSNumericValue::max(Vector<CSSNumberish>&& values)
+Ref<CSSNumericValue> CSSNumericValue::max(FixedVector<CSSNumberish>&& values)
 {
     UNUSED_PARAM(values);
     // FIXME: add impl.
@@ -100,7 +100,7 @@
     });
 }
 
-bool CSSNumericValue::equals(Vector<CSSNumberish>&& value)
+bool CSSNumericValue::equals(FixedVector<CSSNumberish>&& value)
 {
     UNUSED_PARAM(value);
     // https://drafts.css-houdini.org/css-typed-om/#dom-cssnumericvalue-equals
@@ -116,7 +116,7 @@
     return CSSUnitValue::create(1.0, "number");
 }
 
-Ref<CSSMathSum> CSSNumericValue::toSum(Vector<String>&& units)
+Ref<CSSMathSum> CSSNumericValue::toSum(FixedVector<String>&& units)
 {
     UNUSED_PARAM(units);
     // https://drafts.css-houdini.org/css-typed-om/#dom-cssnumericvalue-tosum

Modified: trunk/Source/WebCore/css/typedom/CSSNumericValue.h (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/CSSNumericValue.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/CSSNumericValue.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -29,6 +29,7 @@
 
 #include "CSSStyleValue.h"
 #include <variant>
+#include <wtf/FixedVector.h>
 
 namespace WebCore {
 
@@ -44,17 +45,17 @@
 public:
     using CSSNumberish = std::variant<double, RefPtr<CSSNumericValue>>;
 
-    Ref<CSSNumericValue> add(Vector<CSSNumberish>&&);
-    Ref<CSSNumericValue> sub(Vector<CSSNumberish>&&);
-    Ref<CSSNumericValue> mul(Vector<CSSNumberish>&&);
-    Ref<CSSNumericValue> div(Vector<CSSNumberish>&&);
-    Ref<CSSNumericValue> min(Vector<CSSNumberish>&&);
-    Ref<CSSNumericValue> max(Vector<CSSNumberish>&&);
+    Ref<CSSNumericValue> add(FixedVector<CSSNumberish>&&);
+    Ref<CSSNumericValue> sub(FixedVector<CSSNumberish>&&);
+    Ref<CSSNumericValue> mul(FixedVector<CSSNumberish>&&);
+    Ref<CSSNumericValue> div(FixedVector<CSSNumberish>&&);
+    Ref<CSSNumericValue> min(FixedVector<CSSNumberish>&&);
+    Ref<CSSNumericValue> max(FixedVector<CSSNumberish>&&);
     
-    bool equals(Vector<CSSNumberish>&&);
+    bool equals(FixedVector<CSSNumberish>&&);
     
     Ref<CSSUnitValue> to(String&&);
-    Ref<CSSMathSum> toSum(Vector<String>&&);
+    Ref<CSSMathSum> toSum(FixedVector<String>&&);
     CSSNumericType type();
     
     static ExceptionOr<Ref<CSSNumericValue>> parse(String&&);

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSMathMax.cpp (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSMathMax.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSMathMax.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -36,12 +36,12 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(CSSMathMax);
 
-Ref<CSSMathMax> CSSMathMax::create(Vector<CSSNumberish>&& numberishes)
+Ref<CSSMathMax> CSSMathMax::create(FixedVector<CSSNumberish>&& numberishes)
 {
     return adoptRef(*new CSSMathMax(WTFMove(numberishes)));
 }
 
-CSSMathMax::CSSMathMax(Vector<CSSNumberish>&& numberishes)
+CSSMathMax::CSSMathMax(FixedVector<CSSNumberish>&& numberishes)
     : CSSMathValue(CSSMathOperator::Max)
     , m_values(CSSNumericArray::create(WTFMove(numberishes)))
 {

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSMathMax.h (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSMathMax.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSMathMax.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -37,11 +37,11 @@
 class CSSMathMax : public CSSMathValue {
     WTF_MAKE_ISO_ALLOCATED(CSSMathMax);
 public:
-    static Ref<CSSMathMax> create(Vector<CSSNumberish>&&);
+    static Ref<CSSMathMax> create(FixedVector<CSSNumberish>&&);
     const CSSNumericArray& values() const;
     
 private:
-    CSSMathMax(Vector<CSSNumberish>&&);
+    CSSMathMax(FixedVector<CSSNumberish>&&);
     Ref<CSSNumericArray> m_values;
 };
 

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSMathMin.cpp (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSMathMin.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSMathMin.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -36,12 +36,12 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(CSSMathMin);
 
-Ref<CSSMathMin> CSSMathMin::create(Vector<CSSNumberish>&& numberishes)
+Ref<CSSMathMin> CSSMathMin::create(FixedVector<CSSNumberish>&& numberishes)
 {
     return adoptRef(*new CSSMathMin(WTFMove(numberishes)));
 }
 
-CSSMathMin::CSSMathMin(Vector<CSSNumberish>&& numberishes)
+CSSMathMin::CSSMathMin(FixedVector<CSSNumberish>&& numberishes)
     : CSSMathValue(CSSMathOperator::Min)
     , m_values(CSSNumericArray::create(WTFMove(numberishes)))
 {

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSMathMin.h (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSMathMin.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSMathMin.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -37,11 +37,11 @@
 class CSSMathMin : public CSSMathValue {
     WTF_MAKE_ISO_ALLOCATED(CSSMathMin);
 public:
-    static Ref<CSSMathMin> create(Vector<CSSNumberish>&&);
+    static Ref<CSSMathMin> create(FixedVector<CSSNumberish>&&);
     const CSSNumericArray& values() const;
     
 private:
-    CSSMathMin(Vector<CSSNumberish>&&);
+    CSSMathMin(FixedVector<CSSNumberish>&&);
     Ref<CSSNumericArray> m_values;
 };
 

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.cpp (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -36,12 +36,12 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(CSSMathProduct);
 
-Ref<CSSMathProduct> CSSMathProduct::create(Vector<CSSNumberish>&& numberishes)
+Ref<CSSMathProduct> CSSMathProduct::create(FixedVector<CSSNumberish>&& numberishes)
 {
     return adoptRef(*new CSSMathProduct(WTFMove(numberishes)));
 }
 
-CSSMathProduct::CSSMathProduct(Vector<CSSNumberish>&& numberishes)
+CSSMathProduct::CSSMathProduct(FixedVector<CSSNumberish>&& numberishes)
     : CSSMathValue(CSSMathOperator::Product)
     , m_values(CSSNumericArray::create(WTFMove(numberishes)))
 {

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.h (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSMathProduct.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -37,13 +37,13 @@
 class CSSMathProduct : public CSSMathValue {
     WTF_MAKE_ISO_ALLOCATED(CSSMathProduct);
 public:
-    static Ref<CSSMathProduct> create(Vector<CSSNumberish>&&);
+    static Ref<CSSMathProduct> create(FixedVector<CSSNumberish>&&);
     const CSSNumericArray& values() const;
     
     CSSMathOperator getOperator() const final { return CSSMathOperator::Product; }
 
 private:
-    CSSMathProduct(Vector<CSSNumberish>&&);
+    CSSMathProduct(FixedVector<CSSNumberish>&&);
     Ref<CSSNumericArray> m_values;
 };
 

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSMathSum.cpp (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSMathSum.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSMathSum.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -36,12 +36,12 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(CSSMathSum);
 
-Ref<CSSMathSum> CSSMathSum::create(Vector<CSSNumberish>&& numberishes)
+Ref<CSSMathSum> CSSMathSum::create(FixedVector<CSSNumberish>&& numberishes)
 {
     return adoptRef(*new CSSMathSum(WTFMove(numberishes)));
 }
 
-CSSMathSum::CSSMathSum(Vector<CSSNumberish>&& numberishes)
+CSSMathSum::CSSMathSum(FixedVector<CSSNumberish>&& numberishes)
     : CSSMathValue(CSSMathOperator::Sum)
     , m_values(CSSNumericArray::create(WTFMove(numberishes)))
 {

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSMathSum.h (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSMathSum.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSMathSum.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -38,11 +38,11 @@
 class CSSMathSum : public CSSMathValue {
     WTF_MAKE_ISO_ALLOCATED(CSSMathSum);
 public:
-    static Ref<CSSMathSum> create(Vector<CSSNumberish>&&);
+    static Ref<CSSMathSum> create(FixedVector<CSSNumberish>&&);
     const CSSNumericArray& values() const;
 
 private:
-    CSSMathSum(Vector<CSSNumberish>&&);
+    CSSMathSum(FixedVector<CSSNumberish>&&);
     Ref<CSSNumericArray> m_values;
 };
 

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSNumericArray.cpp (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSNumericArray.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSNumericArray.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -38,22 +38,19 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(CSSNumericArray);
 
-Ref<CSSNumericArray> CSSNumericArray::create(Vector<CSSNumberish>&& numberishes)
+Ref<CSSNumericArray> CSSNumericArray::create(const FixedVector<CSSNumberish>& numberishes)
 {
-    Vector<Ref<CSSNumericValue>> values;
-    values.reserveInitialCapacity(numberishes.size());
-    for (auto&& numberish : numberishes)
-        values.uncheckedAppend(CSSNumericValue::rectifyNumberish(WTFMove(numberish)));
-    
-    return adoptRef(*new CSSNumericArray(WTFMove(values)));
+    return adoptRef(*new CSSNumericArray(WTF::map(numberishes, [](auto& numberish) -> Ref<CSSNumericValue> {
+        return CSSNumericValue::rectifyNumberish(const_cast<CSSNumberish&&>(numberish));
+    })));
 }
 
-Ref<CSSNumericArray> CSSNumericArray::create(Vector<Ref<CSSNumericValue>>&& values)
+Ref<CSSNumericArray> CSSNumericArray::create(FixedVector<Ref<CSSNumericValue>>&& values)
 {
     return adoptRef(*new CSSNumericArray(WTFMove(values)));
 }
 
-CSSNumericArray::CSSNumericArray(Vector<Ref<CSSNumericValue>>&& values)
+CSSNumericArray::CSSNumericArray(FixedVector<Ref<CSSNumericValue>>&& values)
     : m_array(WTFMove(values))
 {
 }

Modified: trunk/Source/WebCore/css/typedom/numeric/CSSNumericArray.h (287293 => 287294)


--- trunk/Source/WebCore/css/typedom/numeric/CSSNumericArray.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/css/typedom/numeric/CSSNumericArray.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -40,14 +40,14 @@
 class CSSNumericArray : public RefCounted<CSSNumericArray> {
     WTF_MAKE_ISO_ALLOCATED(CSSNumericArray);
 public:
-    static Ref<CSSNumericArray> create(Vector<CSSNumberish>&&);
-    static Ref<CSSNumericArray> create(Vector<Ref<CSSNumericValue>>&&);
+    static Ref<CSSNumericArray> create(const FixedVector<CSSNumberish>&);
+    static Ref<CSSNumericArray> create(FixedVector<Ref<CSSNumericValue>>&&);
     size_t length() const { return m_array.size(); };
     ExceptionOr<Ref<CSSNumericValue>> item(size_t index);
 
 private:
-    Vector<Ref<CSSNumericValue>> m_array;
-    CSSNumericArray(Vector<Ref<CSSNumericValue>>&&);
+    FixedVector<Ref<CSSNumericValue>> m_array;
+    CSSNumericArray(FixedVector<Ref<CSSNumericValue>>&&);
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (287293 => 287294)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -1000,7 +1000,7 @@
     return std::distance(children.begin(), { });
 }
 
-ExceptionOr<void> ContainerNode::append(Vector<NodeOrString>&& vector)
+ExceptionOr<void> ContainerNode::append(FixedVector<NodeOrString>&& vector)
 {
     auto result = convertNodesOrStringsIntoNode(WTFMove(vector));
     if (result.hasException())
@@ -1013,7 +1013,7 @@
     return appendChild(*node);
 }
 
-ExceptionOr<void> ContainerNode::prepend(Vector<NodeOrString>&& vector)
+ExceptionOr<void> ContainerNode::prepend(FixedVector<NodeOrString>&& vector)
 {
     auto result = convertNodesOrStringsIntoNode(WTFMove(vector));
     if (result.hasException())
@@ -1027,7 +1027,7 @@
 }
 
 // https://dom.spec.whatwg.org/#dom-parentnode-replacechildren
-ExceptionOr<void> ContainerNode::replaceChildren(Vector<NodeOrString>&& vector)
+ExceptionOr<void> ContainerNode::replaceChildren(FixedVector<NodeOrString>&& vector)
 {
     // step 1
     auto result = convertNodesOrStringsIntoNode(WTFMove(vector));

Modified: trunk/Source/WebCore/dom/ContainerNode.h (287293 => 287294)


--- trunk/Source/WebCore/dom/ContainerNode.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -129,10 +129,10 @@
     WEBCORE_EXPORT Element* firstElementChild() const;
     WEBCORE_EXPORT Element* lastElementChild() const;
     WEBCORE_EXPORT unsigned childElementCount() const;
-    ExceptionOr<void> append(Vector<NodeOrString>&&);
-    ExceptionOr<void> prepend(Vector<NodeOrString>&&);
+    ExceptionOr<void> append(FixedVector<NodeOrString>&&);
+    ExceptionOr<void> prepend(FixedVector<NodeOrString>&&);
 
-    ExceptionOr<void> replaceChildren(Vector<NodeOrString>&&);
+    ExceptionOr<void> replaceChildren(FixedVector<NodeOrString>&&);
 
     ExceptionOr<void> ensurePreInsertionValidity(Node& newChild, Node* refChild);
 

Modified: trunk/Source/WebCore/dom/Document.cpp (287293 => 287294)


--- trunk/Source/WebCore/dom/Document.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/dom/Document.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -3337,7 +3337,7 @@
     return { };
 }
 
-ExceptionOr<void> Document::write(Document* entryDocument, Vector<String>&& strings)
+ExceptionOr<void> Document::write(Document* entryDocument, FixedVector<String>&& strings)
 {
     if (!isHTMLDocument() || m_throwOnDynamicMarkupInsertionCount)
         return Exception { InvalidStateError };
@@ -3349,7 +3349,7 @@
     return write(entryDocument, WTFMove(text));
 }
 
-ExceptionOr<void> Document::writeln(Document* entryDocument, Vector<String>&& strings)
+ExceptionOr<void> Document::writeln(Document* entryDocument, FixedVector<String>&& strings)
 {
     if (!isHTMLDocument() || m_throwOnDynamicMarkupInsertionCount)
         return Exception { InvalidStateError };

Modified: trunk/Source/WebCore/dom/Document.h (287293 => 287294)


--- trunk/Source/WebCore/dom/Document.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/dom/Document.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -57,6 +57,7 @@
 #include "ViewportArguments.h"
 #include "VisibilityState.h"
 #include <wtf/Deque.h>
+#include <wtf/FixedVector.h>
 #include <wtf/Forward.h>
 #include <wtf/HashCountedSet.h>
 #include <wtf/HashSet.h>
@@ -693,8 +694,8 @@
     void cancelParsing();
 
     ExceptionOr<void> write(Document* entryDocument, SegmentedString&&);
-    WEBCORE_EXPORT ExceptionOr<void> write(Document* entryDocument, Vector<String>&&);
-    WEBCORE_EXPORT ExceptionOr<void> writeln(Document* entryDocument, Vector<String>&&);
+    WEBCORE_EXPORT ExceptionOr<void> write(Document* entryDocument, FixedVector<String>&&);
+    WEBCORE_EXPORT ExceptionOr<void> writeln(Document* entryDocument, FixedVector<String>&&);
 
     bool wellFormed() const { return m_wellFormed; }
 

Modified: trunk/Source/WebCore/dom/DocumentTouch.cpp (287293 => 287294)


--- trunk/Source/WebCore/dom/DocumentTouch.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/dom/DocumentTouch.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -51,7 +51,7 @@
     return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force);
 }
 
-Ref<TouchList> DocumentTouch::createTouchList(Document&, Vector<std::reference_wrapper<Touch>>&& touches)
+Ref<TouchList> DocumentTouch::createTouchList(Document&, FixedVector<std::reference_wrapper<Touch>>&& touches)
 {
     return TouchList::create(WTFMove(touches));
 }

Modified: trunk/Source/WebCore/dom/DocumentTouch.h (287293 => 287294)


--- trunk/Source/WebCore/dom/DocumentTouch.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/dom/DocumentTouch.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -30,6 +30,7 @@
 #elif ENABLE(TOUCH_EVENTS)
 
 #include <functional>
+#include <wtf/FixedVector.h>
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -43,7 +44,7 @@
 class DocumentTouch {
 public:
     static Ref<Touch> createTouch(Document&, RefPtr<WindowProxy>&&, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force);
-    static Ref<TouchList> createTouchList(Document&, Vector<std::reference_wrapper<Touch>>&&);
+    static Ref<TouchList> createTouchList(Document&, FixedVector<std::reference_wrapper<Touch>>&&);
 };
 
 }

Modified: trunk/Source/WebCore/dom/Node.cpp (287293 => 287294)


--- trunk/Source/WebCore/dom/Node.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/dom/Node.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -513,7 +513,7 @@
     return downcast<ContainerNode>(*this).appendChild(newChild);
 }
 
-static HashSet<RefPtr<Node>> nodeSetPreTransformedFromNodeOrStringVector(const Vector<NodeOrString>& vector)
+static HashSet<RefPtr<Node>> nodeSetPreTransformedFromNodeOrStringVector(const FixedVector<NodeOrString>& vector)
 {
     HashSet<RefPtr<Node>> nodeSet;
     for (const auto& variant : vector) {
@@ -543,7 +543,7 @@
     return nullptr;
 }
 
-ExceptionOr<RefPtr<Node>> Node::convertNodesOrStringsIntoNode(Vector<NodeOrString>&& nodeOrStringVector)
+ExceptionOr<RefPtr<Node>> Node::convertNodesOrStringsIntoNode(FixedVector<NodeOrString>&& nodeOrStringVector)
 {
     if (nodeOrStringVector.isEmpty())
         return nullptr;
@@ -569,7 +569,7 @@
     return RefPtr<Node> { WTFMove(nodeToReturn) };
 }
 
-ExceptionOr<void> Node::before(Vector<NodeOrString>&& nodeOrStringVector)
+ExceptionOr<void> Node::before(FixedVector<NodeOrString>&& nodeOrStringVector)
 {
     RefPtr<ContainerNode> parent = parentNode();
     if (!parent)
@@ -593,7 +593,7 @@
     return parent->insertBefore(*node, viablePreviousSibling.get());
 }
 
-ExceptionOr<void> Node::after(Vector<NodeOrString>&& nodeOrStringVector)
+ExceptionOr<void> Node::after(FixedVector<NodeOrString>&& nodeOrStringVector)
 {
     RefPtr<ContainerNode> parent = parentNode();
     if (!parent)
@@ -612,7 +612,7 @@
     return parent->insertBefore(*node, viableNextSibling.get());
 }
 
-ExceptionOr<void> Node::replaceWith(Vector<NodeOrString>&& nodeOrStringVector)
+ExceptionOr<void> Node::replaceWith(FixedVector<NodeOrString>&& nodeOrStringVector)
 {
     RefPtr<ContainerNode> parent = parentNode();
     if (!parent)

Modified: trunk/Source/WebCore/dom/Node.h (287293 => 287294)


--- trunk/Source/WebCore/dom/Node.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/dom/Node.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -32,6 +32,7 @@
 #include "TreeScope.h"
 #include <wtf/CompactPointerTuple.h>
 #include <wtf/CompactUniquePtrTuple.h>
+#include <wtf/FixedVector.h>
 #include <wtf/Forward.h>
 #include <wtf/IsoMalloc.h>
 #include <wtf/ListHashSet.h>
@@ -184,9 +185,9 @@
     WEBCORE_EXPORT Element* nextElementSibling() const;
 
     // From the ChildNode - https://dom.spec.whatwg.org/#childnode
-    ExceptionOr<void> before(Vector<NodeOrString>&&);
-    ExceptionOr<void> after(Vector<NodeOrString>&&);
-    ExceptionOr<void> replaceWith(Vector<NodeOrString>&&);
+    ExceptionOr<void> before(FixedVector<NodeOrString>&&);
+    ExceptionOr<void> after(FixedVector<NodeOrString>&&);
+    ExceptionOr<void> replaceWith(FixedVector<NodeOrString>&&);
     WEBCORE_EXPORT ExceptionOr<void> remove();
 
     // Other methods (not part of DOM)
@@ -691,7 +692,7 @@
     void invalidateStyle(Style::Validity, Style::InvalidationMode = Style::InvalidationMode::Normal);
     void updateAncestorsForStyleRecalc();
 
-    ExceptionOr<RefPtr<Node>> convertNodesOrStringsIntoNode(Vector<NodeOrString>&&);
+    ExceptionOr<RefPtr<Node>> convertNodesOrStringsIntoNode(FixedVector<NodeOrString>&&);
 
 private:
     virtual PseudoId customPseudoId() const

Modified: trunk/Source/WebCore/dom/TouchList.h (287293 => 287294)


--- trunk/Source/WebCore/dom/TouchList.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/dom/TouchList.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -29,6 +29,7 @@
 #elif ENABLE(TOUCH_EVENTS)
 
 #include "Touch.h"
+#include <wtf/FixedVector.h>
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
@@ -41,7 +42,7 @@
     {
         return adoptRef(*new TouchList);
     }
-    static Ref<TouchList> create(Vector<std::reference_wrapper<Touch>>&& touches)
+    static Ref<TouchList> create(FixedVector<std::reference_wrapper<Touch>>&& touches)
     {
         return adoptRef(*new TouchList(WTFMove(touches)));
     }
@@ -56,7 +57,7 @@
 private:
     TouchList() = default;
 
-    explicit TouchList(Vector<std::reference_wrapper<Touch>>&& touches)
+    explicit TouchList(FixedVector<std::reference_wrapper<Touch>>&& touches)
     {
         m_values.reserveInitialCapacity(touches.size());
         for (auto& touch : touches)

Modified: trunk/Source/WebCore/html/DOMTokenList.cpp (287293 => 287294)


--- trunk/Source/WebCore/html/DOMTokenList.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/html/DOMTokenList.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -97,7 +97,7 @@
     return { };
 }
 
-ExceptionOr<void> DOMTokenList::add(const Vector<String>& tokens)
+ExceptionOr<void> DOMTokenList::add(const FixedVector<String>& tokens)
 {
     return addInternal(tokens.data(), tokens.size());
 }
@@ -122,7 +122,7 @@
     return { };
 }
 
-ExceptionOr<void> DOMTokenList::remove(const Vector<String>& tokens)
+ExceptionOr<void> DOMTokenList::remove(const FixedVector<String>& tokens)
 {
     return removeInternal(tokens.data(), tokens.size());
 }

Modified: trunk/Source/WebCore/html/DOMTokenList.h (287293 => 287294)


--- trunk/Source/WebCore/html/DOMTokenList.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/html/DOMTokenList.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "Element.h"
+#include <wtf/FixedVector.h>
 
 namespace WebCore {
 
@@ -44,9 +45,9 @@
     const AtomString& item(unsigned index) const;
 
     WEBCORE_EXPORT bool contains(const AtomString&) const;
-    ExceptionOr<void> add(const Vector<String>&);
+    ExceptionOr<void> add(const FixedVector<String>&);
     ExceptionOr<void> add(const AtomString&);
-    ExceptionOr<void> remove(const Vector<String>&);
+    ExceptionOr<void> remove(const FixedVector<String>&);
     ExceptionOr<void> remove(const AtomString&);
     WEBCORE_EXPORT ExceptionOr<bool> toggle(const AtomString&, std::optional<bool> force);
     ExceptionOr<bool> replace(const AtomString& token, const AtomString& newToken);

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (287293 => 287294)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -245,7 +245,7 @@
     maxCanvasAreaForTesting = size;
 }
 
-ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC::JSGlobalObject& state, const String& contextId, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
+ExceptionOr<std::optional<RenderingContext>> HTMLCanvasElement::getContext(JSC::JSGlobalObject& state, const String& contextId, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments)
 {
     if (m_context) {
         if (m_context->isPlaceholder())

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (287293 => 287294)


--- trunk/Source/WebCore/html/HTMLCanvasElement.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -74,7 +74,7 @@
     void setSize(const IntSize& newSize) override;
 
     CanvasRenderingContext* renderingContext() const final { return m_context.get(); }
-    ExceptionOr<std::optional<RenderingContext>> getContext(JSC::JSGlobalObject&, const String& contextId, Vector<JSC::Strong<JSC::Unknown>>&& arguments);
+    ExceptionOr<std::optional<RenderingContext>> getContext(JSC::JSGlobalObject&, const String& contextId, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments);
 
     CanvasRenderingContext* getContext(const String&);
 

Modified: trunk/Source/WebCore/html/OffscreenCanvas.cpp (287293 => 287294)


--- trunk/Source/WebCore/html/OffscreenCanvas.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/html/OffscreenCanvas.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -213,7 +213,7 @@
 
 #endif // ENABLE(WEBGL)
 
-ExceptionOr<std::optional<OffscreenRenderingContext>> OffscreenCanvas::getContext(JSC::JSGlobalObject& state, RenderingContextType contextType, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
+ExceptionOr<std::optional<OffscreenRenderingContext>> OffscreenCanvas::getContext(JSC::JSGlobalObject& state, RenderingContextType contextType, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments)
 {
     if (m_detached)
         return Exception { InvalidStateError };

Modified: trunk/Source/WebCore/html/OffscreenCanvas.h (287293 => 287294)


--- trunk/Source/WebCore/html/OffscreenCanvas.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/html/OffscreenCanvas.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -37,6 +37,7 @@
 #include "ImageBufferPipe.h"
 #include "IntSize.h"
 #include "ScriptWrappable.h"
+#include <wtf/FixedVector.h>
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
 #include <wtf/ThreadSafeRefCounted.h>
@@ -126,7 +127,7 @@
 
     CanvasRenderingContext* renderingContext() const final { return m_context.get(); }
 
-    ExceptionOr<std::optional<OffscreenRenderingContext>> getContext(JSC::JSGlobalObject&, RenderingContextType, Vector<JSC::Strong<JSC::Unknown>>&& arguments);
+    ExceptionOr<std::optional<OffscreenRenderingContext>> getContext(JSC::JSGlobalObject&, RenderingContextType, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments);
     ExceptionOr<RefPtr<ImageBitmap>> transferToImageBitmap();
     void convertToBlob(ImageEncodeOptions&&, Ref<DeferredPromise>&&);
 

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (287293 => 287294)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -1794,7 +1794,7 @@
     page->chrome().setWindowRect(adjustWindowRect(*page, update));
 }
 
-ExceptionOr<int> DOMWindow::setTimeout(std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
+ExceptionOr<int> DOMWindow::setTimeout(std::unique_ptr<ScheduledAction> action, int timeout, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments)
 {
     RefPtr context = scriptExecutionContext();
     if (!context)
@@ -1819,7 +1819,7 @@
     DOMTimer::removeById(*context, timeoutId);
 }
 
-ExceptionOr<int> DOMWindow::setInterval(std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
+ExceptionOr<int> DOMWindow::setInterval(std::unique_ptr<ScheduledAction> action, int timeout, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments)
 {
     RefPtr context = scriptExecutionContext();
     if (!context)

Modified: trunk/Source/WebCore/page/DOMWindow.h (287293 => 287294)


--- trunk/Source/WebCore/page/DOMWindow.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/page/DOMWindow.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -41,6 +41,7 @@
 #include "WindowOrWorkerGlobalScope.h"
 #include <_javascript_Core/HandleTypes.h>
 #include <_javascript_Core/Strong.h>
+#include <wtf/FixedVector.h>
 #include <wtf/Function.h>
 #include <wtf/HashSet.h>
 #include <wtf/MonotonicTime.h>
@@ -293,9 +294,9 @@
     VisualViewport& visualViewport();
 
     // Timers
-    ExceptionOr<int> setTimeout(std::unique_ptr<ScheduledAction>, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments);
+    ExceptionOr<int> setTimeout(std::unique_ptr<ScheduledAction>, int timeout, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments);
     void clearTimeout(int timeoutId);
-    ExceptionOr<int> setInterval(std::unique_ptr<ScheduledAction>, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments);
+    ExceptionOr<int> setInterval(std::unique_ptr<ScheduledAction>, int timeout, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments);
     void clearInterval(int timeoutId);
 
     int requestAnimationFrame(Ref<RequestAnimationFrameCallback>&&);

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp (287293 => 287294)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -95,7 +95,7 @@
     return { };
 }
 
-ExceptionOr<void> DedicatedWorkerGlobalScope::importScripts(const Vector<String>& urls)
+ExceptionOr<void> DedicatedWorkerGlobalScope::importScripts(const FixedVector<String>& urls)
 {
     auto result = Base::importScripts(urls);
     thread().workerObjectProxy().reportPendingActivity(hasPendingActivity());

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h (287293 => 287294)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -89,7 +89,7 @@
 
     Type type() const final { return Type::DedicatedWorker; }
 
-    ExceptionOr<void> importScripts(const Vector<String>& urls) final;
+    ExceptionOr<void> importScripts(const FixedVector<String>& urls) final;
     EventTargetInterface eventTargetInterface() const final;
 
     void prepareForDestruction() final;

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (287293 => 287294)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -302,7 +302,7 @@
         m_navigator->setIsOnline(isOnline);
 }
 
-ExceptionOr<int> WorkerGlobalScope::setTimeout(std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
+ExceptionOr<int> WorkerGlobalScope::setTimeout(std::unique_ptr<ScheduledAction> action, int timeout, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments)
 {
     // FIXME: Should this check really happen here? Or should it happen when code is about to eval?
     if (action->type() == ScheduledAction::Type::Code) {
@@ -320,7 +320,7 @@
     DOMTimer::removeById(*this, timeoutId);
 }
 
-ExceptionOr<int> WorkerGlobalScope::setInterval(std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
+ExceptionOr<int> WorkerGlobalScope::setInterval(std::unique_ptr<ScheduledAction> action, int timeout, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments)
 {
     // FIXME: Should this check really happen here? Or should it happen when code is about to eval?
     if (action->type() == ScheduledAction::Type::Code) {
@@ -338,7 +338,7 @@
     DOMTimer::removeById(*this, timeoutId);
 }
 
-ExceptionOr<void> WorkerGlobalScope::importScripts(const Vector<String>& urls)
+ExceptionOr<void> WorkerGlobalScope::importScripts(const FixedVector<String>& urls)
 {
     ASSERT(contentSecurityPolicy());
 

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (287293 => 287294)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.h	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h	2021-12-21 02:25:46 UTC (rev 287294)
@@ -37,6 +37,7 @@
 #include "WorkerType.h"
 #include <_javascript_Core/ConsoleMessage.h>
 #include <memory>
+#include <wtf/FixedVector.h>
 #include <wtf/HashMap.h>
 #include <wtf/MemoryPressureHandler.h>
 #include <wtf/URL.h>
@@ -107,14 +108,14 @@
     WorkerLocation& location() const;
     void close();
 
-    virtual ExceptionOr<void> importScripts(const Vector<String>& urls);
+    virtual ExceptionOr<void> importScripts(const FixedVector<String>& urls);
     WorkerNavigator& navigator();
 
     void setIsOnline(bool);
 
-    ExceptionOr<int> setTimeout(std::unique_ptr<ScheduledAction>, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments);
+    ExceptionOr<int> setTimeout(std::unique_ptr<ScheduledAction>, int timeout, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments);
     void clearTimeout(int timeoutId);
-    ExceptionOr<int> setInterval(std::unique_ptr<ScheduledAction>, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments);
+    ExceptionOr<int> setInterval(std::unique_ptr<ScheduledAction>, int timeout, FixedVector<JSC::Strong<JSC::Unknown>>&& arguments);
     void clearInterval(int timeoutId);
 
     bool isSecureContext() const final;

Modified: trunk/Source/WebKit/ChangeLog (287293 => 287294)


--- trunk/Source/WebKit/ChangeLog	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebKit/ChangeLog	2021-12-21 02:25:46 UTC (rev 287294)
@@ -1,3 +1,17 @@
+2021-12-20  Alexey Shvayka  <ashva...@apple.com>
+
+        [WebIDL] convertVariadicArguments() should return a FixedVector
+        https://bugs.webkit.org/show_bug.cgi?id=232639
+
+        Reviewed by Yusuke Suzuki.
+
+        Add / remove tokens one by one because there is no way to retrieve
+        the size of va_list in advance so we could construct a FixedVector.
+
+        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
+        (webkit_dom_dom_token_list_add):
+        (webkit_dom_dom_token_list_remove):
+
 2021-12-20  Fujii Hironori  <hironori.fu...@sony.com>
 
         WC variant RemoteGraphicsContextGL::platformLayer() should be removed

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp (287293 => 287294)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp	2021-12-21 02:15:25 UTC (rev 287293)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp	2021-12-21 02:25:46 UTC (rev 287294)
@@ -189,16 +189,16 @@
     g_return_if_fail(!error || !*error);
     WebCore::DOMTokenList* item = WebKit::core(self);
     va_list variadicParameterList;
-    Vector<WTF::String> convertedTokens;
     va_start(variadicParameterList, error);
-    while (gchar* variadicParameter = va_arg(variadicParameterList, gchar*))
-        convertedTokens.append(WTF::String::fromUTF8(variadicParameter));
+    while (gchar* variadicParameter = va_arg(variadicParameterList, gchar*)) {
+        auto result = item->add(WTF::String::fromUTF8(variadicParameter));
+        if (result.hasException()) {
+            auto description = WebCore::DOMException::description(result.releaseException().code());
+            g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
+            break;
+        }
+    }
     va_end(variadicParameterList);
-    auto result = item->add(WTFMove(convertedTokens));
-    if (result.hasException()) {
-        auto description = WebCore::DOMException::description(result.releaseException().code());
-        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
-    }
 }
 
 void webkit_dom_dom_token_list_remove(WebKitDOMDOMTokenList* self, GError** error, ...)
@@ -210,14 +210,15 @@
     va_list variadicParameterList;
     Vector<WTF::String> convertedTokens;
     va_start(variadicParameterList, error);
-    while (gchar* variadicParameter = va_arg(variadicParameterList, gchar*))
-        convertedTokens.append(WTF::String::fromUTF8(variadicParameter));
+    while (gchar* variadicParameter = va_arg(variadicParameterList, gchar*)) {
+        auto result = item->remove(WTF::String::fromUTF8(variadicParameter));
+        if (result.hasException()) {
+            auto description = WebCore::DOMException::description(result.releaseException().code());
+            g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
+            break;
+        }
+    }
     va_end(variadicParameterList);
-    auto result = item->remove(WTFMove(convertedTokens));
-    if (result.hasException()) {
-        auto description = WebCore::DOMException::description(result.releaseException().code());
-        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
-    }
 }
 
 gboolean webkit_dom_dom_token_list_toggle(WebKitDOMDOMTokenList* self, const gchar* token, gboolean force, GError** error)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to