Changeset 21468 in webkit for trunk/JavaScriptCore/wtf/HashSet.h


Ignore:
Timestamp:
May 14, 2007, 5:20:16 PM (18 years ago)
Author:
ggaren
Message:

JavaScriptCore:

Reviewed by Oliver Hunt.


Added HashMap::swap and HashSet::swap. WebCore now uses HashSet::swap.
I figured while I was in the neighborhood I might as well add HashMap::swap,
too.

  • wtf/HashMap.h: (WTF::::operator): (WTF::::swap):
  • wtf/HashSet.h: (WTF::::operator): (WTF::::swap):

WebCore:

Reviewed by Oliver Hunt.


Some improvements on my last patch, suggested by Darin.

  • history/PageCache.cpp: (WebCore::PageCache::autoreleaseNow): Swap with an empty set instead of building up an array and then calling clear(). This is slightly more efficient and the code is cleaner.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/HashSet.h

    r17127 r21468  
    5858        HashSet& operator=(const HashSet&);
    5959        ~HashSet();
     60
     61        void swap(HashSet&);
    6062
    6163        int size() const;
     
    183185    {
    184186        HashSet tmp(other);
    185         m_impl.swap(tmp.m_impl);
     187        swap(other);
    186188        return *this;
     189    }
     190
     191    template<typename T, typename U, typename V>
     192    inline void HashSet<T, U, V>::swap(HashSet& other)
     193    {
     194        m_impl.swap(other.m_impl);
    187195    }
    188196
Note: See TracChangeset for help on using the changeset viewer.