Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/debug/lap_timer.h" | 5 #include "cc/debug/lap_timer.h" |
| 6 #include "cc/resources/picture_layer_tiling.h" | 6 #include "cc/resources/picture_layer_tiling.h" |
| 7 #include "cc/test/fake_picture_layer_tiling_client.h" | 7 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 8 | 8 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "testing/perf/perf_test.h" | 10 #include "testing/perf/perf_test.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 } while (!timer_.HasTimeLimitExpired()); | 105 } while (!timer_.HasTimeLimitExpired()); |
| 106 | 106 |
| 107 perf_test::PrintResult("update_tile_priorities_scrolling", | 107 perf_test::PrintResult("update_tile_priorities_scrolling", |
| 108 "", | 108 "", |
| 109 test_name, | 109 test_name, |
| 110 timer_.LapsPerSecond(), | 110 timer_.LapsPerSecond(), |
| 111 "runs/s", | 111 "runs/s", |
| 112 true); | 112 true); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void RunTilingRasterTileIteratorConstructionTest(const std::string& test_name, | |
| 116 const gfx::Rect& viewport) { | |
| 117 gfx::Size bounds(viewport.size()); | |
| 118 picture_layer_tiling_ = | |
| 119 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); | |
| 120 picture_layer_tiling_->UpdateTilePriorities( | |
| 121 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); | |
| 122 | |
| 123 timer_.Reset(); | |
| 124 do { | |
| 125 PictureLayerTiling::TilingRasterTileIterator it( | |
| 126 picture_layer_tiling_.get(), ACTIVE_TREE); | |
| 127 timer_.NextLap(); | |
| 128 } while (!timer_.HasTimeLimitExpired()); | |
| 129 | |
| 130 perf_test::PrintResult("tiling_raster_tile_iterator_construction", | |
| 131 "", | |
| 132 test_name, | |
| 133 timer_.LapsPerSecond(), | |
| 134 "runs/s", | |
| 135 true); | |
| 136 } | |
| 137 | |
| 115 void RunTilingRasterTileIteratorTest(const std::string& test_name, | 138 void RunTilingRasterTileIteratorTest(const std::string& test_name, |
| 116 int num_tiles, | 139 int num_tiles, |
| 117 const gfx::Rect& viewport) { | 140 const gfx::Rect& viewport) { |
| 118 gfx::Size bounds(10000, 10000); | 141 gfx::Size bounds(10000, 10000); |
| 119 picture_layer_tiling_ = | 142 picture_layer_tiling_ = |
| 120 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); | 143 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); |
| 121 picture_layer_tiling_->UpdateTilePriorities( | 144 picture_layer_tiling_->UpdateTilePriorities( |
| 122 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); | 145 ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform()); |
| 123 | 146 |
| 124 timer_.Reset(); | 147 timer_.Reset(); |
| 125 do { | 148 do { |
| 126 int count = num_tiles; | 149 int count = num_tiles; |
| 127 for (PictureLayerTiling::TilingRasterTileIterator it( | 150 for (PictureLayerTiling::TilingRasterTileIterator it( |
| 128 picture_layer_tiling_.get(), ACTIVE_TREE); | 151 picture_layer_tiling_.get(), ACTIVE_TREE); |
| 129 it && count; | 152 it && count; |
|
reveman
2014/07/16 22:09:03
whatever we decide is the best approach for the ev
vmpstr
2014/07/17 00:17:41
Done.
| |
| 130 ++it) { | 153 ++it) { |
| 131 --count; | 154 --count; |
| 132 } | 155 } |
| 133 timer_.NextLap(); | 156 timer_.NextLap(); |
| 134 } while (!timer_.HasTimeLimitExpired()); | 157 } while (!timer_.HasTimeLimitExpired()); |
| 135 | 158 |
| 136 perf_test::PrintResult("tiling_raster_tile_iterator", | 159 perf_test::PrintResult("tiling_raster_tile_iterator", |
|
reveman
2014/07/16 22:09:03
this should be renamed to make it explicit that it
vmpstr
2014/07/17 00:17:41
Done.
| |
| 137 "", | 160 "", |
| 138 test_name, | 161 test_name, |
| 139 timer_.LapsPerSecond(), | 162 timer_.LapsPerSecond(), |
| 140 "runs/s", | 163 "runs/s", |
| 141 true); | 164 true); |
| 142 } | 165 } |
| 143 | 166 |
| 144 private: | 167 private: |
| 145 FakePictureLayerTilingClient picture_layer_tiling_client_; | 168 FakePictureLayerTilingClient picture_layer_tiling_client_; |
| 146 scoped_ptr<PictureLayerTiling> picture_layer_tiling_; | 169 scoped_ptr<PictureLayerTiling> picture_layer_tiling_; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 172 | 195 |
| 173 transform.Rotate(10); | 196 transform.Rotate(10); |
| 174 RunUpdateTilePrioritiesStationaryTest("rotation", transform); | 197 RunUpdateTilePrioritiesStationaryTest("rotation", transform); |
| 175 RunUpdateTilePrioritiesScrollingTest("rotation", transform); | 198 RunUpdateTilePrioritiesScrollingTest("rotation", transform); |
| 176 | 199 |
| 177 transform.ApplyPerspectiveDepth(10); | 200 transform.ApplyPerspectiveDepth(10); |
| 178 RunUpdateTilePrioritiesStationaryTest("perspective", transform); | 201 RunUpdateTilePrioritiesStationaryTest("perspective", transform); |
| 179 RunUpdateTilePrioritiesScrollingTest("perspective", transform); | 202 RunUpdateTilePrioritiesScrollingTest("perspective", transform); |
| 180 } | 203 } |
| 181 | 204 |
| 205 TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIteratorConstruction) { | |
| 206 RunTilingRasterTileIteratorConstructionTest("0_0_100x100", | |
| 207 gfx::Rect(0, 0, 100, 100)); | |
| 208 RunTilingRasterTileIteratorConstructionTest("50_0_100x100", | |
| 209 gfx::Rect(50, 0, 100, 100)); | |
| 210 RunTilingRasterTileIteratorConstructionTest("100_0_100x100", | |
| 211 gfx::Rect(100, 0, 100, 100)); | |
| 212 RunTilingRasterTileIteratorConstructionTest("150_0_100x100", | |
| 213 gfx::Rect(150, 0, 100, 100)); | |
| 214 } | |
| 215 | |
| 182 TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIterator) { | 216 TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIterator) { |
| 183 RunTilingRasterTileIteratorTest("32_100x100", 32, gfx::Rect(0, 0, 100, 100)); | 217 RunTilingRasterTileIteratorTest("32_100x100", 32, gfx::Rect(0, 0, 100, 100)); |
| 184 RunTilingRasterTileIteratorTest("32_500x500", 32, gfx::Rect(0, 0, 500, 500)); | 218 RunTilingRasterTileIteratorTest("32_500x500", 32, gfx::Rect(0, 0, 500, 500)); |
| 185 RunTilingRasterTileIteratorTest("64_100x100", 64, gfx::Rect(0, 0, 100, 100)); | 219 RunTilingRasterTileIteratorTest("64_100x100", 64, gfx::Rect(0, 0, 100, 100)); |
| 186 RunTilingRasterTileIteratorTest("64_500x500", 64, gfx::Rect(0, 0, 500, 500)); | 220 RunTilingRasterTileIteratorTest("64_500x500", 64, gfx::Rect(0, 0, 500, 500)); |
| 187 } | 221 } |
| 188 | 222 |
| 189 } // namespace | 223 } // namespace |
| 190 | 224 |
| 191 } // namespace cc | 225 } // namespace cc |
| OLD | NEW |