Title: [136342] trunk/Source/WebKit2
Revision
136342
Author
[email protected]
Date
2012-12-02 05:00:22 -0800 (Sun, 02 Dec 2012)

Log Message

[CoordinatedGraphics] LayerTreeRenderer::removeImageBacking() calls HashMap::find() twice
https://bugs.webkit.org/show_bug.cgi?id=103815

Reviewed by Noam Rosenthal.

Call HashMap::take() in LayerTreeRenderer::removeImageBacking()
to avoid calling HashMap::find() twice. find() was called once
explicitly to get an iterator and a second time to remove the
value from the value from the HashMap. We could have used
remove(iterator) instead of remove(key) but using take() results
in simpler code.

* UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
(WebKit::LayerTreeRenderer::removeImageBacking):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (136341 => 136342)


--- trunk/Source/WebKit2/ChangeLog	2012-12-02 12:49:09 UTC (rev 136341)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-02 13:00:22 UTC (rev 136342)
@@ -1,3 +1,20 @@
+2012-12-02  Christophe Dumez  <[email protected]>
+
+        [CoordinatedGraphics] LayerTreeRenderer::removeImageBacking() calls HashMap::find() twice
+        https://bugs.webkit.org/show_bug.cgi?id=103815
+
+        Reviewed by Noam Rosenthal.
+
+        Call HashMap::take() in LayerTreeRenderer::removeImageBacking()
+        to avoid calling HashMap::find() twice. find() was called once
+        explicitly to get an iterator and a second time to remove the
+        value from the value from the HashMap. We could have used
+        remove(iterator) instead of remove(key) but using take() results
+        in simpler code.
+
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
+        (WebKit::LayerTreeRenderer::removeImageBacking):
+
 2012-12-02  Huang Dongsung  <[email protected]>
 
         Coordinated Graphics: Images disappear randomly

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp (136341 => 136342)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2012-12-02 12:49:09 UTC (rev 136341)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2012-12-02 13:00:22 UTC (rev 136342)
@@ -556,9 +556,7 @@
     ASSERT(m_imageBackings.contains(imageID));
 
     // We don't want TextureMapperLayer refers a dangling pointer.
-    ImageBackingMap::iterator it = m_imageBackings.find(imageID);
-    m_releasedImageBackings.append(it->value);
-    m_imageBackings.remove(imageID);
+    m_releasedImageBackings.append(m_imageBackings.take(imageID));
 }
 
 void LayerTreeRenderer::assignImageBackingToLayer(GraphicsLayer* layer, CoordinatedImageBackingID imageID)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to