Changeset 21468 in webkit for trunk/JavaScriptCore/wtf/HashMap.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/HashMap.h

    r18203 r21468  
    6868        HashMap& operator=(const HashMap&);
    6969        ~HashMap();
     70
     71        void swap(HashMap&);
    7072
    7173        int size() const;
     
    177179    {
    178180        HashMap tmp(other);
    179         m_impl.swap(tmp.m_impl);
     181        swap(tmp);
    180182        return *this;
     183    }
     184
     185    template<typename T, typename U, typename V, typename W, typename X>
     186    inline void HashMap<T, U, V, W, X>::swap(HashMap& other)
     187    {
     188        m_impl.swap(other.m_impl);
    181189    }
    182190
Note: See TracChangeset for help on using the changeset viewer.