Changeset 223317 in webkit


Ignore:
Timestamp:
Oct 14, 2017 8:07:44 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Sam Weinig <sam@webkit.org> 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())

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r223316 r223317  
     12017-10-14  Sam Weinig  <sam@webkit.org>
     2
     3        Remove HashCountedSet's copyToVector functions
     4        https://bugs.webkit.org/show_bug.cgi?id=178215
     5
     6        Reviewed by Daniel Bates.
     7
     8        * wtf/HashCountedSet.h:
     9        (WTF::copyToVector): Deleted.
     10       
     11            They are replaced by either copyToVector(hashCountedSet) or copyToVector(hashCountedSet.values())
     12
    1132017-10-13  Sam Weinig  <sam@webkit.org>
    214
  • trunk/Source/WTF/wtf/HashCountedSet.h

    r223316 r223317  
    310310}
    311311
    312 template<typename Value, typename HashFunctions, typename Traits, typename VectorType>
    313 inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, VectorType& vector)
    314 {
    315     typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
    316 
    317     vector.resize(collection.size());
    318 
    319     iterator it = collection.begin();
    320     iterator end = collection.end();
    321     for (unsigned i = 0; it != end; ++it, ++i)
    322         vector[i] = *it;
    323 }
    324 
    325 template<typename Value, typename HashFunctions, typename Traits>
    326 inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, Vector<Value>& vector)
    327 {
    328     typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
    329 
    330     vector.resize(collection.size());
    331 
    332     iterator it = collection.begin();
    333     iterator end = collection.end();
    334     for (unsigned i = 0; it != end; ++it, ++i)
    335         vector[i] = (*it).key;
    336 }
    337 
    338312} // namespace WTF
    339313
    340314using WTF::HashCountedSet;
    341 
    342 
  • trunk/Source/WebCore/ChangeLog

    r223315 r223317  
     12017-10-14  Sam Weinig  <sam@webkit.org>
     2
     3        Remove HashCountedSet's copyToVector functions
     4        https://bugs.webkit.org/show_bug.cgi?id=178215
     5
     6        Reviewed by Daniel Bates.
     7
     8        * page/DeviceController.cpp:
     9        (WebCore::DeviceController::dispatchDeviceEvent):
     10        (WebCore::DeviceController::fireDeviceEvent):
     11       
     12            Replace use of HashCountedSet's copyToVector functions with copyToVector(hashCountedSet.values()).
     13
    1142017-10-13  Jer Noble  <jer.noble@apple.com>
    215
  • trunk/Source/WebCore/page/DeviceController.cpp

    r215160 r223317  
    7373void DeviceController::dispatchDeviceEvent(Event& event)
    7474{
    75     Vector<RefPtr<DOMWindow>> listenerVector;
    76     copyToVector(m_listeners, listenerVector);
    77     for (auto& listener : listenerVector) {
     75    for (auto& listener : copyToVector(m_listeners.values())) {
    7876        auto document = listener->document();
    7977        if (document && !document->activeDOMObjectsAreSuspended() && !document->activeDOMObjectsAreStopped())
     
    8785
    8886    m_timer.stop();
    89     Vector<RefPtr<DOMWindow>> listenerVector;
    90     copyToVector(m_lastEventListeners, listenerVector);
     87    auto listenerVector = copyToVector(m_lastEventListeners.values());
    9188    m_lastEventListeners.clear();
    9289    for (auto& listener : listenerVector) {
Note: See TracChangeset for help on using the changeset viewer.