<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[179599] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/179599">179599</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-02-04 00:39:20 -0800 (Wed, 04 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add removeFirst(value) / removeAll(value) methods to WTF::Vector
https://bugs.webkit.org/show_bug.cgi?id=141192

Reviewed by Benjamin Poulain.

Source/JavaScriptCore:

Use new Vector::removeFirst(value) / removeAll(value) API to simplify the
code a bit.

* inspector/InspectorValues.cpp:
(Inspector::InspectorObjectBase::remove):

Source/WebCore:

Use new Vector::removeFirst(value) / removeAll(value) API to simplify the
code a bit.

* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::unregisterClient):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::removeFormElement):
(WebCore::HTMLFormElement::removeImgElement):
(WebCore::removeFromVector): Deleted.
* page/Chrome.cpp:
(WebCore::Chrome::unregisterPopupOpeningObserver):
* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::uninstallPageOverlay):
* page/SecurityPolicy.cpp:
(WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry):
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::removeFromParent):
* platform/graphics/texmap/TextureMapperAnimation.cpp:
(WebCore::TextureMapperAnimations::remove):
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::addSearchResult):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::removeCaption):
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::subtreeChildWillBeRemoved):
* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::removeAllElementReferencesForTarget):
* svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::unschedule):

Source/WebKit2:

Use new Vector::removeFirst(value) / removeAll(value) API to simplify the
code a bit.

* UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp:
(WebKit::WebSoupCustomProtocolRequestManager::unregisterSchemeForCustomProtocol):
* UIProcess/PageLoadState.cpp:
(WebKit::PageLoadState::removeObserver):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::~WebProcessPool):
(WebKit::WebProcessPool::disconnectProcess):
* WebProcess/InjectedBundle/API/efl/ewk_extension.cpp:
(EwkExtension::remove):

Source/WTF:

Add removeFirst(value) / removeAll(value) convenience methods to
WTF::Vector to reduce complexity a bit at call sites.

I am planning to add overloads for these taking a lambda function for
matching in a follow-up patch as well. I have seen quite a few
Vector::remove(index) call sites that would benefit from it.

* wtf/Vector.h:
(WTF::OverflowHandler&gt;::removeFirst):
(WTF::OverflowHandler&gt;::removeAll):

Tools:

Add API tests for Vector::removeFirst(value) and
Vector::removeAll(value).

