| Index: cc/tiled_layer_unittest.cc
|
| diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
|
| index dec320964b3b82b79c940be08e2ef41541b01c41..8a14b1dbc7057a207ae2c3ab40f2fa436fd37649 100644
|
| --- a/cc/tiled_layer_unittest.cc
|
| +++ b/cc/tiled_layer_unittest.cc
|
| @@ -14,6 +14,7 @@
|
| #include "cc/test/animation_test_common.h"
|
| #include "cc/test/fake_graphics_context.h"
|
| #include "cc/test/fake_layer_tree_host_client.h"
|
| +#include "cc/test/fake_proxy.h"
|
| #include "cc/test/geometry_test_utils.h"
|
| #include "cc/test/tiled_layer_test_common.h"
|
| #include "cc/test/web_compositor_initializer.h"
|
| @@ -49,35 +50,39 @@ private:
|
| class TiledLayerTest : public testing::Test {
|
| public:
|
| TiledLayerTest()
|
| - : m_compositorInitializer(0)
|
| + : m_proxy(0)
|
| + , m_compositorInitializer(0)
|
| , m_context(WebKit::createFakeGraphicsContext())
|
| , m_queue(make_scoped_ptr(new TextureUpdateQueue))
|
| - , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool))
|
| , m_occlusion(0)
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| + }
|
| +
|
| + virtual void SetUp()
|
| + {
|
| + m_layerTreeHost = LayerTreeHost::create(&m_fakeLayerImplTreeHostClient, m_settings, NULL);
|
| + m_proxy = m_layerTreeHost->proxy();
|
| + m_textureManager = PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool, m_proxy);
|
| + m_layerTreeHost->initializeRendererIfNeeded();
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(m_proxy);
|
| m_resourceProvider = ResourceProvider::create(m_context.get());
|
| }
|
|
|
| virtual ~TiledLayerTest()
|
| {
|
| textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get());
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(m_proxy);
|
| m_resourceProvider.reset();
|
| }
|
|
|
| - // Helper classes and functions that set the current thread to be the impl thread
|
| - // before doing the action that they wrap.
|
| class ScopedFakeTiledLayerImpl {
|
| public:
|
| ScopedFakeTiledLayerImpl(int id)
|
| {
|
| - DebugScopedSetImplThread implThread;
|
| m_layerImpl = new FakeTiledLayerImpl(id);
|
| }
|
| ~ScopedFakeTiledLayerImpl()
|
| {
|
| - DebugScopedSetImplThread implThread;
|
| delete m_layerImpl;
|
| }
|
| FakeTiledLayerImpl* get()
|
| @@ -93,31 +98,32 @@ public:
|
| };
|
| void textureManagerClearAllMemory(PrioritizedTextureManager* textureManager, ResourceProvider* resourceProvider)
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(m_proxy);
|
| textureManager->clearAllMemory(resourceProvider);
|
| textureManager->reduceMemory(resourceProvider);
|
| }
|
| void updateTextures()
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(m_proxy);
|
| DCHECK(m_queue);
|
| scoped_ptr<TextureUpdateController> updateController =
|
| TextureUpdateController::create(
|
| NULL,
|
| - Proxy::implThread(),
|
| + m_proxy->implThread(),
|
| m_queue.Pass(),
|
| - m_resourceProvider.get());
|
| + m_resourceProvider.get(),
|
| + m_proxy->hasImplThread());
|
| updateController->finalize();
|
| m_queue = make_scoped_ptr(new TextureUpdateQueue);
|
| }
|
| void layerPushPropertiesTo(FakeTiledLayer* layer, FakeTiledLayerImpl* layerImpl)
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(m_proxy);
|
| layer->pushPropertiesTo(layerImpl);
|
| }
|
| void layerUpdate(FakeTiledLayer* layer, TestOcclusionTracker* occluded)
|
| {
|
| - DebugScopedSetMainThread mainThread;
|
| + DebugScopedSetMainThread mainThread(m_proxy);
|
| layer->update(*m_queue.get(), occluded, m_stats);
|
| }
|
|
|
| @@ -157,12 +163,16 @@ public:
|
| }
|
|
|
| public:
|
| + Proxy* m_proxy;
|
| + LayerTreeSettings m_settings;
|
| WebKitTests::WebCompositorInitializer m_compositorInitializer;
|
| scoped_ptr<GraphicsContext> m_context;
|
| scoped_ptr<ResourceProvider> m_resourceProvider;
|
| scoped_ptr<TextureUpdateQueue> m_queue;
|
| RenderingStats m_stats;
|
| PriorityCalculator m_priorityCalculator;
|
| + FakeLayerImplTreeHostClient m_fakeLayerImplTreeHostClient;
|
| + scoped_ptr<LayerTreeHost> m_layerTreeHost;
|
| scoped_ptr<PrioritizedTextureManager> m_textureManager;
|
| TestOcclusionTracker* m_occlusion;
|
| };
|
| @@ -513,7 +523,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
|
| // Create a LayerTreeHost that has the right viewportsize,
|
| // so the layer is considered small enough.
|
| FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient;
|
| - scoped_ptr<LayerTreeHost> layerTreeHost = LayerTreeHost::create(&fakeLayerImplTreeHostClient, LayerTreeSettings());
|
| + scoped_ptr<LayerTreeHost> layerTreeHost = LayerTreeHost::create(&fakeLayerImplTreeHostClient, LayerTreeSettings(), NULL);
|
|
|
| bool runOutOfMemory[2] = {false, true};
|
| for (int i = 0; i < 2; i++) {
|
| @@ -779,10 +789,6 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
|
|
|
| TEST_F(TiledLayerTest, skipsDrawGetsReset)
|
| {
|
| - FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient;
|
| - scoped_ptr<LayerTreeHost> layerTreeHost = LayerTreeHost::create(&fakeLayerImplTreeHostClient, LayerTreeSettings());
|
| - ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded());
|
| -
|
| // Create two 300 x 300 tiled layers.
|
| IntSize contentBounds(300, 300);
|
| IntRect contentRect(IntPoint::zero(), contentBounds);
|
| @@ -790,8 +796,8 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset)
|
| // We have enough memory for only one of the two layers.
|
| int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel.
|
|
|
| - scoped_refptr<FakeTiledLayer> rootLayer = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
| - scoped_refptr<FakeTiledLayer> childLayer = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
| + scoped_refptr<FakeTiledLayer> rootLayer = make_scoped_refptr(new FakeTiledLayer(m_layerTreeHost->contentsTextureManager()));
|
| + scoped_refptr<FakeTiledLayer> childLayer = make_scoped_refptr(new FakeTiledLayer(m_layerTreeHost->contentsTextureManager()));
|
| rootLayer->addChild(childLayer);
|
|
|
| rootLayer->setBounds(contentBounds);
|
| @@ -803,25 +809,25 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset)
|
| rootLayer->invalidateContentRect(contentRect);
|
| childLayer->invalidateContentRect(contentRect);
|
|
|
| - layerTreeHost->setRootLayer(rootLayer);
|
| - layerTreeHost->setViewportSize(IntSize(300, 300), IntSize(300, 300));
|
| + m_layerTreeHost->setRootLayer(rootLayer);
|
| + m_layerTreeHost->setViewportSize(IntSize(300, 300), IntSize(300, 300));
|
|
|
| - layerTreeHost->updateLayers(*m_queue.get(), memoryLimit);
|
| + m_layerTreeHost->updateLayers(*m_queue.get(), memoryLimit);
|
|
|
| // We'll skip the root layer.
|
| EXPECT_TRUE(rootLayer->skipsDraw());
|
| EXPECT_FALSE(childLayer->skipsDraw());
|
|
|
| - layerTreeHost->commitComplete();
|
| + m_layerTreeHost->commitComplete();
|
|
|
| // Remove the child layer.
|
| rootLayer->removeAllChildren();
|
|
|
| - layerTreeHost->updateLayers(*m_queue.get(), memoryLimit);
|
| + m_layerTreeHost->updateLayers(*m_queue.get(), memoryLimit);
|
| EXPECT_FALSE(rootLayer->skipsDraw());
|
|
|
| - textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
|
| - layerTreeHost->setRootLayer(0);
|
| + textureManagerClearAllMemory(m_layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
|
| + m_layerTreeHost->setRootLayer(0);
|
| }
|
|
|
| TEST_F(TiledLayerTest, resizeToSmaller)
|
| @@ -855,115 +861,6 @@ TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
|
| layer->update(*m_queue.get(), 0, m_stats);
|
| }
|
|
|
| -TEST_F(TiledLayerTest, partialUpdates)
|
| -{
|
| - LayerTreeSettings settings;
|
| - settings.maxPartialTextureUpdates = 4;
|
| -
|
| - FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient;
|
| - scoped_ptr<LayerTreeHost> layerTreeHost = LayerTreeHost::create(&fakeLayerImplTreeHostClient, settings);
|
| - ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded());
|
| -
|
| - // Create one 300 x 200 tiled layer with 3 x 2 tiles.
|
| - IntSize contentBounds(300, 200);
|
| - IntRect contentRect(IntPoint::zero(), contentBounds);
|
| -
|
| - scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
| - layer->setBounds(contentBounds);
|
| - layer->setPosition(FloatPoint(0, 0));
|
| - layer->setVisibleContentRect(contentRect);
|
| - layer->invalidateContentRect(contentRect);
|
| -
|
| - layerTreeHost->setRootLayer(layer);
|
| - layerTreeHost->setViewportSize(IntSize(300, 200), IntSize(300, 200));
|
| -
|
| - // Full update of all 6 tiles.
|
| - layerTreeHost->updateLayers(
|
| - *m_queue.get(), std::numeric_limits<size_t>::max());
|
| - {
|
| - ScopedFakeTiledLayerImpl layerImpl(1);
|
| - EXPECT_EQ(6, m_queue->fullUploadSize());
|
| - EXPECT_EQ(0, m_queue->partialUploadSize());
|
| - updateTextures();
|
| - EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount());
|
| - EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| - layer->fakeLayerUpdater()->clearUpdateCount();
|
| - layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| - }
|
| - layerTreeHost->commitComplete();
|
| -
|
| - // Full update of 3 tiles and partial update of 3 tiles.
|
| - layer->invalidateContentRect(IntRect(0, 0, 300, 150));
|
| - layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| - {
|
| - ScopedFakeTiledLayerImpl layerImpl(1);
|
| - EXPECT_EQ(3, m_queue->fullUploadSize());
|
| - EXPECT_EQ(3, m_queue->partialUploadSize());
|
| - updateTextures();
|
| - EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount());
|
| - EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| - layer->fakeLayerUpdater()->clearUpdateCount();
|
| - layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| - }
|
| - layerTreeHost->commitComplete();
|
| -
|
| - // Partial update of 6 tiles.
|
| - layer->invalidateContentRect(IntRect(50, 50, 200, 100));
|
| - {
|
| - ScopedFakeTiledLayerImpl layerImpl(1);
|
| - layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| - EXPECT_EQ(2, m_queue->fullUploadSize());
|
| - EXPECT_EQ(4, m_queue->partialUploadSize());
|
| - updateTextures();
|
| - EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount());
|
| - EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| - layer->fakeLayerUpdater()->clearUpdateCount();
|
| - layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| - }
|
| - layerTreeHost->commitComplete();
|
| -
|
| - // Checkerboard all tiles.
|
| - layer->invalidateContentRect(IntRect(0, 0, 300, 200));
|
| - {
|
| - ScopedFakeTiledLayerImpl layerImpl(1);
|
| - layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| - }
|
| - layerTreeHost->commitComplete();
|
| -
|
| - // Partial update of 6 checkerboard tiles.
|
| - layer->invalidateContentRect(IntRect(50, 50, 200, 100));
|
| - {
|
| - ScopedFakeTiledLayerImpl layerImpl(1);
|
| - layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| - EXPECT_EQ(6, m_queue->fullUploadSize());
|
| - EXPECT_EQ(0, m_queue->partialUploadSize());
|
| - updateTextures();
|
| - EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount());
|
| - EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| - layer->fakeLayerUpdater()->clearUpdateCount();
|
| - layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| - }
|
| - layerTreeHost->commitComplete();
|
| -
|
| - // Partial update of 4 tiles.
|
| - layer->invalidateContentRect(IntRect(50, 50, 100, 100));
|
| - {
|
| - ScopedFakeTiledLayerImpl layerImpl(1);
|
| - layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| - EXPECT_EQ(0, m_queue->fullUploadSize());
|
| - EXPECT_EQ(4, m_queue->partialUploadSize());
|
| - updateTextures();
|
| - EXPECT_EQ(4, layer->fakeLayerUpdater()->updateCount());
|
| - EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| - layer->fakeLayerUpdater()->clearUpdateCount();
|
| - layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| - }
|
| - layerTreeHost->commitComplete();
|
| -
|
| - textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
|
| - layerTreeHost->setRootLayer(0);
|
| -}
|
| -
|
| TEST_F(TiledLayerTest, tilesPaintedWithoutOcclusion)
|
| {
|
| scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
|
| @@ -1379,15 +1276,10 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
| IntRect childRect(0, 0, 300, 100);
|
| IntRect child2Rect(0, 100, 300, 100);
|
|
|
| - LayerTreeSettings settings;
|
| - FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient;
|
| - scoped_ptr<LayerTreeHost> layerTreeHost = LayerTreeHost::create(&fakeLayerImplTreeHostClient, settings);
|
| - ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded());
|
| -
|
| - scoped_refptr<FakeTiledLayer> root = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
| + scoped_refptr<FakeTiledLayer> root = make_scoped_refptr(new FakeTiledLayer(m_layerTreeHost->contentsTextureManager()));
|
| scoped_refptr<Layer> surface = Layer::create();
|
| - scoped_refptr<FakeTiledLayer> child = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
| - scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
| + scoped_refptr<FakeTiledLayer> child = make_scoped_refptr(new FakeTiledLayer(m_layerTreeHost->contentsTextureManager()));
|
| + scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(new FakeTiledLayer(m_layerTreeHost->contentsTextureManager()));
|
|
|
| root->setBounds(rootRect.size());
|
| root->setAnchorPoint(FloatPoint());
|
| @@ -1413,14 +1305,14 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
| child2->setVisibleContentRect(child2Rect);
|
| child2->setDrawableContentRect(rootRect);
|
|
|
| - layerTreeHost->setRootLayer(root);
|
| - layerTreeHost->setViewportSize(rootRect.size(), rootRect.size());
|
| + m_layerTreeHost->setRootLayer(root);
|
| + m_layerTreeHost->setViewportSize(rootRect.size(), rootRect.size());
|
|
|
| // With a huge memory limit, all layers should update and push their textures.
|
| root->invalidateContentRect(rootRect);
|
| child->invalidateContentRect(childRect);
|
| child2->invalidateContentRect(child2Rect);
|
| - layerTreeHost->updateLayers(
|
| + m_layerTreeHost->updateLayers(
|
| *m_queue.get(), std::numeric_limits<size_t>::max());
|
| {
|
| updateTextures();
|
| @@ -1447,7 +1339,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
| EXPECT_TRUE(child2Impl->hasResourceIdForTileAt(i, 0));
|
| }
|
| }
|
| - layerTreeHost->commitComplete();
|
| + m_layerTreeHost->commitComplete();
|
|
|
| // With a memory limit that includes only the root layer (3x2 tiles) and half the surface that
|
| // the child layers draw into, the child layers will not be allocated. If the surface isn't
|
| @@ -1455,7 +1347,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
| root->invalidateContentRect(rootRect);
|
| child->invalidateContentRect(childRect);
|
| child2->invalidateContentRect(child2Rect);
|
| - layerTreeHost->updateLayers(
|
| + m_layerTreeHost->updateLayers(
|
| *m_queue.get(), (3 * 2 + 3 * 1) * (100 * 100) * 4);
|
| {
|
| updateTextures();
|
| @@ -1482,7 +1374,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
| EXPECT_FALSE(child2Impl->hasResourceIdForTileAt(i, 0));
|
| }
|
| }
|
| - layerTreeHost->commitComplete();
|
| + m_layerTreeHost->commitComplete();
|
|
|
| // With a memory limit that includes only half the root layer, no contents will be
|
| // allocated. If render surface memory wasn't accounted for, there is enough space
|
| @@ -1491,7 +1383,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
| root->invalidateContentRect(rootRect);
|
| child->invalidateContentRect(childRect);
|
| child2->invalidateContentRect(child2Rect);
|
| - layerTreeHost->updateLayers(
|
| + m_layerTreeHost->updateLayers(
|
| *m_queue.get(), (3 * 1) * (100 * 100) * 4);
|
| {
|
| updateTextures();
|
| @@ -1518,10 +1410,10 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
| EXPECT_FALSE(child2Impl->hasResourceIdForTileAt(i, 0));
|
| }
|
| }
|
| - layerTreeHost->commitComplete();
|
| + m_layerTreeHost->commitComplete();
|
|
|
| - textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
|
| - layerTreeHost->setRootLayer(0);
|
| + textureManagerClearAllMemory(m_layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
|
| + m_layerTreeHost->setRootLayer(0);
|
| }
|
|
|
| class TrackingLayerPainter : public LayerPainter {
|
| @@ -1625,4 +1517,115 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
|
| EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect());
|
| }
|
|
|
| +class TiledLayerPartialUpdateTest : public TiledLayerTest
|
| +{
|
| +public:
|
| + TiledLayerPartialUpdateTest()
|
| + {
|
| + m_settings.maxPartialTextureUpdates = 4;
|
| + }
|
| +};
|
| +
|
| +TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
|
| +{
|
| + // Create one 300 x 200 tiled layer with 3 x 2 tiles.
|
| + IntSize contentBounds(300, 200);
|
| + IntRect contentRect(IntPoint::zero(), contentBounds);
|
| +
|
| + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_layerTreeHost->contentsTextureManager()));
|
| + layer->setBounds(contentBounds);
|
| + layer->setPosition(FloatPoint(0, 0));
|
| + layer->setVisibleContentRect(contentRect);
|
| + layer->invalidateContentRect(contentRect);
|
| +
|
| + m_layerTreeHost->setRootLayer(layer);
|
| + m_layerTreeHost->setViewportSize(IntSize(300, 200), IntSize(300, 200));
|
| +
|
| + // Full update of all 6 tiles.
|
| + m_layerTreeHost->updateLayers(
|
| + *m_queue.get(), std::numeric_limits<size_t>::max());
|
| + {
|
| + ScopedFakeTiledLayerImpl layerImpl(1);
|
| + EXPECT_EQ(6, m_queue->fullUploadSize());
|
| + EXPECT_EQ(0, m_queue->partialUploadSize());
|
| + updateTextures();
|
| + EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount());
|
| + EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| + layer->fakeLayerUpdater()->clearUpdateCount();
|
| + layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| + }
|
| + m_layerTreeHost->commitComplete();
|
| +
|
| + // Full update of 3 tiles and partial update of 3 tiles.
|
| + layer->invalidateContentRect(IntRect(0, 0, 300, 150));
|
| + m_layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| + {
|
| + ScopedFakeTiledLayerImpl layerImpl(1);
|
| + EXPECT_EQ(3, m_queue->fullUploadSize());
|
| + EXPECT_EQ(3, m_queue->partialUploadSize());
|
| + updateTextures();
|
| + EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount());
|
| + EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| + layer->fakeLayerUpdater()->clearUpdateCount();
|
| + layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| + }
|
| + m_layerTreeHost->commitComplete();
|
| +
|
| + // Partial update of 6 tiles.
|
| + layer->invalidateContentRect(IntRect(50, 50, 200, 100));
|
| + {
|
| + ScopedFakeTiledLayerImpl layerImpl(1);
|
| + m_layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| + EXPECT_EQ(2, m_queue->fullUploadSize());
|
| + EXPECT_EQ(4, m_queue->partialUploadSize());
|
| + updateTextures();
|
| + EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount());
|
| + EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| + layer->fakeLayerUpdater()->clearUpdateCount();
|
| + layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| + }
|
| + m_layerTreeHost->commitComplete();
|
| +
|
| + // Checkerboard all tiles.
|
| + layer->invalidateContentRect(IntRect(0, 0, 300, 200));
|
| + {
|
| + ScopedFakeTiledLayerImpl layerImpl(1);
|
| + layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| + }
|
| + m_layerTreeHost->commitComplete();
|
| +
|
| + // Partial update of 6 checkerboard tiles.
|
| + layer->invalidateContentRect(IntRect(50, 50, 200, 100));
|
| + {
|
| + ScopedFakeTiledLayerImpl layerImpl(1);
|
| + m_layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| + EXPECT_EQ(6, m_queue->fullUploadSize());
|
| + EXPECT_EQ(0, m_queue->partialUploadSize());
|
| + updateTextures();
|
| + EXPECT_EQ(6, layer->fakeLayerUpdater()->updateCount());
|
| + EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| + layer->fakeLayerUpdater()->clearUpdateCount();
|
| + layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| + }
|
| + m_layerTreeHost->commitComplete();
|
| +
|
| + // Partial update of 4 tiles.
|
| + layer->invalidateContentRect(IntRect(50, 50, 100, 100));
|
| + {
|
| + ScopedFakeTiledLayerImpl layerImpl(1);
|
| + m_layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| + EXPECT_EQ(0, m_queue->fullUploadSize());
|
| + EXPECT_EQ(4, m_queue->partialUploadSize());
|
| + updateTextures();
|
| + EXPECT_EQ(4, layer->fakeLayerUpdater()->updateCount());
|
| + EXPECT_FALSE(m_queue->hasMoreUpdates());
|
| + layer->fakeLayerUpdater()->clearUpdateCount();
|
| + layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| + }
|
| + m_layerTreeHost->commitComplete();
|
| +
|
| + textureManagerClearAllMemory(m_layerTreeHost->contentsTextureManager(), m_resourceProvider.get());
|
| + m_layerTreeHost->setRootLayer(0);
|
| +}
|
| +
|
| } // namespace
|
|
|