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 "base/time/time.h" | 5 #include "base/time/time.h" |
6 #include "cc/resources/tile.h" | 6 #include "cc/resources/tile.h" |
7 #include "cc/resources/tile_priority.h" | 7 #include "cc/resources/tile_priority.h" |
8 #include "cc/test/fake_output_surface.h" | 8 #include "cc/test/fake_output_surface.h" |
9 #include "cc/test/fake_output_surface_client.h" | 9 #include "cc/test/fake_output_surface_client.h" |
10 #include "cc/test/fake_picture_pile_impl.h" | 10 #include "cc/test/fake_picture_pile_impl.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 TilePriority GetTilePriorityFromBin(ManagedTileBin bin) { | 84 TilePriority GetTilePriorityFromBin(ManagedTileBin bin) { |
85 switch (bin) { | 85 switch (bin) { |
86 case NOW_AND_READY_TO_DRAW_BIN: | 86 case NOW_AND_READY_TO_DRAW_BIN: |
87 case NOW_BIN: | 87 case NOW_BIN: |
88 return TilePriorityForNowBin(); | 88 return TilePriorityForNowBin(); |
89 case SOON_BIN: | 89 case SOON_BIN: |
90 return TilePriorityForSoonBin(); | 90 return TilePriorityForSoonBin(); |
91 case EVENTUALLY_AND_ACTIVE_BIN: | 91 case EVENTUALLY_AND_ACTIVE_BIN: |
92 case EVENTUALLY_BIN: | 92 case EVENTUALLY_BIN: |
93 return TilePriorityForEventualBin(); | 93 return TilePriorityForEventualBin(); |
94 case NEVER_AND_ACTIVE_BIN: | 94 case AT_LAST_BIN: |
| 95 case AT_LAST_AND_ACTIVE_BIN: |
95 case NEVER_BIN: | 96 case NEVER_BIN: |
96 return TilePriority(); | 97 return TilePriority(); |
97 default: | 98 default: |
98 NOTREACHED(); | 99 NOTREACHED(); |
99 return TilePriority(); | 100 return TilePriority(); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 ManagedTileBin GetNextBin(ManagedTileBin bin) { | 104 ManagedTileBin GetNextBin(ManagedTileBin bin) { |
104 switch (bin) { | 105 switch (bin) { |
105 case NOW_AND_READY_TO_DRAW_BIN: | 106 case NOW_AND_READY_TO_DRAW_BIN: |
106 case NOW_BIN: | 107 case NOW_BIN: |
107 return SOON_BIN; | 108 return SOON_BIN; |
108 case SOON_BIN: | 109 case SOON_BIN: |
109 return EVENTUALLY_BIN; | 110 return EVENTUALLY_BIN; |
110 case EVENTUALLY_AND_ACTIVE_BIN: | 111 case EVENTUALLY_AND_ACTIVE_BIN: |
111 case EVENTUALLY_BIN: | 112 case EVENTUALLY_BIN: |
112 return NEVER_BIN; | 113 return NEVER_BIN; |
113 case NEVER_AND_ACTIVE_BIN: | 114 case AT_LAST_BIN: |
| 115 case AT_LAST_AND_ACTIVE_BIN: |
114 case NEVER_BIN: | 116 case NEVER_BIN: |
115 return NOW_BIN; | 117 return NOW_BIN; |
116 default: | 118 default: |
117 NOTREACHED(); | 119 NOTREACHED(); |
118 return NEVER_BIN; | 120 return NEVER_BIN; |
119 } | 121 } |
120 } | 122 } |
121 | 123 |
122 void CreateBinTiles(int count, ManagedTileBin bin, TileBinVector* tiles) { | 124 void CreateBinTiles(int count, ManagedTileBin bin, TileBinVector* tiles) { |
123 for (int i = 0; i < count; ++i) { | 125 for (int i = 0; i < count; ++i) { |
(...skipping 18 matching lines...) Expand all Loading... |
142 int count_per_bin = count / NUM_BINS; | 144 int count_per_bin = count / NUM_BINS; |
143 CreateBinTiles(count_per_bin, NOW_BIN, tiles); | 145 CreateBinTiles(count_per_bin, NOW_BIN, tiles); |
144 CreateBinTiles(count_per_bin, SOON_BIN, tiles); | 146 CreateBinTiles(count_per_bin, SOON_BIN, tiles); |
145 CreateBinTiles(count_per_bin, EVENTUALLY_BIN, tiles); | 147 CreateBinTiles(count_per_bin, EVENTUALLY_BIN, tiles); |
146 CreateBinTiles(count - 3 * count_per_bin, NEVER_BIN, tiles); | 148 CreateBinTiles(count - 3 * count_per_bin, NEVER_BIN, tiles); |
147 } | 149 } |
148 | 150 |
149 void RunManageTilesTest(const std::string test_name, | 151 void RunManageTilesTest(const std::string test_name, |
150 unsigned tile_count, | 152 unsigned tile_count, |
151 unsigned priority_change_percent) { | 153 unsigned priority_change_percent) { |
152 DCHECK_GE(100u, tile_count); | 154 DCHECK_GE(tile_count, 100u); |
153 DCHECK_LE(100u, priority_change_percent); | 155 DCHECK_LE(priority_change_percent, 100u); |
154 num_runs_ = 0; | 156 num_runs_ = 0; |
155 TileBinVector tiles; | 157 TileBinVector tiles; |
156 CreateTiles(tile_count, &tiles); | 158 CreateTiles(tile_count, &tiles); |
157 start_time_ = base::TimeTicks(); | 159 start_time_ = base::TimeTicks(); |
158 do { | 160 do { |
159 if (priority_change_percent) { | 161 if (priority_change_percent) { |
160 for (unsigned i = 0; | 162 for (unsigned i = 0; |
161 i < tile_count; | 163 i < tile_count; |
162 i += 100 / priority_change_percent) { | 164 i += 100 / priority_change_percent) { |
163 Tile* tile = tiles[i].first; | 165 Tile* tile = tiles[i].first; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 RunManageTilesTest("manage_tiles_1000_10", 1000, 10); | 198 RunManageTilesTest("manage_tiles_1000_10", 1000, 10); |
197 RunManageTilesTest("manage_tiles_10000_10", 10000, 10); | 199 RunManageTilesTest("manage_tiles_10000_10", 10000, 10); |
198 RunManageTilesTest("manage_tiles_100_100", 100, 100); | 200 RunManageTilesTest("manage_tiles_100_100", 100, 100); |
199 RunManageTilesTest("manage_tiles_1000_100", 1000, 100); | 201 RunManageTilesTest("manage_tiles_1000_100", 1000, 100); |
200 RunManageTilesTest("manage_tiles_10000_100", 10000, 100); | 202 RunManageTilesTest("manage_tiles_10000_100", 10000, 100); |
201 } | 203 } |
202 | 204 |
203 } // namespace | 205 } // namespace |
204 | 206 |
205 } // namespace cc | 207 } // namespace cc |
OLD | NEW |