Title: [187088] trunk/Source/WebCore
Revision
187088
Author
[email protected]
Date
2015-07-20 22:16:44 -0700 (Mon, 20 Jul 2015)

Log Message

[CoordinatedGraphics] CoordinatedGraphicsLayer::setContentsToImage() should avoid scheduling unnecessary flushes
https://bugs.webkit.org/show_bug.cgi?id=147118

Reviewed by Martin Robinson.

Have CoordinatedGraphicsLayer::setContentsToImage() return early if the new
passed-in Image and the corresponding native image pointer are equal to the
currently set values.

This specifically avoids scheduling unnecessary flushes when setContentsToImage()
is repeatedly called with a null Image pointer, which in previous code would
unconditionally result in a scheduled flush even if there was no Image assigned
as the content of this layer before. Until now the layer flush scheduling was only
avoided if the two non-null native image pointers were equal.

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::setContentsToImage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (187087 => 187088)


--- trunk/Source/WebCore/ChangeLog	2015-07-21 05:08:21 UTC (rev 187087)
+++ trunk/Source/WebCore/ChangeLog	2015-07-21 05:16:44 UTC (rev 187088)
@@ -1,3 +1,23 @@
+2015-07-20  Zan Dobersek  <[email protected]>
+
+        [CoordinatedGraphics] CoordinatedGraphicsLayer::setContentsToImage() should avoid scheduling unnecessary flushes
+        https://bugs.webkit.org/show_bug.cgi?id=147118
+
+        Reviewed by Martin Robinson.
+
+        Have CoordinatedGraphicsLayer::setContentsToImage() return early if the new
+        passed-in Image and the corresponding native image pointer are equal to the
+        currently set values.
+
+        This specifically avoids scheduling unnecessary flushes when setContentsToImage()
+        is repeatedly called with a null Image pointer, which in previous code would
+        unconditionally result in a scheduled flush even if there was no Image assigned
+        as the content of this layer before. Until now the layer flush scheduling was only
+        avoided if the two non-null native image pointers were equal.
+
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::setContentsToImage):
+
 2015-07-20  Nan Wang  <[email protected]>
 
         AX: Selection change as a result of focusing an element may cause Safari to crash

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (187087 => 187088)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2015-07-21 05:08:21 UTC (rev 187087)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2015-07-21 05:16:44 UTC (rev 187088)
@@ -460,19 +460,12 @@
 
 void CoordinatedGraphicsLayer::setContentsToImage(Image* image)
 {
-    NativeImagePtr newNativeImagePtr = image ? image->nativeImageForCurrentFrame() : 0;
-    if (newNativeImagePtr) {
-        // This code makes the assumption that pointer equality on a NativeImagePtr is a valid way to tell if the image is changed.
-        // This assumption is true in Qt, GTK and EFL.
-        if (newNativeImagePtr == m_compositedNativeImagePtr)
-            return;
+    NativeImagePtr nativeImagePtr = image ? image->nativeImageForCurrentFrame() : nullptr;
+    if (m_compositedImage == image && m_compositedNativeImagePtr == nativeImagePtr)
+        return;
 
-        m_compositedImage = image;
-        m_compositedNativeImagePtr = newNativeImagePtr;
-    } else {
-        m_compositedImage = nullptr;
-        m_compositedNativeImagePtr = nullptr;
-    }
+    m_compositedImage = image;
+    m_compositedNativeImagePtr = nativeImagePtr;
 
     GraphicsLayer::setContentsToImage(image);
     didChangeImageBacking();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to