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

Side by Side Diff: cc/resources/picture_layer_tiling_unittest.cc

Issue 502453003: cc: Remove tiles from recycle tree that were deleted on active. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't maintain recycled twin Created 6 years, 3 months 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 unified diff | Download patch
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/picture_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 1941
1942 tiling->Reset(); 1942 tiling->Reset();
1943 for (std::vector<scoped_refptr<Tile> >::const_iterator it = tiles.begin(); 1943 for (std::vector<scoped_refptr<Tile> >::const_iterator it = tiles.begin();
1944 it != tiles.end(); 1944 it != tiles.end();
1945 ++it) { 1945 ++it) {
1946 EXPECT_EQ(TilePriority(), (*it)->priority(ACTIVE_TREE)); 1946 EXPECT_EQ(TilePriority(), (*it)->priority(ACTIVE_TREE));
1947 } 1947 }
1948 tiles.clear(); 1948 tiles.clear();
1949 } 1949 }
1950 1950
1951 TEST(PictureLayerTilingTest, RecycledTilesCleared) {
1952 // This test performs the following:
1953 // Setup:
1954 // - Two tilings, one active one recycled with all tiles shared.
1955 // Procedure:
1956 // - Viewport moves somewhere far away and active tiling clears tiles.
1957 // - Viewport moves back and a new active tiling tile is created.
1958 // Result:
1959 // - Recycle tiling does _not_ have the tile in the same location (thus it
1960 // will be shared next time a pending tiling is created).
1961
1962 FakePictureLayerTilingClient client;
1963 scoped_ptr<TestablePictureLayerTiling> tiling;
1964
1965 client.SetTileSize(gfx::Size(100, 100));
1966 client.set_tree(ACTIVE_TREE);
1967 client.set_max_tiles_for_interest_area(10);
1968 tiling = TestablePictureLayerTiling::Create(1.0f, // contents_scale
1969 gfx::Size(10000, 10000),
1970 &client);
1971 // Create all tiles on this tiling.
1972 tiling->UpdateTilePriorities(ACTIVE_TREE,
1973 gfx::Rect(0, 0, 100, 100),
1974 1.0f,
1975 1.0f,
1976 NULL, // occlusion tracker
1977 NULL, // render target
1978 gfx::Transform()); // draw transform
1979
1980 FakePictureLayerTilingClient second_client;
1981 second_client.SetTileSize(gfx::Size(100, 100));
1982 second_client.set_tree(PENDING_TREE);
1983 second_client.set_twin_tiling(tiling.get());
1984 second_client.set_max_tiles_for_interest_area(10);
1985
1986 scoped_ptr<TestablePictureLayerTiling> second_tiling;
1987 second_tiling = TestablePictureLayerTiling::Create(1.0f, // contents_scale
1988 gfx::Size(10000, 10000),
1989 &second_client);
1990
1991 // Create all tiles on the second tiling. All tiles should be shared.
1992 second_tiling->UpdateTilePriorities(ACTIVE_TREE,
1993 gfx::Rect(0, 0, 100, 100),
1994 1.0f,
1995 1.0f,
1996 NULL, // occlusion tracker
1997 NULL, // render target
1998 gfx::Transform()); // draw transform
1999
2000 // Verify that tiles exist and are shared.
2001 ASSERT_TRUE(tiling->TileAt(0, 0));
2002 ASSERT_EQ(tiling->TileAt(0, 0), second_tiling->TileAt(0, 0));
2003
2004 // Set the second tiling as recycled.
2005 client.set_twin_tiling(NULL);
2006 client.set_recycled_twin_tiling(second_tiling.get());
2007 second_client.set_twin_tiling(NULL);
2008
2009 // Move the viewport far away from the (0, 0) tile.
2010 tiling->UpdateTilePriorities(ACTIVE_TREE,
2011 gfx::Rect(9000, 9000, 100, 100),
2012 1.0f,
2013 2.0,
2014 NULL, // occlusion tracker
2015 NULL, // render target
2016 gfx::Transform()); // draw transform
2017 // Ensure the tile was deleted.
2018 EXPECT_FALSE(tiling->TileAt(0, 0));
2019
2020 // Move the viewport back to (0, 0) tile.
2021 tiling->UpdateTilePriorities(ACTIVE_TREE,
2022 gfx::Rect(0, 0, 100, 100),
2023 1.0f,
2024 3.0,
2025 NULL, // occlusion tracker
2026 NULL, // render target
2027 gfx::Transform()); // draw transform
2028
2029 // Ensure that we now have a tile here, but the recycle tiling does not.
2030 EXPECT_TRUE(tiling->TileAt(0, 0));
2031 EXPECT_FALSE(second_tiling->TileAt(0, 0));
2032 }
2033
1951 } // namespace 2034 } // namespace
1952 } // namespace cc 2035 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698