Title: [223317] trunk/Source
Revision
223317
Author
[email protected]
Date
2017-10-14 08:07:44 -0700 (Sat, 14 Oct 2017)

Log Message

Remove HashCountedSet's copyToVector functions
https://bugs.webkit.org/show_bug.cgi?id=178215

Patch by Sam Weinig <[email protected]> on 2017-10-14
Reviewed by Daniel Bates.

Source/WebCore:

* page/DeviceController.cpp:
(WebCore::DeviceController::dispatchDeviceEvent):
(WebCore::DeviceController::fireDeviceEvent):

    Replace use of HashCountedSet's copyToVector functions with copyToVector(hashCountedSet.values()).

Source/WTF:

* wtf/HashCountedSet.h:
(WTF::copyToVector): Deleted.

    They are replaced by either copyToVector(hashCountedSet) or copyToVector(hashCountedSet.values())

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (223316 => 223317)


--- trunk/Source/WTF/ChangeLog	2017-10-14 04:45:20 UTC (rev 223316)
+++ trunk/Source/WTF/ChangeLog	2017-10-14 15:07:44 UTC (rev 223317)
@@ -1,3 +1,15 @@
+2017-10-14  Sam Weinig  <[email protected]>
+
+        Remove HashCountedSet's copyToVector functions
+        https://bugs.webkit.org/show_bug.cgi?id=178215
+
+        Reviewed by Daniel Bates.
+
+        * wtf/HashCountedSet.h:
+        (WTF::copyToVector): Deleted.
+        
+            They are replaced by either copyToVector(hashCountedSet) or copyToVector(hashCountedSet.values())
+
 2017-10-13  Sam Weinig  <[email protected]>
 
         Adopt type trait template aliases everywhere in WTF

Modified: trunk/Source/WTF/wtf/HashCountedSet.h (223316 => 223317)


--- trunk/Source/WTF/wtf/HashCountedSet.h	2017-10-14 04:45:20 UTC (rev 223316)
+++ trunk/Source/WTF/wtf/HashCountedSet.h	2017-10-14 15:07:44 UTC (rev 223317)
@@ -309,34 +309,6 @@
     return remove(find(value));
 }
 
-template<typename Value, typename HashFunctions, typename Traits, typename VectorType>
-inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, VectorType& vector)
-{
-    typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
-
-    vector.resize(collection.size());
-
-    iterator it = collection.begin();
-    iterator end = collection.end();
-    for (unsigned i = 0; it != end; ++it, ++i)
-        vector[i] = *it;
-}
-
-template<typename Value, typename HashFunctions, typename Traits>
-inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, Vector<Value>& vector)
-{
-    typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
-
-    vector.resize(collection.size());
-
-    iterator it = collection.begin();
-    iterator end = collection.end();
-    for (unsigned i = 0; it != end; ++it, ++i)
-        vector[i] = (*it).key;
-}
-
 } // namespace WTF
 
 using WTF::HashCountedSet;
-
-

Modified: trunk/Source/WebCore/ChangeLog (223316 => 223317)


--- trunk/Source/WebCore/ChangeLog	2017-10-14 04:45:20 UTC (rev 223316)
+++ trunk/Source/WebCore/ChangeLog	2017-10-14 15:07:44 UTC (rev 223317)
@@ -1,3 +1,16 @@
+2017-10-14  Sam Weinig  <[email protected]>
+
+        Remove HashCountedSet's copyToVector functions
+        https://bugs.webkit.org/show_bug.cgi?id=178215
+
+        Reviewed by Daniel Bates.
+
+        * page/DeviceController.cpp:
+        (WebCore::DeviceController::dispatchDeviceEvent):
+        (WebCore::DeviceController::fireDeviceEvent):
+        
+            Replace use of HashCountedSet's copyToVector functions with copyToVector(hashCountedSet.values()).
+
 2017-10-13  Jer Noble  <[email protected]>
 
         Performance: Skip texture upload if source image and destination texture haven't changed

Modified: trunk/Source/WebCore/page/DeviceController.cpp (223316 => 223317)


--- trunk/Source/WebCore/page/DeviceController.cpp	2017-10-14 04:45:20 UTC (rev 223316)
+++ trunk/Source/WebCore/page/DeviceController.cpp	2017-10-14 15:07:44 UTC (rev 223317)
@@ -72,9 +72,7 @@
 
 void DeviceController::dispatchDeviceEvent(Event& event)
 {
-    Vector<RefPtr<DOMWindow>> listenerVector;
-    copyToVector(m_listeners, listenerVector);
-    for (auto& listener : listenerVector) {
+    for (auto& listener : copyToVector(m_listeners.values())) {
         auto document = listener->document();
         if (document && !document->activeDOMObjectsAreSuspended() && !document->activeDOMObjectsAreStopped())
             listener->dispatchEvent(event);
@@ -86,8 +84,7 @@
     ASSERT(hasLastData());
 
     m_timer.stop();
-    Vector<RefPtr<DOMWindow>> listenerVector;
-    copyToVector(m_lastEventListeners, listenerVector);
+    auto listenerVector = copyToVector(m_lastEventListeners.values());
     m_lastEventListeners.clear();
     for (auto& listener : listenerVector) {
         auto document = listener->document();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to