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

Side by Side Diff: cc/tile_manager.cc

Issue 11879007: cc: Move tile sorting into separate function and add trace event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/tile_manager.h ('k') | no next file » | 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/tile_manager.h" 5 #include "cc/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return ams.time_to_needed_in_seconds < bms.time_to_needed_in_seconds; 159 return ams.time_to_needed_in_seconds < bms.time_to_needed_in_seconds;
160 160
161 gfx::Rect a_rect = a->content_rect(); 161 gfx::Rect a_rect = a->content_rect();
162 gfx::Rect b_rect = b->content_rect(); 162 gfx::Rect b_rect = b->content_rect();
163 if (a_rect.y() != b_rect.y()) 163 if (a_rect.y() != b_rect.y())
164 return a_rect.y() < b_rect.y(); 164 return a_rect.y() < b_rect.y();
165 return a_rect.x() < b_rect.x(); 165 return a_rect.x() < b_rect.x();
166 } 166 }
167 }; 167 };
168 168
169 void TileManager::SortTiles() {
170 TRACE_EVENT0("cc", "TileManager::SortTiles");
171
172 // Sort by bin, resolution and time until needed.
173 std::sort(tiles_.begin(), tiles_.end(), BinComparator());
174 }
175
169 void TileManager::ManageTiles() { 176 void TileManager::ManageTiles() {
170 TRACE_EVENT0("cc", "TileManager::ManageTiles"); 177 TRACE_EVENT0("cc", "TileManager::ManageTiles");
171 manage_tiles_pending_ = false; 178 manage_tiles_pending_ = false;
172 ++manage_tiles_call_count_; 179 ++manage_tiles_call_count_;
173 180
174 const bool smoothness_takes_priority = 181 const bool smoothness_takes_priority =
175 global_state_.smoothness_takes_priority; 182 global_state_.smoothness_takes_priority;
176 183
177 // For each tree, bin into different categories of tiles. 184 // For each tree, bin into different categories of tiles.
178 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 185 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 bin_map[SOON_BIN] = SOON_BIN; 220 bin_map[SOON_BIN] = SOON_BIN;
214 bin_map[EVENTUALLY_BIN] = EVENTUALLY_BIN; 221 bin_map[EVENTUALLY_BIN] = EVENTUALLY_BIN;
215 bin_map[NEVER_BIN] = NEVER_BIN; 222 bin_map[NEVER_BIN] = NEVER_BIN;
216 } 223 }
217 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 224 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
218 Tile* tile = *it; 225 Tile* tile = *it;
219 ManagedTileState& mts = tile->managed_state(); 226 ManagedTileState& mts = tile->managed_state();
220 mts.bin = bin_map[mts.bin]; 227 mts.bin = bin_map[mts.bin];
221 } 228 }
222 229
223 // Sort by bin. 230 SortTiles();
224 std::sort(tiles_.begin(), tiles_.end(), BinComparator());
225 231
226 // Assign gpu memory and determine what tiles need to be rasterized. 232 // Assign gpu memory and determine what tiles need to be rasterized.
227 AssignGpuMemoryToTiles(); 233 AssignGpuMemoryToTiles();
228 234
229 // Finally, kick the rasterizer. 235 // Finally, kick the rasterizer.
230 DispatchMoreTasks(); 236 DispatchMoreTasks();
231 } 237 }
232 238
233 void TileManager::CheckForCompletedSetPixels() { 239 void TileManager::CheckForCompletedSetPixels() {
234 while (!tiles_with_pending_set_pixels_.empty()) { 240 while (!tiles_with_pending_set_pixels_.empty()) {
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } 525 }
520 526
521 void TileManager::DidFinishTileInitialization(Tile* tile) { 527 void TileManager::DidFinishTileInitialization(Tile* tile) {
522 ManagedTileState& managed_tile_state = tile->managed_state(); 528 ManagedTileState& managed_tile_state = tile->managed_state();
523 DCHECK(managed_tile_state.resource); 529 DCHECK(managed_tile_state.resource);
524 managed_tile_state.resource_is_being_initialized = false; 530 managed_tile_state.resource_is_being_initialized = false;
525 managed_tile_state.can_be_freed = true; 531 managed_tile_state.can_be_freed = true;
526 } 532 }
527 533
528 } // namespace cc 534 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698