Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) { | |
|
enne (OOO)
2014/08/22 23:01:05
For forgetful future ennes, could you leave a comm
vmpstr
2014/08/25 18:41:00
Done.
| |
| 1952 FakePictureLayerTilingClient client; | |
| 1953 scoped_ptr<TestablePictureLayerTiling> tiling; | |
| 1954 | |
| 1955 client.SetTileSize(gfx::Size(100, 100)); | |
| 1956 client.set_tree(ACTIVE_TREE); | |
| 1957 client.set_max_tiles_for_interest_area(10); | |
| 1958 tiling = TestablePictureLayerTiling::Create(1.0f, // contents_scale | |
| 1959 gfx::Size(10000, 10000), | |
| 1960 &client); | |
| 1961 tiling->UpdateTilePriorities(ACTIVE_TREE, | |
| 1962 gfx::Rect(0, 0, 100, 100), | |
| 1963 1.0f, | |
| 1964 1.0f, | |
| 1965 NULL, // occlusion tracker | |
| 1966 NULL, // render target | |
| 1967 gfx::Transform()); // draw transform | |
| 1968 | |
| 1969 FakePictureLayerTilingClient second_client; | |
| 1970 second_client.SetTileSize(gfx::Size(100, 100)); | |
| 1971 second_client.set_tree(PENDING_TREE); | |
| 1972 second_client.set_twin_tiling(tiling.get()); | |
| 1973 second_client.set_max_tiles_for_interest_area(10); | |
| 1974 | |
| 1975 scoped_ptr<TestablePictureLayerTiling> second_tiling; | |
| 1976 second_tiling = TestablePictureLayerTiling::Create(1.0f, // contents_scale | |
| 1977 gfx::Size(10000, 10000), | |
| 1978 &second_client); | |
| 1979 second_tiling->UpdateTilePriorities(ACTIVE_TREE, | |
| 1980 gfx::Rect(0, 0, 100, 100), | |
| 1981 1.0f, | |
| 1982 1.0f, | |
| 1983 NULL, // occlusion tracker | |
| 1984 NULL, // render target | |
| 1985 gfx::Transform()); // draw transform | |
| 1986 | |
| 1987 ASSERT_TRUE(tiling->TileAt(0, 0)); | |
| 1988 ASSERT_EQ(tiling->TileAt(0, 0), second_tiling->TileAt(0, 0)); | |
| 1989 | |
| 1990 client.set_twin_tiling(NULL); | |
| 1991 client.set_recycled_twin_tiling(second_tiling.get()); | |
| 1992 second_client.set_twin_tiling(NULL); | |
| 1993 tiling->UpdateTilePriorities(ACTIVE_TREE, | |
| 1994 gfx::Rect(9000, 9000, 100, 100), | |
| 1995 1.0f, | |
| 1996 2.0, | |
| 1997 NULL, // occlusion tracker | |
| 1998 NULL, // render target | |
| 1999 gfx::Transform()); // draw transform | |
| 2000 EXPECT_FALSE(tiling->TileAt(0, 0)); | |
| 2001 tiling->UpdateTilePriorities(ACTIVE_TREE, | |
| 2002 gfx::Rect(0, 0, 100, 100), | |
| 2003 1.0f, | |
| 2004 3.0, | |
| 2005 NULL, // occlusion tracker | |
| 2006 NULL, // render target | |
| 2007 gfx::Transform()); // draw transform | |
| 2008 EXPECT_TRUE(tiling->TileAt(0, 0)); | |
| 2009 EXPECT_FALSE(second_tiling->TileAt(0, 0)); | |
| 2010 } | |
| 2011 | |
| 1951 } // namespace | 2012 } // namespace |
| 1952 } // namespace cc | 2013 } // namespace cc |
| OLD | NEW |