Chromium Code Reviews| Index: cc/resources/tile_manager_perftest.cc |
| diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc |
| index fc427cacf0e979a62fa43ab9f52dad7666238e88..cf4bd1109d2cb717fe6b28f0699a33d696b2076e 100644 |
| --- a/cc/resources/tile_manager_perftest.cc |
| +++ b/cc/resources/tile_manager_perftest.cc |
| @@ -7,6 +7,7 @@ |
| #include "cc/resources/tile_priority.h" |
| #include "cc/test/fake_output_surface.h" |
| #include "cc/test/fake_output_surface_client.h" |
| +#include "cc/test/fake_picture_layer_tiling_client.h" |
| #include "cc/test/fake_picture_pile_impl.h" |
| #include "cc/test/fake_tile_manager.h" |
| #include "cc/test/fake_tile_manager_client.h" |
| @@ -26,8 +27,8 @@ static const int kTimeCheckInterval = 10; |
| class TileManagerPerfTest : public testing::Test { |
| public: |
| - typedef std::vector<std::pair<scoped_refptr<Tile>, ManagedTileBin> > |
| - TileBinVector; |
| + typedef std::vector<std::pair<scoped_refptr<TileBundle>, ManagedTileBin> > |
| + TileBundleBinVector; |
| TileManagerPerfTest() |
| : timer_(kWarmupRuns, |
| @@ -47,6 +48,7 @@ class TileManagerPerfTest : public testing::Test { |
| resource_provider_.get(), |
| raster_task_limit_bytes)); |
| picture_pile_ = FakePicturePileImpl::CreatePile(); |
| + picture_layer_tiling_client_.set_tile_manager(tile_manager_.get()); |
| } |
| GlobalStateThatImpactsTilePriority GlobalStateForTest() { |
| @@ -62,6 +64,7 @@ class TileManagerPerfTest : public testing::Test { |
| } |
| virtual void TearDown() OVERRIDE { |
| + picture_layer_tiling_client_.set_tile_manager(NULL); |
| tile_manager_.reset(NULL); |
| picture_pile_ = NULL; |
| } |
| @@ -106,30 +109,38 @@ class TileManagerPerfTest : public testing::Test { |
| } |
| } |
| - void CreateBinTiles(int count, ManagedTileBin bin, TileBinVector* tiles) { |
| + void CreateBinTileBundles(int count, |
| + ManagedTileBin bin, |
| + TileBundleBinVector* bundles) { |
| for (int i = 0; i < count; ++i) { |
| - scoped_refptr<Tile> tile = |
| - tile_manager_->CreateTile(picture_pile_.get(), |
| - settings_.default_tile_size, |
| - gfx::Rect(), |
| - gfx::Rect(), |
| - 1.0, |
| - 0, |
| - 0, |
| - true); |
| - tile->SetPriority(ACTIVE_TREE, GetTilePriorityFromBin(bin)); |
| - tile->SetPriority(PENDING_TREE, GetTilePriorityFromBin(bin)); |
| - tiles->push_back(std::make_pair(tile, bin)); |
| + scoped_refptr<TileBundle> bundle = |
| + picture_layer_tiling_client_.CreateTileBundle(gfx::Rect(0, 0, 2, 2)); |
| + bundle->SetPriority(ACTIVE_TREE, GetTilePriorityFromBin(bin)); |
| + bundle->SetPriority(PENDING_TREE, GetTilePriorityFromBin(bin)); |
| + for (int j = 0; j < 4; ++j) { |
| + scoped_refptr<Tile> tile = |
| + tile_manager_->CreateTile(picture_pile_.get(), |
| + settings_.default_tile_size, |
| + gfx::Rect(), |
| + gfx::Rect(), |
| + 1.0, |
| + 0, |
| + 0, |
| + true); |
| + bundle->AddTileAt(ACTIVE_TREE, j % 2, j / 2, tile); |
| + bundle->AddTileAt(PENDING_TREE, j % 2, j / 2, tile); |
| + } |
| + bundles->push_back(std::make_pair(bundle, bin)); |
| } |
| } |
| - void CreateTiles(int count, TileBinVector* tiles) { |
| + void CreateBundles(int count, TileBundleBinVector* bundles) { |
| // Roughly an equal amount of all bins. |
| int count_per_bin = count / NUM_BINS; |
| - CreateBinTiles(count_per_bin, NOW_BIN, tiles); |
| - CreateBinTiles(count_per_bin, SOON_BIN, tiles); |
| - CreateBinTiles(count_per_bin, EVENTUALLY_BIN, tiles); |
| - CreateBinTiles(count - 3 * count_per_bin, NEVER_BIN, tiles); |
| + CreateBinTileBundles(count_per_bin, NOW_BIN, bundles); |
| + CreateBinTileBundles(count_per_bin, SOON_BIN, bundles); |
| + CreateBinTileBundles(count_per_bin, EVENTUALLY_BIN, bundles); |
| + CreateBinTileBundles(count - 3 * count_per_bin, NEVER_BIN, bundles); |
| } |
| void RunManageTilesTest(const std::string& test_name, |
| @@ -138,19 +149,21 @@ class TileManagerPerfTest : public testing::Test { |
| DCHECK_GE(tile_count, 100u); |
| DCHECK_GE(priority_change_percent, 0); |
| DCHECK_LE(priority_change_percent, 100); |
| - TileBinVector tiles; |
| - CreateTiles(tile_count, &tiles); |
| + TileBundleBinVector bundles; |
| + |
| + unsigned bundle_count = tile_count / 4; |
| + CreateBundles(bundle_count, &bundles); |
| timer_.Reset(); |
| do { |
| if (priority_change_percent > 0) { |
| for (unsigned i = 0; |
| - i < tile_count; |
| + i < bundle_count; |
|
vmpstr
2013/11/27 00:03:15
I tried running this loop 4 times, but it made no
enne (OOO)
2013/11/27 01:38:05
Thanks for trying!
|
| i += 100 / priority_change_percent) { |
| - Tile* tile = tiles[i].first.get(); |
| - ManagedTileBin bin = GetNextBin(tiles[i].second); |
| - tile->SetPriority(ACTIVE_TREE, GetTilePriorityFromBin(bin)); |
| - tile->SetPriority(PENDING_TREE, GetTilePriorityFromBin(bin)); |
| - tiles[i].second = bin; |
| + TileBundle* bundle = bundles[i].first.get(); |
| + ManagedTileBin bin = GetNextBin(bundles[i].second); |
| + bundle->SetPriority(ACTIVE_TREE, GetTilePriorityFromBin(bin)); |
| + bundle->SetPriority(PENDING_TREE, GetTilePriorityFromBin(bin)); |
| + bundles[i].second = bin; |
| } |
| } |
| @@ -165,6 +178,7 @@ class TileManagerPerfTest : public testing::Test { |
| private: |
| FakeTileManagerClient tile_manager_client_; |
| + FakePictureLayerTilingClient picture_layer_tiling_client_; |
| LayerTreeSettings settings_; |
| scoped_ptr<FakeTileManager> tile_manager_; |
| scoped_refptr<FakePicturePileImpl> picture_pile_; |