Index: cc/tiled_layer_unittest.cc |
diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc |
index 4bc3ff09c73d9bffba563d48e2fed779232fa645..9729c906c87a7d78af85952f12d3797cb9f82f63 100644 |
--- a/cc/tiled_layer_unittest.cc |
+++ b/cc/tiled_layer_unittest.cc |
@@ -15,6 +15,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 "testing/gtest/include/gtest/gtest.h" |
@@ -48,34 +49,38 @@ private: |
class TiledLayerTest : public testing::Test { |
public: |
TiledLayerTest() |
- : m_context(WebKit::createFakeGraphicsContext()) |
+ : m_proxy(NULL) |
+ , m_context(WebKit::createFakeGraphicsContext()) |
, m_queue(make_scoped_ptr(new ResourceUpdateQueue)) |
- , 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() |
@@ -91,31 +96,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<ResourceUpdateController> updateController = |
ResourceUpdateController::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 ResourceUpdateQueue); |
} |
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); |
} |
@@ -155,11 +161,15 @@ public: |
} |
public: |
+ Proxy* m_proxy; |
+ LayerTreeSettings m_settings; |
scoped_ptr<GraphicsContext> m_context; |
scoped_ptr<ResourceProvider> m_resourceProvider; |
scoped_ptr<ResourceUpdateQueue> m_queue; |
RenderingStats m_stats; |
PriorityCalculator m_priorityCalculator; |
+ FakeLayerImplTreeHostClient m_fakeLayerImplTreeHostClient; |
+ scoped_ptr<LayerTreeHost> m_layerTreeHost; |
scoped_ptr<PrioritizedTextureManager> m_textureManager; |
TestOcclusionTracker* m_occlusion; |
}; |
@@ -511,7 +521,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++) { |
@@ -777,10 +787,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); |
@@ -788,8 +794,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); |
@@ -801,25 +807,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) |
@@ -853,115 +859,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())); |
@@ -1380,15 +1277,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()); |
@@ -1414,14 +1306,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(); |
@@ -1448,7 +1340,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 |
@@ -1456,7 +1348,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(); |
@@ -1483,7 +1375,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 |
@@ -1492,7 +1384,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(); |
@@ -1519,10 +1411,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 { |
@@ -1626,4 +1518,114 @@ 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 |