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

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: Call ManageTiles. 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 AssignGpuMemoryToTiles(GetPrioritizedTileSet(), 242 AssignGpuMemoryToTiles(GetPrioritizedTileSet(),
243 &tiles_that_need_to_be_rasterized); 243 &tiles_that_need_to_be_rasterized);
244 244
245 // |tiles_that_need_to_be_rasterized| will be empty when we reach a 245 // |tiles_that_need_to_be_rasterized| will be empty when we reach a
246 // steady memory state. Keep scheduling tasks until we reach this state. 246 // steady memory state. Keep scheduling tasks until we reach this state.
247 if (!tiles_that_need_to_be_rasterized.empty()) { 247 if (!tiles_that_need_to_be_rasterized.empty()) {
248 ScheduleTasks(tiles_that_need_to_be_rasterized); 248 ScheduleTasks(tiles_that_need_to_be_rasterized);
249 return; 249 return;
250 } 250 }
251 251
252 // We don't reserve memory for required-for-activation tiles during
253 // smoothness mode, so it is very likely these tiles will not get memory.
254 // This prevents raster-on-demand and simply delays activation in this case.
255 bool allow_rasterize_on_demand = global_state_.tree_priority
256 != SMOOTHNESS_TAKES_PRIORITY;
257
252 // Use on-demand raster for any required-for-activation tiles that have not 258 // Use on-demand raster for any required-for-activation tiles that have not
253 // been been assigned memory after reaching a steady memory state. This 259 // been been assigned memory after reaching a steady memory state. This
254 // ensures that we activate even when OOM. 260 // ensures that we activate even when OOM.
255 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 261 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
256 Tile* tile = it->second; 262 Tile* tile = it->second;
257 ManagedTileState& mts = tile->managed_state(); 263 ManagedTileState& mts = tile->managed_state();
258 ManagedTileState::TileVersion& tile_version = 264 ManagedTileState::TileVersion& tile_version =
259 mts.tile_versions[mts.raster_mode]; 265 mts.tile_versions[mts.raster_mode];
260 266
261 if (tile->required_for_activation() && !tile_version.IsReadyToDraw()) 267 if (tile->required_for_activation() && !tile_version.IsReadyToDraw()) {
268 // If we can't raster on demand, give up early (and don't activate).
269 if (!allow_rasterize_on_demand)
brianderson 2013/09/10 02:35:19 Instead of calling ManageTiles again, would it wor
epenner 2013/09/10 18:13:39 The trouble is we are not ready to activate. Poten
reveman 2013/09/10 19:21:20 We should be calling ManageTiles as a result of ch
270 return;
262 tile_version.set_rasterize_on_demand(); 271 tile_version.set_rasterize_on_demand();
272 }
263 } 273 }
264 274
265 client_->NotifyReadyToActivate(); 275 client_->NotifyReadyToActivate();
266 } 276 }
267 277
268 void TileManager::DidFinishRunningTasksRequiredForActivation() { 278 void TileManager::DidFinishRunningTasksRequiredForActivation() {
269 // This is only a true indication that all tiles required for 279 // This is only a true indication that all tiles required for
270 // activation are initialized when no tiles are OOM. We need to 280 // activation are initialized when no tiles are OOM. We need to
271 // wait for DidFinishRunningTasks() to be called, try to re-assign 281 // wait for DidFinishRunningTasks() to be called, try to re-assign
272 // memory and in worst case use on-demand raster when tiles 282 // memory and in worst case use on-demand raster when tiles
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 bytes_releasable_ += tile->bytes_consumed_if_allocated(); 837 bytes_releasable_ += tile->bytes_consumed_if_allocated();
828 ++resources_releasable_; 838 ++resources_releasable_;
829 } 839 }
830 840
831 FreeUnusedResourcesForTile(tile); 841 FreeUnusedResourcesForTile(tile);
832 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) 842 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0)
833 did_initialize_visible_tile_ = true; 843 did_initialize_visible_tile_ = true;
834 } 844 }
835 845
836 } // namespace cc 846 } // 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