* TestWebKitAPI/Tests/WTF/Vector.cpp:
(TestWebKitAPI::TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInspectorValuescpp">trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfVectorh">trunk/Source/WTF/wtf/Vector.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentscpp">trunk/Source/WebCore/css/StyleSheetContents.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLFormElementcpp">trunk/Source/WebCore/html/HTMLFormElement.cpp</a></li>
<li><a href="#trunkSourceWebCorepageChromecpp">trunk/Source/WebCore/page/Chrome.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageOverlayControllercpp">trunk/Source/WebCore/page/PageOverlayController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageSecurityPolicycpp">trunk/Source/WebCore/page/SecurityPolicy.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayercpp">trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderSearchFieldcpp">trunk/Source/WebCore/rendering/RenderSearchField.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTablecpp">trunk/Source/WebCore/rendering/RenderTable.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGTextcpp">trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGDocumentExtensionscpp">trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp</a></li>
<li><a href="#trunkSourceWebCoresvganimationSMILTimeContainercpp">trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagercpp">trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageLoadStatecpp">trunk/Source/WebKit2/UIProcess/PageLoadState.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolcpp">trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIeflewk_extensioncpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_extension.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFVectorcpp">trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-02-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Add removeFirst(value) / removeAll(value) methods to WTF::Vector
+        https://bugs.webkit.org/show_bug.cgi?id=141192
+
+        Reviewed by Benjamin Poulain.
+
+        Use new Vector::removeFirst(value) / removeAll(value) API to simplify the
+        code a bit.
+
+        * inspector/InspectorValues.cpp:
+        (Inspector::InspectorObjectBase::remove):
+
</ins><span class="cx"> 2015-02-03  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Workaround a thread library bug where thread destructors may not get called.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInspectorValuescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -786,12 +786,7 @@
</span><span class="cx"> void InspectorObjectBase::remove(const String&amp; name)
</span><span class="cx"> {
</span><span class="cx">     m_data.remove(name);
</span><del>-    for (size_t i = 0; i &lt; m_order.size(); ++i) {
-        if (m_order[i] == name) {
-            m_order.remove(i);
-            break;
-        }
-    }
</del><ins>+    m_order.removeFirst(name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorObjectBase::writeJSON(StringBuilder&amp; output) const
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WTF/ChangeLog        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-02-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Add removeFirst(value) / removeAll(value) methods to WTF::Vector
+        https://bugs.webkit.org/show_bug.cgi?id=141192
+
+        Reviewed by Benjamin Poulain.
+
+        Add removeFirst(value) / removeAll(value) convenience methods to
+        WTF::Vector to reduce complexity a bit at call sites.
+
+        I am planning to add overloads for these taking a lambda function for
+        matching in a follow-up patch as well. I have seen quite a few
+        Vector::remove(index) call sites that would benefit from it.
+
+        * wtf/Vector.h:
+        (WTF::OverflowHandler&gt;::removeFirst):
+        (WTF::OverflowHandler&gt;::removeAll):
+
</ins><span class="cx"> 2015-02-02  Dhi Aurrahman  &lt;diorahman@rockybars.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Optimize matchesLangPseudoClass() of :lang()
</span></span></pre></div>
<a id="trunkSourceWTFwtfVectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Vector.h (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Vector.h        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WTF/wtf/Vector.h        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -735,6 +735,8 @@
</span><span class="cx"> 
</span><span class="cx">     void remove(size_t position);
</span><span class="cx">     void remove(size_t position, size_t length);
</span><ins>+    template&lt;typename U&gt; bool removeFirst(const U&amp;);
+    template&lt;typename U&gt; unsigned removeAll(const U&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void removeLast() 
</span><span class="cx">     {
</span><span class="lines">@@ -1309,6 +1311,45 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T, size_t inlineCapacity, typename OverflowHandler&gt;
</span><ins>+template&lt;typename U&gt;
+inline bool Vector&lt;T, inlineCapacity, OverflowHandler&gt;::removeFirst(const U&amp; value)
+{
+    size_t index = find(value);
+    if (index != notFound) {
+        remove(index);
+        return true;
+    }
+    return false;
+}
+
+template&lt;typename T, size_t inlineCapacity, typename OverflowHandler&gt;
+template&lt;typename U&gt;
+inline unsigned Vector&lt;T, inlineCapacity, OverflowHandler&gt;::removeAll(const U&amp; value)
+{
+    iterator holeBegin = end();
+    iterator holeEnd = end();
+    unsigned matchCount = 0;
+    for (auto it = begin(), itEnd = end(); it != itEnd; ++it) {
+        if (*it == value) {
+            if (holeBegin == end())
+                holeBegin = it;
+            else if (holeEnd != it) {
+                TypeOperations::moveOverlapping(holeEnd, it, holeBegin);
+                holeBegin += it - holeEnd;
+            }
+            holeEnd = it + 1;
+            it-&gt;~T();
+            ++matchCount;
+        }
+    }
+    if (holeEnd != end())
+        TypeOperations::moveOverlapping(holeEnd, end(), holeBegin);
+    asanBufferSizeWillChangeTo(m_size - matchCount);
+    m_size -= matchCount;
+    return matchCount;
+}
+
+template&lt;typename T, size_t inlineCapacity, typename OverflowHandler&gt;
</ins><span class="cx"> inline void Vector&lt;T, inlineCapacity, OverflowHandler&gt;::reverse()
</span><span class="cx"> {
</span><span class="cx">     for (size_t i = 0; i &lt; m_size / 2; ++i)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/ChangeLog        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2015-02-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Add removeFirst(value) / removeAll(value) methods to WTF::Vector
+        https://bugs.webkit.org/show_bug.cgi?id=141192
+
+        Reviewed by Benjamin Poulain.
+
+        Use new Vector::removeFirst(value) / removeAll(value) API to simplify the
+        code a bit.
+
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::unregisterClient):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::removeFormElement):
+        (WebCore::HTMLFormElement::removeImgElement):
+        (WebCore::removeFromVector): Deleted.
+        * page/Chrome.cpp:
+        (WebCore::Chrome::unregisterPopupOpeningObserver):
+        * page/PageOverlayController.cpp:
+        (WebCore::PageOverlayController::uninstallPageOverlay):
+        * page/SecurityPolicy.cpp:
+        (WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry):
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::removeFromParent):
+        * platform/graphics/texmap/TextureMapperAnimation.cpp:
+        (WebCore::TextureMapperAnimations::remove):
+        * rendering/RenderSearchField.cpp:
+        (WebCore::RenderSearchField::addSearchResult):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::removeCaption):
+        * rendering/svg/RenderSVGText.cpp:
+        (WebCore::RenderSVGText::subtreeChildWillBeRemoved):
+        * svg/SVGDocumentExtensions.cpp:
+        (WebCore::SVGDocumentExtensions::removeAllElementReferencesForTarget):
+        * svg/animation/SMILTimeContainer.cpp:
+        (WebCore::SMILTimeContainer::unschedule):
+
</ins><span class="cx"> 2015-02-03  Maciej Stachowiak  &lt;mjs@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Crash when printing snapshotted plugins
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -484,9 +484,8 @@
</span><span class="cx"> 
</span><span class="cx"> void StyleSheetContents::unregisterClient(CSSStyleSheet* sheet)
</span><span class="cx"> {
</span><del>-    size_t position = m_clients.find(sheet);
-    ASSERT(position != notFound);
-    m_clients.remove(position);
</del><ins>+    bool removed = m_clients.removeFirst(sheet);
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StyleSheetContents::addedToMemoryCache()
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLFormElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLFormElement.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -510,16 +510,6 @@
</span><span class="cx">         HTMLElement::parseAttribute(name, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;class T, size_t n&gt; static void removeFromVector(Vector&lt;T*, n&gt; &amp; vec, T* item)
-{
-    size_t size = vec.size();
-    for (size_t i = 0; i != size; ++i)
-        if (vec[i] == item) {
-            vec.remove(i);
-            break;
-        }
-}
-
</del><span class="cx"> unsigned HTMLFormElement::formElementIndexWithFormAttribute(Element* element, unsigned rangeStart, unsigned rangeEnd)
</span><span class="cx"> {
</span><span class="cx">     if (m_associatedElements.isEmpty())
</span><span class="lines">@@ -608,18 +598,14 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLFormElement::removeFormElement(FormAssociatedElement* e)
</span><span class="cx"> {
</span><del>-    unsigned index;
-    for (index = 0; index &lt; m_associatedElements.size(); ++index) {
-        if (m_associatedElements[index] == e)
-            break;
-    }
</del><ins>+    unsigned index = m_associatedElements.find(e);
</ins><span class="cx">     ASSERT_WITH_SECURITY_IMPLICATION(index &lt; m_associatedElements.size());
</span><span class="cx">     if (index &lt; m_associatedElementsBeforeIndex)
</span><span class="cx">         --m_associatedElementsBeforeIndex;
</span><span class="cx">     if (index &lt; m_associatedElementsAfterIndex)
</span><span class="cx">         --m_associatedElementsAfterIndex;
</span><span class="cx">     removeFromPastNamesMap(e);
</span><del>-    removeFromVector(m_associatedElements, e);
</del><ins>+    m_associatedElements.remove(index);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLFormElement::registerInvalidAssociatedFormControl(const HTMLFormControlElement&amp; formControlElement)
</span><span class="lines">@@ -653,9 +639,9 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLFormElement::removeImgElement(HTMLImageElement* e)
</span><span class="cx"> {
</span><del>-    ASSERT(m_imageElements.find(e) != notFound);
</del><span class="cx">     removeFromPastNamesMap(e);
</span><del>-    removeFromVector(m_imageElements, e);
</del><ins>+    bool removed = m_imageElements.removeFirst(e);
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;HTMLCollection&gt; HTMLFormElement::elements()
</span></span></pre></div>
<a id="trunkSourceWebCorepageChromecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Chrome.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Chrome.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/page/Chrome.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -637,9 +637,8 @@
</span><span class="cx"> 
</span><span class="cx"> void Chrome::unregisterPopupOpeningObserver(PopupOpeningObserver* observer)
</span><span class="cx"> {
</span><del>-    size_t index = m_popupOpeningObservers.find(observer);
-    ASSERT(index != notFound);
-    m_popupOpeningObservers.remove(index);
</del><ins>+    bool removed = m_popupOpeningObservers.removeFirst(observer);
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Chrome::notifyPopupOpeningObservers() const
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageOverlayControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageOverlayController.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageOverlayController.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/page/PageOverlayController.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -151,9 +151,8 @@
</span><span class="cx"> 
</span><span class="cx">     m_overlayGraphicsLayers.take(overlay)-&gt;removeFromParent();
</span><span class="cx"> 
</span><del>-    size_t overlayIndex = m_pageOverlays.find(overlay);
-    ASSERT(overlayIndex != notFound);
-    m_pageOverlays.remove(overlayIndex);
</del><ins>+    bool removed = m_pageOverlays.removeFirst(overlay);
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> 
</span><span class="cx">     updateForceSynchronousScrollLayerPositionUpdates();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepageSecurityPolicycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SecurityPolicy.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SecurityPolicy.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/page/SecurityPolicy.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -154,14 +154,12 @@
</span><span class="cx">     if (it == map.end())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    OriginAccessWhiteList* list = it-&gt;value.get();
-    size_t index = list-&gt;find(OriginAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains));
-    if (index == notFound)
</del><ins>+    OriginAccessWhiteList&amp; list = *it-&gt;value;
+    OriginAccessEntry originAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains);
+    if (!list.removeFirst(originAccessEntry))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    list-&gt;remove(index);
-
-    if (list-&gt;isEmpty())
</del><ins>+    if (list.isEmpty())
</ins><span class="cx">         map.remove(it);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -253,14 +253,7 @@
</span><span class="cx"> void GraphicsLayer::removeFromParent()
</span><span class="cx"> {
</span><span class="cx">     if (m_parent) {
</span><del>-        unsigned i;
-        for (i = 0; i &lt; m_parent-&gt;m_children.size(); i++) {
-            if (this == m_parent-&gt;m_children[i]) {
-                m_parent-&gt;m_children.remove(i);
-                break;
-            }
-        }
-
</del><ins>+        m_parent-&gt;m_children.removeFirst(this);
</ins><span class="cx">         setParent(nullptr);
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderSearchFieldcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderSearchField.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderSearchField.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/rendering/RenderSearchField.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -88,12 +88,7 @@
</span><span class="cx">     if (frame().page()-&gt;usesEphemeralSession())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    int size = static_cast&lt;int&gt;(m_recentSearches.size());
-    for (int i = size - 1; i &gt;= 0; --i) {
-        if (m_recentSearches[i] == value)
-            m_recentSearches.remove(i);
-    }
-
</del><ins>+    m_recentSearches.removeAll(value);
</ins><span class="cx">     m_recentSearches.insert(0, value);
</span><span class="cx">     while (static_cast&lt;int&gt;(m_recentSearches.size()) &gt; inputElement().maxResults())
</span><span class="cx">         m_recentSearches.removeLast();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTable.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -230,12 +230,8 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderTable::removeCaption(const RenderTableCaption* oldCaption)
</span><span class="cx"> {
</span><del>-    size_t index = m_captions.find(oldCaption);
-    ASSERT(index != notFound);
-    if (index == notFound)
-        return;
-
-    m_captions.remove(index);
</del><ins>+    bool removed = m_captions.removeFirst(oldCaption);
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderTable::invalidateCachedColumns()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -262,9 +262,8 @@
</span><span class="cx">     if (next)
</span><span class="cx">         affectedAttributes.append(next);
</span><span class="cx"> 
</span><del>-    size_t position = m_layoutAttributes.find(text.layoutAttributes());
-    ASSERT(position != notFound);
-    m_layoutAttributes.remove(position);
</del><ins>+    bool removed = m_layoutAttributes.removeFirst(text.layoutAttributes());
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderSVGText::subtreeChildWasRemoved(const Vector&lt;SVGTextLayoutAttributes*, 2&gt;&amp; affectedAttributes)
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGDocumentExtensionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -379,10 +379,7 @@
</span><span class="cx"> void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* referencedElement)
</span><span class="cx"> {
</span><span class="cx">     m_elementDependencies.remove(referencedElement);
</span><del>-
-    size_t position = m_rebuildElements.find(referencedElement);
-    if (position != notFound)
-        m_rebuildElements.remove(position);
</del><ins>+    m_rebuildElements.removeFirst(referencedElement);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SVG_FONTS)
</span></span></pre></div>
<a id="trunkSourceWebCoresvganimationSMILTimeContainercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -92,9 +92,8 @@
</span><span class="cx">     ElementAttributePair key(target, attributeName);
</span><span class="cx">     AnimationsVector* scheduled = m_scheduledAnimations.get(key);
</span><span class="cx">     ASSERT(scheduled);
</span><del>-    size_t idx = scheduled-&gt;find(animation);
-    ASSERT(idx != notFound);
-    scheduled-&gt;remove(idx);
</del><ins>+    bool removed = scheduled-&gt;removeFirst(animation);
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SMILTimeContainer::notifyIntervalsChanged()
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebKit2/ChangeLog        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-02-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Add removeFirst(value) / removeAll(value) methods to WTF::Vector
+        https://bugs.webkit.org/show_bug.cgi?id=141192
+
+        Reviewed by Benjamin Poulain.
+
+        Use new Vector::removeFirst(value) / removeAll(value) API to simplify the
+        code a bit.
+
+        * UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp:
+        (WebKit::WebSoupCustomProtocolRequestManager::unregisterSchemeForCustomProtocol):
+        * UIProcess/PageLoadState.cpp:
+        (WebKit::PageLoadState::removeObserver):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::~WebProcessPool):
+        (WebKit::WebProcessPool::disconnectProcess):
+        * WebProcess/InjectedBundle/API/efl/ewk_extension.cpp:
+        (EwkExtension::remove):
+
</ins><span class="cx"> 2015-02-03  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed attempt to fix GTK/EFL build after r179588.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkCustomProtocolssoupWebSoupCustomProtocolRequestManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebKit2/UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -96,8 +96,8 @@
</span><span class="cx"> 
</span><span class="cx">     processPool()-&gt;unregisterSchemeForCustomProtocol(scheme);
</span><span class="cx"> 
</span><del>-    ASSERT(m_registeredSchemes.contains(scheme));
-    m_registeredSchemes.remove(m_registeredSchemes.find(scheme));
</del><ins>+    bool removed = m_registeredSchemes.removeFirst(scheme);
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebSoupCustomProtocolRequestManager::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&amp; request)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageLoadStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageLoadState.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageLoadState.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebKit2/UIProcess/PageLoadState.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -74,10 +74,8 @@
</span><span class="cx"> 
</span><span class="cx"> void PageLoadState::removeObserver(Observer&amp; observer)
</span><span class="cx"> {
</span><del>-    ASSERT(m_observers.contains(&amp;observer));
-
-    size_t index = m_observers.find(&amp;observer);
-    m_observers.remove(index);
</del><ins>+    bool removed = m_observers.removeFirst(&amp;observer);
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageLoadState::endTransaction()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -237,8 +237,8 @@
</span><span class="cx"> 
</span><span class="cx"> WebProcessPool::~WebProcessPool()
</span><span class="cx"> {
</span><del>-    ASSERT(processPools().find(this) != notFound);
-    processPools().remove(processPools().find(this));
</del><ins>+    bool removed = processPools().removeFirst(this);
+    ASSERT_UNUSED(removed, removed);
</ins><span class="cx"> 
</span><span class="cx">     removeLanguageChangeObserver(this);
</span><span class="cx"> 
</span><span class="lines">@@ -805,7 +805,7 @@
</span><span class="cx"> 
</span><span class="cx">         static_cast&lt;WebContextSupplement*&gt;(supplement&lt;WebGeolocationManagerProxy&gt;())-&gt;processDidClose(process);
</span><span class="cx"> 
</span><del>-        m_processes.remove(m_processes.find(process));
</del><ins>+        m_processes.removeFirst(process);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -819,8 +819,8 @@
</span><span class="cx">     // if it were invoked from Vector::remove(). RefPtr delays destruction until it's safe.
</span><span class="cx">     RefPtr&lt;WebProcessProxy&gt; protect(process);
</span><span class="cx">     if (m_processWithPageCache == process)
</span><del>-        m_processWithPageCache = 0;
-    m_processes.remove(m_processes.find(process));
</del><ins>+        m_processWithPageCache = nullptr;
+    m_processes.removeFirst(process);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebProcessProxy&amp; WebProcessPool::createNewWebProcessRespectingProcessCountLimit()
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIeflewk_extensioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_extension.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_extension.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/efl/ewk_extension.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> 
</span><span class="cx"> void EwkExtension::remove(Ewk_Extension_Client* client)
</span><span class="cx"> {
</span><del>-    m_clients.remove(m_clients.find(client));
</del><ins>+    m_clients.removeFirst(client);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Eina_Bool ewk_extension_client_add(Ewk_Extension* extension, Ewk_Extension_Client* client)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Tools/ChangeLog        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-02-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Add removeFirst(value) / removeAll(value) methods to WTF::Vector
+        https://bugs.webkit.org/show_bug.cgi?id=141192
+
+        Reviewed by Benjamin Poulain.
+
+        Add API tests for Vector::removeFirst(value) and
+        Vector::removeAll(value).
+
+        * TestWebKitAPI/Tests/WTF/Vector.cpp:
+        (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2015-02-03  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add WKPageNavigationClient as C SPI around API::NavigationClient, and adopt in WKTR
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFVectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp (179598 => 179599)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp        2015-02-04 07:37:18 UTC (rev 179598)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Vector.cpp        2015-02-04 08:39:20 UTC (rev 179599)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;MoveOnly.h&quot;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><ins>+#include &lt;wtf/text/CString.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace TestWebKitAPI {
</span><span class="cx"> 
</span><span class="lines">@@ -323,4 +324,143 @@
</span><span class="cx">     EXPECT_EQ(0U, b.size());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TEST(WTF_Vector, RemoveFirst)
+{
+    Vector&lt;int&gt; v;
+    EXPECT_TRUE(v.isEmpty());
+    EXPECT_FALSE(v.removeFirst(1));
+    EXPECT_FALSE(v.removeFirst(-1));
+    EXPECT_TRUE(v.isEmpty());
+
+    v.fill(2, 10);
+    EXPECT_EQ(10U, v.size());
+    EXPECT_FALSE(v.removeFirst(1));
+    EXPECT_EQ(10U, v.size());
+    v.clear();
+
+    v.fill(1, 10);
+    EXPECT_EQ(10U, v.size());
+    EXPECT_TRUE(v.removeFirst(1));
+    EXPECT_TRUE(v == Vector&lt;int&gt;({1, 1, 1, 1, 1, 1, 1, 1, 1}));
+    EXPECT_EQ(9U, v.size());
+    EXPECT_FALSE(v.removeFirst(2));
+    EXPECT_EQ(9U, v.size());
+    EXPECT_TRUE(v == Vector&lt;int&gt;({1, 1, 1, 1, 1, 1, 1, 1, 1}));
+
+    unsigned removed = 0;
+    while (v.removeFirst(1))
+        ++removed;
+    EXPECT_EQ(9U, removed);
+    EXPECT_TRUE(v.isEmpty());
+
+    v.resize(1);
+    EXPECT_EQ(1U, v.size());
+    EXPECT_TRUE(v.removeFirst(1));
+    EXPECT_EQ(0U, v.size());
+    EXPECT_TRUE(v.isEmpty());
+}
+
+TEST(WTF_Vector, RemoveAll)
+{
+    // Using a memcpy-able type.
+    static_assert(VectorTraits&lt;int&gt;::canMoveWithMemcpy, &quot;Should use a memcpy-able type&quot;);
+    Vector&lt;int&gt; v;
+    EXPECT_TRUE(v.isEmpty());
+    EXPECT_FALSE(v.removeAll(1));
+    EXPECT_FALSE(v.removeAll(-1));
+    EXPECT_TRUE(v.isEmpty());
+
+    v.fill(1, 10);
+    EXPECT_EQ(10U, v.size());
+    EXPECT_EQ(10U, v.removeAll(1));
+    EXPECT_TRUE(v.isEmpty());
+
+    v.fill(2, 10);
+    EXPECT_EQ(10U, v.size());
+    EXPECT_EQ(0U, v.removeAll(1));
+    EXPECT_EQ(10U, v.size());
+
+    v = {1, 2, 1, 2, 1, 2, 2, 1, 1, 1};
+    EXPECT_EQ(10U, v.size());
+    EXPECT_EQ(6U, v.removeAll(1));
+    EXPECT_EQ(4U, v.size());
+    EXPECT_TRUE(v == Vector&lt;int&gt;({2, 2, 2, 2}));
+    EXPECT_TRUE(v.find(1) == notFound);
+    EXPECT_EQ(4U, v.removeAll(2));
+    EXPECT_TRUE(v.isEmpty());
+
+    v = {3, 1, 2, 1, 2, 1, 2, 2, 1, 1, 1, 3};
+    EXPECT_EQ(12U, v.size());
+    EXPECT_EQ(6U, v.removeAll(1));
+    EXPECT_EQ(6U, v.size());
+    EXPECT_TRUE(v.find(1) == notFound);
+    EXPECT_TRUE(v == Vector&lt;int&gt;({3, 2, 2, 2, 2, 3}));
+
+    EXPECT_EQ(4U, v.removeAll(2));
+    EXPECT_EQ(2U, v.size());
+    EXPECT_TRUE(v.find(2) == notFound);
+    EXPECT_TRUE(v == Vector&lt;int&gt;({3, 3}));
+
+    EXPECT_EQ(2U, v.removeAll(3));
+    EXPECT_TRUE(v.isEmpty());
+
+    v = {1, 1, 1, 3, 2, 4, 2, 2, 2, 4, 4, 3};
+    EXPECT_EQ(12U, v.size());
+    EXPECT_EQ(3U, v.removeAll(1));
+    EXPECT_EQ(9U, v.size());
+    EXPECT_TRUE(v.find(1) == notFound);
+    EXPECT_TRUE(v == Vector&lt;int&gt;({3, 2, 4, 2, 2, 2, 4, 4, 3}));
+
+    // Using a non memcpy-able type.
+    static_assert(!VectorTraits&lt;CString&gt;::canMoveWithMemcpy, &quot;Should use a non memcpy-able type&quot;);
+    Vector&lt;CString&gt; vExpected;
+    Vector&lt;CString&gt; v2;
+    EXPECT_TRUE(v2.isEmpty());
+    EXPECT_FALSE(v2.removeAll(&quot;1&quot;));
+    EXPECT_TRUE(v2.isEmpty());
+
+    v2.fill(&quot;1&quot;, 10);
+    EXPECT_EQ(10U, v2.size());
+    EXPECT_EQ(10U, v2.removeAll(&quot;1&quot;));
+    EXPECT_TRUE(v2.isEmpty());
+
+    v2.fill(&quot;2&quot;, 10);
+    EXPECT_EQ(10U, v2.size());
+    EXPECT_EQ(0U, v2.removeAll(&quot;1&quot;));
+    EXPECT_EQ(10U, v2.size());
+
+    v2 = {&quot;1&quot;, &quot;2&quot;, &quot;1&quot;, &quot;2&quot;, &quot;1&quot;, &quot;2&quot;, &quot;2&quot;, &quot;1&quot;, &quot;1&quot;, &quot;1&quot;};
+    EXPECT_EQ(10U, v2.size());
+    EXPECT_EQ(6U, v2.removeAll(&quot;1&quot;));
+    EXPECT_EQ(4U, v2.size());
+    EXPECT_TRUE(v2.find(&quot;1&quot;) == notFound);
+    EXPECT_EQ(4U, v2.removeAll(&quot;2&quot;));
+    EXPECT_TRUE(v2.isEmpty());
+
+    v2 = {&quot;3&quot;, &quot;1&quot;, &quot;2&quot;, &quot;1&quot;, &quot;2&quot;, &quot;1&quot;, &quot;2&quot;, &quot;2&quot;, &quot;1&quot;, &quot;1&quot;, &quot;1&quot;, &quot;3&quot;};
+    EXPECT_EQ(12U, v2.size());
+    EXPECT_EQ(6U, v2.removeAll(&quot;1&quot;));
+    EXPECT_EQ(6U, v2.size());
+    EXPECT_TRUE(v2.find(&quot;1&quot;) == notFound);
+    vExpected = {&quot;3&quot;, &quot;2&quot;, &quot;2&quot;, &quot;2&quot;, &quot;2&quot;, &quot;3&quot;};
+    EXPECT_TRUE(v2 == vExpected);
+
+    EXPECT_EQ(4U, v2.removeAll(&quot;2&quot;));
+    EXPECT_EQ(2U, v2.size());
+    EXPECT_TRUE(v2.find(&quot;2&quot;) == notFound);
+    vExpected = {&quot;3&quot;, &quot;3&quot;};
+    EXPECT_TRUE(v2 == vExpected);
+
+    EXPECT_EQ(2U, v2.removeAll(&quot;3&quot;));
+    EXPECT_TRUE(v2.isEmpty());
+
+    v2 = {&quot;1&quot;, &quot;1&quot;, &quot;1&quot;, &quot;3&quot;, &quot;2&quot;, &quot;4&quot;, &quot;2&quot;, &quot;2&quot;, &quot;2&quot;, &quot;4&quot;, &quot;4&quot;, &quot;3&quot;};
+    EXPECT_EQ(12U, v2.size());
+    EXPECT_EQ(3U, v2.removeAll(&quot;1&quot;));
+    EXPECT_EQ(9U, v2.size());
+    EXPECT_TRUE(v2.find(&quot;1&quot;) == notFound);
+    vExpected = {&quot;3&quot;, &quot;2&quot;, &quot;4&quot;, &quot;2&quot;, &quot;2&quot;, &quot;2&quot;, &quot;4&quot;, &quot;4&quot;, &quot;3&quot;};
+    EXPECT_TRUE(v2 == vExpected);
+}
+
</ins><span class="cx"> } // namespace TestWebKitAPI
</span></span></pre>
</div>
</div>

</body>
</html>