Title: [137863] trunk/Source/WebKit2
Revision
137863
Author
[email protected]
Date
2012-12-16 18:10:28 -0800 (Sun, 16 Dec 2012)

Log Message

Coordinated Graphics: Small refactor of CoordinatedLayerTreeHost and CoordinatedGraphicsLayer.
https://bugs.webkit.org/show_bug.cgi?id=104880

Patch by Huang Dongsung <[email protected]> on 2012-12-16
Reviewed by Noam Rosenthal.

Delete backing stores explicitly in ~CoordinatedLayerTreeHost().

Clarify the lifecycle of backing stores in CoordinatedGraphicsLayer.
Currently, CoordinatedGraphicsLayer::removeTile() checks if m_coordinator
exists, because ~CoordinatedLayerTreeHost() sets m_coordinator in
CoordinatedGraphicsLayer to 0. This patch purges backing stores before setting
m_coordinator to 0. This change makes code more readable.

* WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer):
(WebCore::CoordinatedGraphicsLayer::beginContentUpdate):
(WebCore::CoordinatedGraphicsLayer::createTile):
(WebCore::CoordinatedGraphicsLayer::updateTile):
(WebCore::CoordinatedGraphicsLayer::removeTile):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::~CoordinatedLayerTreeHost):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (137862 => 137863)


--- trunk/Source/WebKit2/ChangeLog	2012-12-17 01:51:18 UTC (rev 137862)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-17 02:10:28 UTC (rev 137863)
@@ -1,3 +1,27 @@
+2012-12-16  Huang Dongsung  <[email protected]>
+
+        Coordinated Graphics: Small refactor of CoordinatedLayerTreeHost and CoordinatedGraphicsLayer.
+        https://bugs.webkit.org/show_bug.cgi?id=104880
+
+        Reviewed by Noam Rosenthal.
+
+        Delete backing stores explicitly in ~CoordinatedLayerTreeHost().
+
+        Clarify the lifecycle of backing stores in CoordinatedGraphicsLayer.
+        Currently, CoordinatedGraphicsLayer::removeTile() checks if m_coordinator
+        exists, because ~CoordinatedLayerTreeHost() sets m_coordinator in
+        CoordinatedGraphicsLayer to 0. This patch purges backing stores before setting
+        m_coordinator to 0. This change makes code more readable.
+
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer):
+        (WebCore::CoordinatedGraphicsLayer::beginContentUpdate):
+        (WebCore::CoordinatedGraphicsLayer::createTile):
+        (WebCore::CoordinatedGraphicsLayer::updateTile):
+        (WebCore::CoordinatedGraphicsLayer::removeTile):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+        (WebKit::CoordinatedLayerTreeHost::~CoordinatedLayerTreeHost):
+
 2012-12-16  Anders Carlsson  <[email protected]>
 
         Authentication manager cleanup

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp (137862 => 137863)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp	2012-12-17 01:51:18 UTC (rev 137862)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp	2012-12-17 02:10:28 UTC (rev 137863)
@@ -139,6 +139,7 @@
         purgeBackingStores();
         m_coordinator->detachLayer(this);
     }
+    ASSERT(!m_coordinatedImageBacking && !m_mainBackingStore);
     willBeDestroyed();
 }
 
@@ -735,28 +736,26 @@
 
 PassOwnPtr<GraphicsContext> CoordinatedGraphicsLayer::beginContentUpdate(const IntSize& size, uint32_t& atlas, IntPoint& offset)
 {
-    if (!m_coordinator)
-        return PassOwnPtr<WebCore::GraphicsContext>();
-
+    ASSERT(m_coordinator);
     return m_coordinator->beginContentUpdate(size, contentsOpaque() ? CoordinatedSurface::NoFlags : CoordinatedSurface::SupportsAlpha, atlas, offset);
 }
 
 void CoordinatedGraphicsLayer::createTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const WebCore::IntRect& tileRect)
 {
-    if (m_coordinator)
-        m_coordinator->createTile(id(), tileID, updateInfo, tileRect);
+    ASSERT(m_coordinator);
+    m_coordinator->createTile(id(), tileID, updateInfo, tileRect);
 }
 
 void CoordinatedGraphicsLayer::updateTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const IntRect& tileRect)
 {
-    if (m_coordinator)
-        m_coordinator->updateTile(id(), tileID, updateInfo, tileRect);
+    ASSERT(m_coordinator);
+    m_coordinator->updateTile(id(), tileID, updateInfo, tileRect);
 }
 
 void CoordinatedGraphicsLayer::removeTile(uint32_t tileID)
 {
-    if (m_coordinator)
-        m_coordinator->removeTile(id(), tileID);
+    ASSERT(m_coordinator);
+    m_coordinator->removeTile(id(), tileID);
 }
 
 void CoordinatedGraphicsLayer::updateContentBuffers()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (137862 => 137863)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2012-12-17 01:51:18 UTC (rev 137862)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2012-12-17 02:10:28 UTC (rev 137863)
@@ -71,6 +71,7 @@
 #if ENABLE(CSS_SHADERS)
     disconnectCustomFilterPrograms();
 #endif
+    purgeBackingStores();
 
     // Prevent setCoordinatedGraphicsLayerClient(0) -> detachLayer() from modifying the set while we iterate it.
     HashSet<WebCore::CoordinatedGraphicsLayer*> registeredLayers;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to