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

Unified Diff: cc/resources/tile_manager_unittest.cc

Issue 366113002: cc: Do not cleanup tiles with raster tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: UnitTests updated. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/resources/tile_manager_unittest.cc
diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc
index 3dba49b45558c24c372fd64c4f609861f8d9f3cc..f7080b4e39f7b8e0fcee34be5d5212d68743d5eb 100644
--- a/cc/resources/tile_manager_unittest.cc
+++ b/cc/resources/tile_manager_unittest.cc
@@ -117,6 +117,14 @@ class TileManagerTest : public testing::TestWithParam<bool>,
count, active_priority, pending_priority, settings_.default_tile_size);
}
+ void ReleaseTileOnBothTree(TileVector tiles) {
reveman 2014/07/30 18:41:39 ReleaseTiles(TileVector* tiles)
sohanjg 2014/07/31 13:42:56 Done.
+ for (TileVector::iterator it = tiles.begin(); it != tiles.end(); it++) {
+ Tile* tile = *it;
+ tile->SetPriority(ACTIVE_TREE, TilePriority());
+ tile->SetPriority(PENDING_TREE, TilePriority());
+ }
+ }
+
FakeTileManager* tile_manager() { return tile_manager_.get(); }
int AssignedMemoryCount(const TileVector& tiles) {
@@ -172,6 +180,11 @@ TEST_P(TileManagerTest, EnoughMemoryAllowAnything) {
EXPECT_EQ(3, AssignedMemoryCount(pending_now));
EXPECT_EQ(3, AssignedMemoryCount(active_pending_soon));
EXPECT_EQ(0, AssignedMemoryCount(never_bin));
+
+ ReleaseTileOnBothTree(active_now);
+ ReleaseTileOnBothTree(pending_now);
+ ReleaseTileOnBothTree(active_pending_soon);
+ ReleaseTileOnBothTree(never_bin);
}
TEST_P(TileManagerTest, EnoughMemoryAllowPrepaintOnly) {
@@ -193,6 +206,11 @@ TEST_P(TileManagerTest, EnoughMemoryAllowPrepaintOnly) {
EXPECT_EQ(3, AssignedMemoryCount(pending_now));
EXPECT_EQ(3, AssignedMemoryCount(active_pending_soon));
EXPECT_EQ(0, AssignedMemoryCount(never_bin));
+
+ ReleaseTileOnBothTree(active_now);
+ ReleaseTileOnBothTree(pending_now);
+ ReleaseTileOnBothTree(active_pending_soon);
+ ReleaseTileOnBothTree(never_bin);
}
TEST_P(TileManagerTest, EnoughMemoryPendingLowResAllowAbsoluteMinimum) {
@@ -206,6 +224,7 @@ TEST_P(TileManagerTest, EnoughMemoryPendingLowResAllowAbsoluteMinimum) {
tile_manager()->AssignMemoryToTiles(global_state_);
EXPECT_EQ(5, AssignedMemoryCount(pending_low_res));
+ ReleaseTileOnBothTree(pending_low_res);
}
TEST_P(TileManagerTest, EnoughMemoryAllowAbsoluteMinimum) {
@@ -227,6 +246,11 @@ TEST_P(TileManagerTest, EnoughMemoryAllowAbsoluteMinimum) {
EXPECT_EQ(3, AssignedMemoryCount(pending_now));
EXPECT_EQ(0, AssignedMemoryCount(active_pending_soon));
EXPECT_EQ(0, AssignedMemoryCount(never_bin));
+
+ ReleaseTileOnBothTree(active_now);
+ ReleaseTileOnBothTree(pending_now);
+ ReleaseTileOnBothTree(active_pending_soon);
+ ReleaseTileOnBothTree(never_bin);
}
TEST_P(TileManagerTest, EnoughMemoryAllowNothing) {
@@ -248,6 +272,11 @@ TEST_P(TileManagerTest, EnoughMemoryAllowNothing) {
EXPECT_EQ(0, AssignedMemoryCount(pending_now));
EXPECT_EQ(0, AssignedMemoryCount(active_pending_soon));
EXPECT_EQ(0, AssignedMemoryCount(never_bin));
+
+ ReleaseTileOnBothTree(active_now);
+ ReleaseTileOnBothTree(pending_now);
+ ReleaseTileOnBothTree(active_pending_soon);
+ ReleaseTileOnBothTree(never_bin);
}
TEST_P(TileManagerTest, PartialOOMMemoryToPending) {
@@ -272,6 +301,9 @@ TEST_P(TileManagerTest, PartialOOMMemoryToPending) {
EXPECT_EQ(3, AssignedMemoryCount(active_tree_tiles));
EXPECT_EQ(5, AssignedMemoryCount(pending_tree_tiles));
+
+ ReleaseTileOnBothTree(active_tree_tiles);
+ ReleaseTileOnBothTree(pending_tree_tiles);
}
TEST_P(TileManagerTest, PartialOOMMemoryToActive) {
@@ -291,6 +323,9 @@ TEST_P(TileManagerTest, PartialOOMMemoryToActive) {
EXPECT_EQ(5, AssignedMemoryCount(active_tree_tiles));
EXPECT_EQ(3, AssignedMemoryCount(pending_tree_tiles));
+
+ ReleaseTileOnBothTree(active_tree_tiles);
+ ReleaseTileOnBothTree(pending_tree_tiles);
}
TEST_P(TileManagerTest, TotalOOMMemoryToPending) {
@@ -322,6 +357,9 @@ TEST_P(TileManagerTest, TotalOOMMemoryToPending) {
EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles));
EXPECT_EQ(8, AssignedMemoryCount(pending_tree_tiles));
}
+
+ ReleaseTileOnBothTree(active_tree_tiles);
+ ReleaseTileOnBothTree(pending_tree_tiles);
}
TEST_P(TileManagerTest, TotalOOMActiveSoonMemoryToPending) {
@@ -353,6 +391,9 @@ TEST_P(TileManagerTest, TotalOOMActiveSoonMemoryToPending) {
EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles));
EXPECT_EQ(8, AssignedMemoryCount(pending_tree_tiles));
}
+
+ ReleaseTileOnBothTree(active_tree_tiles);
+ ReleaseTileOnBothTree(pending_tree_tiles);
}
TEST_P(TileManagerTest, TotalOOMMemoryToActive) {
@@ -377,6 +418,9 @@ TEST_P(TileManagerTest, TotalOOMMemoryToActive) {
EXPECT_EQ(8, AssignedMemoryCount(active_tree_tiles));
EXPECT_EQ(0, AssignedMemoryCount(pending_tree_tiles));
}
+
+ ReleaseTileOnBothTree(active_tree_tiles);
+ ReleaseTileOnBothTree(pending_tree_tiles);
}
TEST_P(TileManagerTest, TotalOOMMemoryToNewContent) {
@@ -416,6 +460,9 @@ TEST_P(TileManagerTest, TotalOOMMemoryToNewContent) {
tile_manager()->AssignMemoryToTiles(global_state_);
EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles));
EXPECT_EQ(10, AssignedMemoryCount(pending_tree_tiles));
+
+ ReleaseTileOnBothTree(active_tree_tiles);
+ ReleaseTileOnBothTree(pending_tree_tiles);
}
// If true, the max tile limit should be applied as bytes; if false,

Powered by Google App Engine
This is Rietveld 408576698