Skip to content
Permalink
Browse files
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):


Canonical link: https://commits.webkit.org/176369@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Jun 2, 2016
1 parent 0ed749a commit 61bbb81566d1af8accff1029277e4be00a7b903e
Showing with 16 additions and 1 deletion.
  1. +13 −0 Source/WebCore/ChangeLog
  2. +3 −1 Source/WebCore/dom/DocumentOrderedMap.cpp
@@ -1,3 +1,16 @@
2016-06-01 Chris Dumez <cdumez@apple.com>

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):

2016-06-01 Alexey Proskuryakov <ap@apple.com>

Update QuartzCoreSPI.h for <rdar://problem/26584828>.
@@ -54,7 +54,9 @@ void DocumentOrderedMap::add(const AtomicStringImpl& key, Element& element, cons

if (!element.isInTreeScope())
return;
Map::AddResult addResult = m_map.add(&key, MapEntry(&element));
Map::AddResult addResult = m_map.ensure(&key, [&element] {
return MapEntry(&element);
});
MapEntry& entry = addResult.iterator->value;

#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)

0 comments on commit 61bbb81

Please sign in to comment.