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

Side by Side Diff: cc/resources/tile_manager.cc

Issue 23495022: CC: Add a scheduled action for ManageTiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.cc » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')
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/resources/tile_manager.h" 5 #include "cc/resources/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 AssignGpuMemoryToTiles(GetPrioritizedTileSet(), 234 AssignGpuMemoryToTiles(GetPrioritizedTileSet(),
235 &tiles_that_need_to_be_rasterized); 235 &tiles_that_need_to_be_rasterized);
236 236
237 // |tiles_that_need_to_be_rasterized| will be empty when we reach a 237 // |tiles_that_need_to_be_rasterized| will be empty when we reach a
238 // steady memory state. Keep scheduling tasks until we reach this state. 238 // steady memory state. Keep scheduling tasks until we reach this state.
239 if (!tiles_that_need_to_be_rasterized.empty()) { 239 if (!tiles_that_need_to_be_rasterized.empty()) {
240 ScheduleTasks(tiles_that_need_to_be_rasterized); 240 ScheduleTasks(tiles_that_need_to_be_rasterized);
241 return; 241 return;
242 } 242 }
243 243
244 // We don't reserve memory for required-for-activate tiles during smoothness
245 // mode, so it is very likely these tiles will not get memory. So we prevent
246 // raster-on-demand and simply don't activate in this case.
247 bool allow_rasterize_on_demand = global_state_.tree_priority
248 != SMOOTHNESS_TAKES_PRIORITY;
249 bool can_activate = true;
reveman 2013/09/03 19:03:21 can you drop this and just early out below when yo
epenner 2013/09/03 19:36:29 Good one! Done.
250
244 // Use on-demand raster for any required-for-activation tiles that have not 251 // Use on-demand raster for any required-for-activation tiles that have not
245 // been been assigned memory after reaching a steady memory state. This 252 // been been assigned memory after reaching a steady memory state. This
246 // ensures that we activate even when OOM. 253 // ensures that we activate even when OOM.
247 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 254 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
248 Tile* tile = it->second; 255 Tile* tile = it->second;
249 ManagedTileState& mts = tile->managed_state(); 256 ManagedTileState& mts = tile->managed_state();
250 ManagedTileState::TileVersion& tile_version = 257 ManagedTileState::TileVersion& tile_version =
251 mts.tile_versions[mts.raster_mode]; 258 mts.tile_versions[mts.raster_mode];
252 259
253 if (tile->required_for_activation() && !tile_version.IsReadyToDraw()) 260 if (tile->required_for_activation() && !tile_version.IsReadyToDraw()) {
254 tile_version.set_rasterize_on_demand(); 261 if (allow_rasterize_on_demand)
262 tile_version.set_rasterize_on_demand();
263 else
264 can_activate = false;
265 }
255 } 266 }
256 267
257 client_->NotifyReadyToActivate(); 268 if (can_activate)
269 client_->NotifyReadyToActivate();
258 } 270 }
259 271
260 void TileManager::DidFinishRunningTasksRequiredForActivation() { 272 void TileManager::DidFinishRunningTasksRequiredForActivation() {
261 // This is only a true indication that all tiles required for 273 // This is only a true indication that all tiles required for
262 // activation are initialized when no tiles are OOM. We need to 274 // activation are initialized when no tiles are OOM. We need to
263 // wait for DidFinishRunningTasks() to be called, try to re-assign 275 // wait for DidFinishRunningTasks() to be called, try to re-assign
264 // memory and in worst case use on-demand raster when tiles 276 // memory and in worst case use on-demand raster when tiles
265 // required for activation are OOM. 277 // required for activation are OOM.
266 if (!all_tiles_required_for_activation_have_memory_) 278 if (!all_tiles_required_for_activation_have_memory_)
267 return; 279 return;
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 bytes_releasable_ += tile->bytes_consumed_if_allocated(); 860 bytes_releasable_ += tile->bytes_consumed_if_allocated();
849 ++resources_releasable_; 861 ++resources_releasable_;
850 } 862 }
851 863
852 FreeUnusedResourcesForTile(tile); 864 FreeUnusedResourcesForTile(tile);
853 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) 865 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0)
854 did_initialize_visible_tile_ = true; 866 did_initialize_visible_tile_ = true;
855 } 867 }
856 868
857 } // namespace cc 869 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.cc » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698