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

Side by Side Diff: cc/tile_manager.cc

Issue 12084031: A host of micro-optimizations and a refactor of TimeForBoundsToIntersect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "cc/platform_color.h" 12 #include "cc/platform_color.h"
13 #include "cc/raster_worker_pool.h" 13 #include "cc/raster_worker_pool.h"
14 #include "cc/resource_pool.h" 14 #include "cc/resource_pool.h"
15 #include "cc/tile.h" 15 #include "cc/tile.h"
16 16
17 namespace cc { 17 namespace cc {
18 18
19 namespace { 19 namespace {
20 20
21 // Determine bin based on three categories of tiles: things we need now, 21 // Determine bin based on three categories of tiles: things we need now,
22 // things we need soon, and eventually. 22 // things we need soon, and eventually.
23 TileManagerBin BinFromTilePriority(const TilePriority& prio) { 23 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) {
24 24
25 // The amount of time for which we want to have prepainting coverage. 25 // The amount of time for which we want to have prepainting coverage.
26 const double prepainting_window_time_seconds = 1.0; 26 const double prepainting_window_time_seconds = 1.0;
27 const double backfling_guard_distance_pixels = 314.0; 27 const double backfling_guard_distance_pixels = 314.0;
28 28
29 // Explicitly limit how far ahead we will prepaint for low and non-low res. 29 // Explicitly limit how far ahead we will prepaint for low and non-low res.
30 const double max_lores_paint_distance_pixels = 8192.0; 30 const double max_lores_paint_distance_pixels = 8192.0;
31 const double max_hires_paint_distance_pixels = 4096.0; 31 const double max_hires_paint_distance_pixels = 4096.0;
32 if (prio.resolution == cc::LOW_RESOLUTION) { 32 if (prio.resolution == cc::LOW_RESOLUTION) {
33 if (prio.distance_to_visible_in_pixels > max_lores_paint_distance_pixels) 33 if (prio.distance_to_visible_in_pixels > max_lores_paint_distance_pixels)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); it++) { 124 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); it++) {
125 if (*it == tile) { 125 if (*it == tile) {
126 FreeResourcesForTile(tile); 126 FreeResourcesForTile(tile);
127 tiles_.erase(it); 127 tiles_.erase(it);
128 return; 128 return;
129 } 129 }
130 } 130 }
131 DCHECK(false) << "Could not find tile version."; 131 DCHECK(false) << "Could not find tile version.";
132 } 132 }
133 133
134 void TileManager::WillModifyTilePriority(
135 Tile* tile, WhichTree tree, const TilePriority& new_priority) {
136 // TODO(nduca): Do something smarter if reprioritization turns out to be
137 // costly.
138 ScheduleManageTiles();
139 }
140
141 void TileManager::ScheduleManageTiles() {
142 if (manage_tiles_pending_)
143 return;
144 client_->ScheduleManageTiles();
145 manage_tiles_pending_ = true;
146 }
147
148 class BinComparator { 134 class BinComparator {
149 public: 135 public:
150 bool operator() (const Tile* a, const Tile* b) const { 136 bool operator() (const Tile* a, const Tile* b) const {
151 const ManagedTileState& ams = a->managed_state(); 137 const ManagedTileState& ams = a->managed_state();
152 const ManagedTileState& bms = b->managed_state(); 138 const ManagedTileState& bms = b->managed_state();
153 if (ams.bin != bms.bin) 139 if (ams.bin != bms.bin)
154 return ams.bin < bms.bin; 140 return ams.bin < bms.bin;
155 141
156 if (ams.resolution != bms.resolution) 142 if (ams.resolution != bms.resolution)
157 return ams.resolution < bms.resolution; 143 return ams.resolution < bms.resolution;
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 } 523 }
538 524
539 void TileManager::DidFinishTileInitialization(Tile* tile) { 525 void TileManager::DidFinishTileInitialization(Tile* tile) {
540 ManagedTileState& managed_tile_state = tile->managed_state(); 526 ManagedTileState& managed_tile_state = tile->managed_state();
541 DCHECK(managed_tile_state.resource); 527 DCHECK(managed_tile_state.resource);
542 managed_tile_state.resource_is_being_initialized = false; 528 managed_tile_state.resource_is_being_initialized = false;
543 managed_tile_state.can_be_freed = true; 529 managed_tile_state.can_be_freed = true;
544 } 530 }
545 531
546 } // namespace cc 532 } // namespace cc
OLDNEW
« cc/picture_layer_tiling.cc ('K') | « cc/tile_manager.h ('k') | cc/tile_priority.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698