Title: [201579] trunk/Source/WebCore
Revision
201579
Author
[email protected]
Date
2016-06-01 17:23:59 -0700 (Wed, 01 Jun 2016)

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (201578 => 201579)


--- trunk/Source/WebCore/ChangeLog	2016-06-02 00:23:01 UTC (rev 201578)
+++ trunk/Source/WebCore/ChangeLog	2016-06-02 00:23:59 UTC (rev 201579)
@@ -1,3 +1,16 @@
+2016-06-01  Chris Dumez  <[email protected]>
+
+        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  <[email protected]>
 
         Update QuartzCoreSPI.h for <rdar://problem/26584828>.

Modified: trunk/Source/WebCore/dom/DocumentOrderedMap.cpp (201578 => 201579)


--- trunk/Source/WebCore/dom/DocumentOrderedMap.cpp	2016-06-02 00:23:01 UTC (rev 201578)
+++ trunk/Source/WebCore/dom/DocumentOrderedMap.cpp	2016-06-02 00:23:59 UTC (rev 201579)
@@ -54,7 +54,9 @@
 
     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)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to