Chromium Code Reviews| Index: cc/resources/picture_layer_tiling_perftest.cc |
| diff --git a/cc/resources/picture_layer_tiling_perftest.cc b/cc/resources/picture_layer_tiling_perftest.cc |
| index a610c1ea28e9a331aa9c9f0982362b0bf54dde61..a229b26dbe7000dc0c33905ecb32d1886b9b9bd2 100644 |
| --- a/cc/resources/picture_layer_tiling_perftest.cc |
| +++ b/cc/resources/picture_layer_tiling_perftest.cc |
| @@ -112,9 +112,32 @@ class PictureLayerTilingPerfTest : public testing::Test { |
| true); |
| } |
| - void RunTilingRasterTileIteratorTest(const std::string& test_name, |
| - int num_tiles, |
| - const gfx::Rect& viewport) { |
| + void RunRasterIteratorConstructTest(const std::string& test_name, |
| + const gfx::Rect& viewport) { |
| + gfx::Size bounds(viewport.size()); |
| + picture_layer_tiling_ = |
| + PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); |
| + picture_layer_tiling_->UpdateTilePriorities( |
| + ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); |
| + |
| + timer_.Reset(); |
| + do { |
| + PictureLayerTiling::TilingRasterTileIterator it( |
| + picture_layer_tiling_.get(), ACTIVE_TREE); |
| + timer_.NextLap(); |
| + } while (!timer_.HasTimeLimitExpired()); |
| + |
| + perf_test::PrintResult("tiling_raster_tile_iterator_construct", |
| + "", |
| + test_name, |
| + timer_.LapsPerSecond(), |
| + "runs/s", |
| + true); |
| + } |
| + |
| + void RunRasterIteratorConstructAndIterateTest(const std::string& test_name, |
| + int num_tiles, |
| + const gfx::Rect& viewport) { |
| gfx::Size bounds(10000, 10000); |
| picture_layer_tiling_ = |
| PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); |
| @@ -124,16 +147,18 @@ class PictureLayerTilingPerfTest : public testing::Test { |
| timer_.Reset(); |
| do { |
| int count = num_tiles; |
| - for (PictureLayerTiling::TilingRasterTileIterator it( |
| - picture_layer_tiling_.get(), ACTIVE_TREE); |
| - it && count; |
| - ++it) { |
| - --count; |
| + PictureLayerTiling::TilingRasterTileIterator it( |
| + picture_layer_tiling_.get(), ACTIVE_TREE); |
| + while (count--) { |
| + ASSERT_TRUE(it) << "count: " << count; |
| + ASSERT_TRUE(*it != NULL) << "count: " << count; |
| + ++it; |
| } |
| + ASSERT_EQ(-1, count); |
|
reveman
2014/07/17 16:39:26
don't think you need this. it would be pretty hard
vmpstr
2014/07/17 17:16:24
Hehe, I'm just being overzealous. Removed.
|
| timer_.NextLap(); |
| } while (!timer_.HasTimeLimitExpired()); |
| - perf_test::PrintResult("tiling_raster_tile_iterator", |
| + perf_test::PrintResult("tiling_raster_tile_iterator_construct_and_iterate", |
| "", |
| test_name, |
| timer_.LapsPerSecond(), |
| @@ -179,11 +204,23 @@ TEST_F(PictureLayerTilingPerfTest, UpdateTilePriorities) { |
| RunUpdateTilePrioritiesScrollingTest("perspective", transform); |
| } |
| -TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIterator) { |
| - RunTilingRasterTileIteratorTest("32_100x100", 32, gfx::Rect(0, 0, 100, 100)); |
| - RunTilingRasterTileIteratorTest("32_500x500", 32, gfx::Rect(0, 0, 500, 500)); |
| - RunTilingRasterTileIteratorTest("64_100x100", 64, gfx::Rect(0, 0, 100, 100)); |
| - RunTilingRasterTileIteratorTest("64_500x500", 64, gfx::Rect(0, 0, 500, 500)); |
| +TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIteratorConstruct) { |
| + RunRasterIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
| + RunRasterIteratorConstructTest("50_0_100x100", gfx::Rect(50, 0, 100, 100)); |
| + RunRasterIteratorConstructTest("100_0_100x100", gfx::Rect(100, 0, 100, 100)); |
| + RunRasterIteratorConstructTest("150_0_100x100", gfx::Rect(150, 0, 100, 100)); |
| +} |
| + |
| +TEST_F(PictureLayerTilingPerfTest, |
| + TilingRasterTileIteratorConstructAndIterate) { |
| + RunRasterIteratorConstructAndIterateTest( |
| + "32_100x100", 32, gfx::Rect(0, 0, 100, 100)); |
| + RunRasterIteratorConstructAndIterateTest( |
| + "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); |
| + RunRasterIteratorConstructAndIterateTest( |
| + "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); |
| + RunRasterIteratorConstructAndIterateTest( |
| + "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); |
| } |
| } // namespace |