summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmanuele Aina <emanuele.aina@collabora.com>2015-05-13 18:21:02 (GMT)
committerEmanuele Aina <emanuele.aina@collabora.com>2015-06-23 19:41:14 (GMT)
commitcec8357836f3595d2c0a9d3fd7066b74bae8cb1d (patch)
treef5a851867f6485e74f0f04b1c34215de5a263077
parent40c247b783fca9b1f9f0662f733ae83c85650a90 (diff)
downloadWebKit-cec8357836f3595d2c0a9d3fd7066b74bae8cb1d.tar.gz
WebKit-cec8357836f3595d2c0a9d3fd7066b74bae8cb1d.tar.xz
[TBS] Paint empty documents directly to screen
Allocating buffers for each tile on empty pages like about:blank wastes a lot of memory for what is ultimately a solid fill. Detect such cases and skip updating tile buffers altogether, painting contents directly to screen.
-rw-r--r--Source/WebCore/page/Frame.cpp9
-rw-r--r--Source/WebCore/page/Frame.h1
-rw-r--r--Source/WebCore/platform/graphics/TiledBackingStore.cpp8
-rw-r--r--Source/WebCore/platform/graphics/TiledBackingStoreClient.h1
4 files changed, 19 insertions, 0 deletions
diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp
index 5f58789..31131eb 100644
--- a/Source/WebCore/page/Frame.cpp
+++ b/Source/WebCore/page/Frame.cpp
@@ -1002,6 +1002,15 @@ Color Frame::tiledBackingStoreBackgroundColor() const
return Color();
return m_view->baseBackgroundColor();
}
+
+bool Frame::tiledBackingStoreHasContents() const
+{
+ if (!contentRenderer())
+ return true;
+ if (!contentRenderer()->lastLeafChild())
+ return true;
+ return !contentRenderer()->lastLeafChild()->isBody();
+}
#endif
String Frame::layerTreeAsText(LayerTreeFlags flags) const
diff --git a/Source/WebCore/page/Frame.h b/Source/WebCore/page/Frame.h
index 1631ca7..0192f0c 100644
--- a/Source/WebCore/page/Frame.h
+++ b/Source/WebCore/page/Frame.h
@@ -359,6 +359,7 @@ namespace WebCore {
virtual IntRect tiledBackingStoreContentsRect() override final;
virtual IntRect tiledBackingStoreVisibleRect() override final;
virtual Color tiledBackingStoreBackgroundColor() const override final;
+ virtual bool tiledBackingStoreHasContents() const override final;
OwnPtr<TiledBackingStore> m_tiledBackingStore;
#endif
diff --git a/Source/WebCore/platform/graphics/TiledBackingStore.cpp b/Source/WebCore/platform/graphics/TiledBackingStore.cpp
index 1de90a9..f699c4f 100644
--- a/Source/WebCore/platform/graphics/TiledBackingStore.cpp
+++ b/Source/WebCore/platform/graphics/TiledBackingStore.cpp
@@ -143,6 +143,9 @@ void TiledBackingStore::updateTileBuffers()
if (m_contentsFrozen)
return;
+ if (!m_client->tiledBackingStoreHasContents())
+ return;
+
#if PLATFORM(GTK)
if (G_UNLIKELY (m_debugFPS)) {
static gint count = 0;
@@ -212,6 +215,11 @@ void TiledBackingStore::paint(GraphicsContext* context, const IntRect& rect)
IntRect dirtyRect = mapFromContents(rect);
+ if (!m_client->tiledBackingStoreHasContents()) {
+ m_client->tiledBackingStorePaint(context, dirtyRect);
+ return;
+ }
+
Tile::Coordinate topLeft = tileCoordinateForPoint(dirtyRect.location());
Tile::Coordinate bottomRight = tileCoordinateForPoint(innerBottomRight(dirtyRect));
diff --git a/Source/WebCore/platform/graphics/TiledBackingStoreClient.h b/Source/WebCore/platform/graphics/TiledBackingStoreClient.h
index c0053db..1514b07 100644
--- a/Source/WebCore/platform/graphics/TiledBackingStoreClient.h
+++ b/Source/WebCore/platform/graphics/TiledBackingStoreClient.h
@@ -38,6 +38,7 @@ public:
virtual IntRect tiledBackingStoreContentsRect() = 0;
virtual IntRect tiledBackingStoreVisibleRect() = 0;
virtual Color tiledBackingStoreBackgroundColor() const = 0;
+ virtual bool tiledBackingStoreHasContents() const = 0;
};
#else