Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3392)

Unified Diff: cc/tiled_layer_unittest.cc

Issue 11519018: [cc] Make LayerImpls point at LayerTreeImpl instead of LTHI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/tiled_layer_unittest.cc
diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
index d23df5f5c83286a7b41ef7af4c69656dbb4bedae..10f05eac58c262bc87f05549e159429c6204492d 100644
--- a/cc/tiled_layer_unittest.cc
+++ b/cc/tiled_layer_unittest.cc
@@ -76,9 +76,9 @@ public:
class ScopedFakeTiledLayerImpl {
public:
- ScopedFakeTiledLayerImpl(LayerTreeHostImpl* hostImpl, int id)
+ ScopedFakeTiledLayerImpl(LayerTreeImpl* treeImpl, int id)
{
- m_layerImpl = new FakeTiledLayerImpl(hostImpl, id);
+ m_layerImpl = new FakeTiledLayerImpl(treeImpl, id);
}
~ScopedFakeTiledLayerImpl()
{
@@ -182,7 +182,7 @@ public:
TEST_F(TiledLayerTest, pushDirtyTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->setBounds(gfx::Size(100, 200));
@@ -208,7 +208,7 @@ TEST_F(TiledLayerTest, pushDirtyTiles)
TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
TestOcclusionTracker occluded;
m_occlusion = &occluded;
@@ -245,7 +245,7 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
TEST_F(TiledLayerTest, pushDeletedTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->setBounds(gfx::Size(100, 200));
@@ -280,7 +280,7 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
TEST_F(TiledLayerTest, pushIdlePaintTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
// This paints 1 visible of the 25 invalid tiles.
@@ -316,7 +316,7 @@ TEST_F(TiledLayerTest, pushIdlePaintTiles)
TEST_F(TiledLayerTest, predictivePainting)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// Prepainting should occur in the scroll direction first, and the
// visible rect should be extruded only along the dominant axis.
@@ -390,9 +390,9 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
// Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later.
m_resourceManager->setMaxMemoryLimitBytes(2 * 1024 * 1024);
scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl1(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl1(m_hostImpl->activeTree(), 1);
scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl2(m_hostImpl.get(), 2);
+ ScopedFakeTiledLayerImpl layerImpl2(m_hostImpl->activeTree(), 2);
// For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from
// layer2, but not all three tiles. First we paint layer1, and one tile from layer2. Then when we idle paint
@@ -442,7 +442,7 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
TestOcclusionTracker occluded;
m_occlusion = &occluded;
@@ -461,7 +461,7 @@ TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles)
TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
// However, during the paint, we invalidate one of the tiles. This should
@@ -480,8 +480,8 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
{
scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layer1Impl(m_hostImpl.get(), 1);
- ScopedFakeTiledLayerImpl layer2Impl(m_hostImpl.get(), 2);
+ ScopedFakeTiledLayerImpl layer1Impl(m_hostImpl->activeTree(), 1);
+ ScopedFakeTiledLayerImpl layer2Impl(m_hostImpl->activeTree(), 2);
// Invalidate a tile on layer1, during update of layer 2.
layer2->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer1.get());
@@ -503,8 +503,8 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer)
{
scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layer1Impl(m_hostImpl.get(), 1);
- ScopedFakeTiledLayerImpl layer2Impl(m_hostImpl.get(), 2);
+ ScopedFakeTiledLayerImpl layer1Impl(m_hostImpl->activeTree(), 1);
+ ScopedFakeTiledLayerImpl layer2Impl(m_hostImpl->activeTree(), 2);
layer1->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer2.get());
layer1->setBounds(gfx::Size(100, 200));
@@ -545,7 +545,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
m_resourceManager->setMaxMemoryLimitBytes(memoryForLayer);
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// Full size layer with half being visible.
gfx::Size contentBounds(layerWidth, layerHeight);
@@ -587,7 +587,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
TEST_F(TiledLayerTest, idlePaintOutOfMemory)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// We have enough memory for only the visible rect, so we will run out of memory in first idle paint.
int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel.
@@ -610,7 +610,7 @@ TEST_F(TiledLayerTest, idlePaintOutOfMemory)
TEST_F(TiledLayerTest, idlePaintZeroSizedLayer)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
bool animating[2] = {false, true};
for (int i = 0; i < 2; i++) {
@@ -637,7 +637,7 @@ TEST_F(TiledLayerTest, idlePaintZeroSizedLayer)
TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// Alternate between not visible and visible.
gfx::Rect v(0, 0, 100, 100);
@@ -667,7 +667,7 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
TEST_F(TiledLayerTest, invalidateFromPrepare)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->setBounds(gfx::Size(100, 200));
@@ -740,7 +740,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
// Create a layer with one tile.
layer->setBounds(gfx::Size(100, 100));
@@ -892,7 +892,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
m_layerTreeHost->updateLayers(
*m_queue.get(), std::numeric_limits<size_t>::max());
{
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
EXPECT_EQ(6, m_queue->fullUploadSize());
EXPECT_EQ(0, m_queue->partialUploadSize());
updateTextures();
@@ -907,7 +907,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
layer->invalidateContentRect(gfx::Rect(0, 0, 300, 150));
m_layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
{
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
EXPECT_EQ(3, m_queue->fullUploadSize());
EXPECT_EQ(3, m_queue->partialUploadSize());
updateTextures();
@@ -921,7 +921,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
// Partial update of 6 tiles.
layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
{
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 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());
@@ -936,7 +936,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
// Checkerboard all tiles.
layer->invalidateContentRect(gfx::Rect(0, 0, 300, 200));
{
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 1);
layerPushPropertiesTo(layer.get(), layerImpl.get());
}
m_layerTreeHost->commitComplete();
@@ -944,7 +944,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
// Partial update of 6 checkerboard tiles.
layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
{
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 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());
@@ -959,7 +959,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
// Partial update of 4 tiles.
layer->invalidateContentRect(gfx::Rect(50, 50, 100, 100));
{
- ScopedFakeTiledLayerImpl layerImpl(m_hostImpl.get(), 1);
+ ScopedFakeTiledLayerImpl layerImpl(m_hostImpl->activeTree(), 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());
@@ -1439,9 +1439,9 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
child->fakeLayerUpdater()->clearUpdateCount();
child2->fakeLayerUpdater()->clearUpdateCount();
- ScopedFakeTiledLayerImpl rootImpl(m_hostImpl.get(), root->id());
- ScopedFakeTiledLayerImpl childImpl(m_hostImpl.get(), child->id());
- ScopedFakeTiledLayerImpl child2Impl(m_hostImpl.get(), child2->id());
+ ScopedFakeTiledLayerImpl rootImpl(m_hostImpl->activeTree(), root->id());
+ ScopedFakeTiledLayerImpl childImpl(m_hostImpl->activeTree(), child->id());
+ ScopedFakeTiledLayerImpl child2Impl(m_hostImpl->activeTree(), child2->id());
layerPushPropertiesTo(root.get(), rootImpl.get());
layerPushPropertiesTo(child.get(), childImpl.get());
layerPushPropertiesTo(child2.get(), child2Impl.get());
@@ -1474,9 +1474,9 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
child->fakeLayerUpdater()->clearUpdateCount();
child2->fakeLayerUpdater()->clearUpdateCount();
- ScopedFakeTiledLayerImpl rootImpl(m_hostImpl.get(), root->id());
- ScopedFakeTiledLayerImpl childImpl(m_hostImpl.get(), child->id());
- ScopedFakeTiledLayerImpl child2Impl(m_hostImpl.get(), child2->id());
+ ScopedFakeTiledLayerImpl rootImpl(m_hostImpl->activeTree(), root->id());
+ ScopedFakeTiledLayerImpl childImpl(m_hostImpl->activeTree(), child->id());
+ ScopedFakeTiledLayerImpl child2Impl(m_hostImpl->activeTree(), child2->id());
layerPushPropertiesTo(root.get(), rootImpl.get());
layerPushPropertiesTo(child.get(), childImpl.get());
layerPushPropertiesTo(child2.get(), child2Impl.get());
@@ -1510,9 +1510,9 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
child->fakeLayerUpdater()->clearUpdateCount();
child2->fakeLayerUpdater()->clearUpdateCount();
- ScopedFakeTiledLayerImpl rootImpl(m_hostImpl.get(), root->id());
- ScopedFakeTiledLayerImpl childImpl(m_hostImpl.get(), child->id());
- ScopedFakeTiledLayerImpl child2Impl(m_hostImpl.get(), child2->id());
+ ScopedFakeTiledLayerImpl rootImpl(m_hostImpl->activeTree(), root->id());
+ ScopedFakeTiledLayerImpl childImpl(m_hostImpl->activeTree(), child->id());
+ ScopedFakeTiledLayerImpl child2Impl(m_hostImpl->activeTree(), child2->id());
layerPushPropertiesTo(root.get(), rootImpl.get());
layerPushPropertiesTo(child.get(), childImpl.get());
layerPushPropertiesTo(child2.get(), child2Impl.get());
« cc/layer.h ('K') | « cc/tiled_layer_impl_unittest.cc ('k') | cc/tree_synchronizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698