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

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

Issue 664803003: Update from chromium a8e7c94b1b79a0948d05a1fcfff53391d22ce37a (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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_set_unittest.cc ('k') | cc/resources/picture_pile_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 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 static void TileExists(bool exists, Tile* tile, 1255 static void TileExists(bool exists, Tile* tile,
1256 const gfx::Rect& geometry_rect) { 1256 const gfx::Rect& geometry_rect) {
1257 EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString(); 1257 EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString();
1258 } 1258 }
1259 1259
1260 TEST(PictureLayerTilingTest, TilingEvictionTileIteratorStaticViewport) { 1260 TEST(PictureLayerTilingTest, TilingEvictionTileIteratorStaticViewport) {
1261 FakeOutputSurfaceClient output_surface_client; 1261 FakeOutputSurfaceClient output_surface_client;
1262 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); 1262 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
1263 CHECK(output_surface->BindToClient(&output_surface_client)); 1263 CHECK(output_surface->BindToClient(&output_surface_client));
1264 TestSharedBitmapManager shared_bitmap_manager; 1264 TestSharedBitmapManager shared_bitmap_manager;
1265 scoped_ptr<ResourceProvider> resource_provider = 1265 scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create(
1266 ResourceProvider::Create(output_surface.get(), 1266 output_surface.get(), &shared_bitmap_manager, NULL, NULL, 0, false, 1);
1267 &shared_bitmap_manager,
1268 NULL,
1269 NULL,
1270 0,
1271 false,
1272 1,
1273 false);
1274 1267
1275 FakePictureLayerTilingClient client(resource_provider.get()); 1268 FakePictureLayerTilingClient client(resource_provider.get());
1276 scoped_ptr<TestablePictureLayerTiling> tiling; 1269 scoped_ptr<TestablePictureLayerTiling> tiling;
1277 1270
1278 gfx::Rect viewport(50, 50, 100, 100); 1271 gfx::Rect viewport(50, 50, 100, 100);
1279 gfx::Size layer_bounds(2000, 2000); 1272 gfx::Size layer_bounds(2000, 2000);
1280 1273
1281 client.SetTileSize(gfx::Size(30, 30)); 1274 client.SetTileSize(gfx::Size(30, 30));
1282 client.set_tree(ACTIVE_TREE); 1275 client.set_tree(ACTIVE_TREE);
1283 1276
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 base::Bind(&TilesIntersectingRectExist, visible_rect, true)); 1449 base::Bind(&TilesIntersectingRectExist, visible_rect, true));
1457 } 1450 }
1458 1451
1459 TEST_F(PictureLayerTilingIteratorTest, AddTilingsToMatchScale) { 1452 TEST_F(PictureLayerTilingIteratorTest, AddTilingsToMatchScale) {
1460 gfx::Size layer_bounds(1099, 801); 1453 gfx::Size layer_bounds(1099, 801);
1461 gfx::Size tile_size(100, 100); 1454 gfx::Size tile_size(100, 100);
1462 1455
1463 client_.SetTileSize(tile_size); 1456 client_.SetTileSize(tile_size);
1464 client_.set_tree(PENDING_TREE); 1457 client_.set_tree(PENDING_TREE);
1465 1458
1466 PictureLayerTilingSet active_set(&client_, layer_bounds); 1459 PictureLayerTilingSet active_set(&client_);
1467 1460
1468 active_set.AddTiling(1.f); 1461 active_set.AddTiling(1.f, layer_bounds);
1469 1462
1470 VerifyTiles(active_set.tiling_at(0), 1463 VerifyTiles(active_set.tiling_at(0),
1471 1.f, 1464 1.f,
1472 gfx::Rect(layer_bounds), 1465 gfx::Rect(layer_bounds),
1473 base::Bind(&TileExists, false)); 1466 base::Bind(&TileExists, false));
1474 1467
1475 UpdateAllTilePriorities(&active_set, 1468 UpdateAllTilePriorities(&active_set,
1476 PENDING_TREE, 1469 PENDING_TREE,
1477 gfx::Rect(layer_bounds), // visible content rect 1470 gfx::Rect(layer_bounds), // visible content rect
1478 1.f, // current contents scale 1471 1.f, // current contents scale
1479 1.0); // current frame time 1472 1.0); // current frame time
1480 1473
1481 // The active tiling has tiles now. 1474 // The active tiling has tiles now.
1482 VerifyTiles(active_set.tiling_at(0), 1475 VerifyTiles(active_set.tiling_at(0),
1483 1.f, 1476 1.f,
1484 gfx::Rect(layer_bounds), 1477 gfx::Rect(layer_bounds),
1485 base::Bind(&TileExists, true)); 1478 base::Bind(&TileExists, true));
1486 1479
1487 // Add the same tilings to the pending set. 1480 // Add the same tilings to the pending set.
1488 PictureLayerTilingSet pending_set(&client_, layer_bounds); 1481 PictureLayerTilingSet pending_set(&client_);
1489 Region invalidation; 1482 Region invalidation;
1490 pending_set.SyncTilings(active_set, layer_bounds, invalidation, 0.f); 1483 pending_set.SyncTilings(active_set, layer_bounds, invalidation, 0.f);
1491 1484
1492 // The pending tiling starts with no tiles. 1485 // The pending tiling starts with no tiles.
1493 VerifyTiles(pending_set.tiling_at(0), 1486 VerifyTiles(pending_set.tiling_at(0),
1494 1.f, 1487 1.f,
1495 gfx::Rect(layer_bounds), 1488 gfx::Rect(layer_bounds),
1496 base::Bind(&TileExists, false)); 1489 base::Bind(&TileExists, false));
1497 1490
1498 // ComputeTilePriorityRects on the pending tiling at the same frame time. The 1491 // ComputeTilePriorityRects on the pending tiling at the same frame time. The
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0)); 2165 EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0));
2173 2166
2174 // Reset the active tiling. The recycle tiles should be released too. 2167 // Reset the active tiling. The recycle tiles should be released too.
2175 active_tiling->Reset(); 2168 active_tiling->Reset();
2176 EXPECT_FALSE(active_tiling->TileAt(0, 0)); 2169 EXPECT_FALSE(active_tiling->TileAt(0, 0));
2177 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); 2170 EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
2178 } 2171 }
2179 2172
2180 } // namespace 2173 } // namespace
2181 } // namespace cc 2174 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_set_unittest.cc ('k') | cc/resources/picture_pile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698