⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 201579 in webkit


Ignore:
Timestamp:
Jun 1, 2016, 5:23:59 PM (10 years ago)
Author:
Chris Dumez
Message:

Use HashMap::ensure() in DocumentOrderedMap::add()
https://bugs.webkit.org/show_bug.cgi?id=158283

Reviewed by Ryosuke Niwa.

Use HashMap::ensure() in DocumentOrderedMap::add() to avoid constructing
a MapEntry if the key is already present in the HashMap.

  • dom/DocumentOrderedMap.cpp:

(WebCore::DocumentOrderedMap::add):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r201576 r201579  
     12016-06-01  Chris Dumez  <cdumez@apple.com>
     2
     3        Use HashMap::ensure() in DocumentOrderedMap::add()
     4        https://bugs.webkit.org/show_bug.cgi?id=158283
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Use HashMap::ensure() in DocumentOrderedMap::add() to avoid constructing
     9        a MapEntry if the key is already present in the HashMap.
     10
     11        * dom/DocumentOrderedMap.cpp:
     12        (WebCore::DocumentOrderedMap::add):
     13
    1142016-06-01  Alexey Proskuryakov  <ap@apple.com>
    215
  • trunk/Source/WebCore/dom/DocumentOrderedMap.cpp

    r196223 r201579  
    5555    if (!element.isInTreeScope())
    5656        return;
    57     Map::AddResult addResult = m_map.add(&key, MapEntry(&element));
     57    Map::AddResult addResult = m_map.ensure(&key, [&element] {
     58        return MapEntry(&element);
     59    });
    5860    MapEntry& entry = addResult.iterator->value;
    5961
Note: See TracChangeset for help on using the changeset viewer.