diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-09 09:42:44 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-09 09:42:44 +0100 |
commit | a59391482883479a9b28a6f1ace6d1ebd08a7ecd (patch) | |
tree | fa539db054a20a67bff2fc891c33b0f4ec632916 /Source/WebKit2/UIProcess/CoordinatedGraphics | |
parent | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (diff) | |
download | qtwebkit-a59391482883479a9b28a6f1ace6d1ebd08a7ecd.tar.gz |
Imported WebKit commit 7bcdfab9a40db7d16b4b95bb77d78b8a59c9e701 (http://svn.webkit.org/repository/webkit/trunk@134025)
New snapshot with numerious build fixes, including MSVC 2012 and ARM Thumb-2.
Diffstat (limited to 'Source/WebKit2/UIProcess/CoordinatedGraphics')
5 files changed, 28 insertions, 8 deletions
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp index a569b9e78..7cb9842cf 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp @@ -72,10 +72,10 @@ void CoordinatedBackingStore::createTile(int id, float scale) void CoordinatedBackingStore::removeTile(int id) { - m_tilesToRemove.append(id); + ASSERT(m_tiles.contains(id)); + m_tilesToRemove.add(id); } - void CoordinatedBackingStore::updateTile(int id, const IntRect& sourceRect, const IntRect& targetRect, PassRefPtr<ShareableSurface> backBuffer, const IntPoint& offset) { HashMap<int, CoordinatedBackingStoreTile>::iterator it = m_tiles.find(id); @@ -84,6 +84,11 @@ void CoordinatedBackingStore::updateTile(int id, const IntRect& sourceRect, cons it->value.setBackBuffer(targetRect, sourceRect, backBuffer, offset); } +bool CoordinatedBackingStore::isEmpty() const +{ + return m_tiles.size() == m_tilesToRemove.size(); +} + PassRefPtr<BitmapTexture> CoordinatedBackingStore::texture() const { HashMap<int, CoordinatedBackingStoreTile>::const_iterator end = m_tiles.end(); @@ -149,8 +154,8 @@ void CoordinatedBackingStore::paintToTextureMapper(TextureMapper* textureMapper, void CoordinatedBackingStore::commitTileOperations(TextureMapper* textureMapper) { - Vector<int>::iterator tilesToRemoveEnd = m_tilesToRemove.end(); - for (Vector<int>::iterator it = m_tilesToRemove.begin(); it != tilesToRemoveEnd; ++it) + HashSet<int>::iterator tilesToRemoveEnd = m_tilesToRemove.end(); + for (HashSet<int>::iterator it = m_tilesToRemove.begin(); it != tilesToRemoveEnd; ++it) m_tiles.remove(*it); m_tilesToRemove.clear(); diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h index 637feba70..fe6e4aa15 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h @@ -25,6 +25,7 @@ #include "TextureMapper.h" #include "TextureMapperBackingStore.h" #include <wtf/HashMap.h> +#include <wtf/HashSet.h> namespace WebKit { @@ -59,6 +60,7 @@ public: void createTile(int, float); void removeTile(int); void updateTile(int, const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface>, const WebCore::IntPoint&); + bool isEmpty() const; static PassRefPtr<CoordinatedBackingStore> create() { return adoptRef(new CoordinatedBackingStore); } void commitTileOperations(WebCore::TextureMapper*); PassRefPtr<WebCore::BitmapTexture> texture() const; @@ -69,7 +71,7 @@ private: : m_scale(1.) { } HashMap<int, CoordinatedBackingStoreTile> m_tiles; - Vector<int> m_tilesToRemove; + HashSet<int> m_tilesToRemove; float m_scale; }; diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp index 4d43feb81..1d6e5aefe 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp @@ -201,6 +201,7 @@ void LayerTreeCoordinatorProxy::syncCanvas(uint32_t id, const IntSize& canvasSiz void LayerTreeCoordinatorProxy::purgeBackingStores() { + m_surfaces.clear(); m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeCoordinator::PurgeBackingStores(), m_drawingAreaProxy->page()->pageID()); } diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp index bd92f7249..6436d55ee 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp @@ -367,6 +367,16 @@ PassRefPtr<CoordinatedBackingStore> LayerTreeRenderer::getBackingStore(WebLayerI return backingStore; } +void LayerTreeRenderer::removeBackingStoreIfNeeded(WebLayerID layerID, int /*tileID*/) +{ + TextureMapperLayer* layer = toTextureMapperLayer(layerByID(layerID)); + ASSERT(layer); + RefPtr<CoordinatedBackingStore> backingStore = static_cast<CoordinatedBackingStore*>(layer->backingStore().get()); + ASSERT(backingStore); + if (backingStore->isEmpty()) + layer->setBackingStore(0); +} + void LayerTreeRenderer::createTile(WebLayerID layerID, int tileID, float scale) { getBackingStore(layerID)->createTile(tileID, scale); @@ -375,6 +385,7 @@ void LayerTreeRenderer::createTile(WebLayerID layerID, int tileID, float scale) void LayerTreeRenderer::removeTile(WebLayerID layerID, int tileID) { getBackingStore(layerID)->removeTile(tileID); + removeBackingStoreIfNeeded(layerID, tileID); } void LayerTreeRenderer::updateTile(WebLayerID layerID, int tileID, const TileUpdate& update) diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h index ebe4ca391..1dccbbcf9 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h @@ -120,6 +120,9 @@ private: void renderNextFrame(); void purgeBackingStores(); + PassRefPtr<CoordinatedBackingStore> getBackingStore(WebLayerID); + void removeBackingStoreIfNeeded(WebLayerID, int tileID); + typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerMap; WebCore::FloatSize m_contentsSize; WebCore::FloatRect m_visibleContentsRect; @@ -128,12 +131,10 @@ private: Vector<Function<void()> > m_renderQueue; Mutex m_renderQueueMutex; -#if USE(TEXTURE_MAPPER) OwnPtr<WebCore::TextureMapper> m_textureMapper; - PassRefPtr<CoordinatedBackingStore> getBackingStore(WebLayerID); HashMap<int64_t, RefPtr<WebCore::TextureMapperBackingStore> > m_directlyCompositedImages; HashSet<RefPtr<CoordinatedBackingStore> > m_backingStoresWithPendingBuffers; -#endif + #if USE(GRAPHICS_SURFACE) typedef HashMap<WebLayerID, RefPtr<WebCore::TextureMapperSurfaceBackingStore> > SurfaceBackingStoreMap; SurfaceBackingStoreMap m_surfaceBackingStores; |