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

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

Issue 816453008: cc: Split tiling set raster queues into all and required. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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
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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 rasterizer_->RasterizeTiles( 417 rasterizer_->RasterizeTiles(
418 tiles_that_need_to_be_rasterized, resource_pool_, 418 tiles_that_need_to_be_rasterized, resource_pool_,
419 base::Bind(&TileManager::UpdateTileDrawInfo, base::Unretained(this))); 419 base::Bind(&TileManager::UpdateTileDrawInfo, base::Unretained(this)));
420 420
421 // Use on-demand raster for any required-for-activation tiles that have not 421 // Use on-demand raster for any required-for-activation tiles that have not
422 // been been assigned memory after reaching a steady memory state. This 422 // been been assigned memory after reaching a steady memory state. This
423 // ensures that we activate even when OOM. Note that we have to rebuilt the 423 // ensures that we activate even when OOM. Note that we have to rebuilt the
424 // queue in case the last AssignGpuMemoryToTiles evicted some tiles that would 424 // queue in case the last AssignGpuMemoryToTiles evicted some tiles that would
425 // otherwise not be picked up by the old raster queue. 425 // otherwise not be picked up by the old raster queue.
426 client_->BuildRasterQueue(&raster_priority_queue_, 426 client_->BuildRasterQueue(&raster_priority_queue_,
427 global_state_.tree_priority); 427 global_state_.tree_priority,
428 RasterTilePriorityQueue::Type::ALL);
428 429
429 // Use on-demand raster for any tiles that have not been been assigned 430 // Use on-demand raster for any tiles that have not been been assigned
430 // memory. This ensures that we draw even when OOM. 431 // memory. This ensures that we draw even when OOM.
431 while (!raster_priority_queue_.IsEmpty()) { 432 while (!raster_priority_queue_.IsEmpty()) {
432 Tile* tile = raster_priority_queue_.Top(); 433 Tile* tile = raster_priority_queue_.Top();
433 TileDrawInfo& draw_info = tile->draw_info(); 434 TileDrawInfo& draw_info = tile->draw_info();
434 435
435 if (tile->required_for_draw() && !draw_info.IsReadyToDraw()) { 436 if (tile->required_for_draw() && !draw_info.IsReadyToDraw()) {
436 draw_info.set_rasterize_on_demand(); 437 draw_info.set_rasterize_on_demand();
437 client_->NotifyTileStateChanged(tile); 438 client_->NotifyTileStateChanged(tile);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 575
575 MemoryUsage hard_memory_limit(global_state_.hard_memory_limit_in_bytes, 576 MemoryUsage hard_memory_limit(global_state_.hard_memory_limit_in_bytes,
576 global_state_.num_resources_limit); 577 global_state_.num_resources_limit);
577 MemoryUsage soft_memory_limit(global_state_.soft_memory_limit_in_bytes, 578 MemoryUsage soft_memory_limit(global_state_.soft_memory_limit_in_bytes,
578 global_state_.num_resources_limit); 579 global_state_.num_resources_limit);
579 MemoryUsage memory_usage(resource_pool_->acquired_memory_usage_bytes(), 580 MemoryUsage memory_usage(resource_pool_->acquired_memory_usage_bytes(),
580 resource_pool_->acquired_resource_count()); 581 resource_pool_->acquired_resource_count());
581 582
582 eviction_priority_queue_is_up_to_date_ = false; 583 eviction_priority_queue_is_up_to_date_ = false;
583 client_->BuildRasterQueue(&raster_priority_queue_, 584 client_->BuildRasterQueue(&raster_priority_queue_,
584 global_state_.tree_priority); 585 global_state_.tree_priority,
586 RasterTilePriorityQueue::Type::ALL);
585 587
586 while (!raster_priority_queue_.IsEmpty()) { 588 while (!raster_priority_queue_.IsEmpty()) {
587 Tile* tile = raster_priority_queue_.Top(); 589 Tile* tile = raster_priority_queue_.Top();
588 590
589 // TODO(vmpstr): Remove this when the iterator returns the correct tiles 591 // TODO(vmpstr): Remove this when the iterator returns the correct tiles
590 // to draw for GPU rasterization. 592 // to draw for GPU rasterization.
591 if (required_for_draw_only) { 593 if (required_for_draw_only) {
592 if (!tile->required_for_draw()) { 594 if (!tile->required_for_draw()) {
593 raster_priority_queue_.Pop(); 595 raster_priority_queue_.Pop();
594 continue; 596 continue;
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 bool allow_rasterize_on_demand = 975 bool allow_rasterize_on_demand =
974 global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY && 976 global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY &&
975 global_state_.memory_limit_policy != ALLOW_NOTHING; 977 global_state_.memory_limit_policy != ALLOW_NOTHING;
976 978
977 // Use on-demand raster for any required-for-activation tiles that have 979 // Use on-demand raster for any required-for-activation tiles that have
978 // not been been assigned memory after reaching a steady memory state. This 980 // not been been assigned memory after reaching a steady memory state. This
979 // ensures that we activate even when OOM. Note that we have to rebuilt the 981 // ensures that we activate even when OOM. Note that we have to rebuilt the
980 // queue in case the last AssignGpuMemoryToTiles evicted some tiles that 982 // queue in case the last AssignGpuMemoryToTiles evicted some tiles that
981 // would otherwise not be picked up by the old raster queue. 983 // would otherwise not be picked up by the old raster queue.
982 client_->BuildRasterQueue(&raster_priority_queue_, 984 client_->BuildRasterQueue(&raster_priority_queue_,
983 global_state_.tree_priority); 985 global_state_.tree_priority,
986 RasterTilePriorityQueue::Type::ALL);
984 bool ready_to_activate = true; 987 bool ready_to_activate = true;
985 while (!raster_priority_queue_.IsEmpty()) { 988 while (!raster_priority_queue_.IsEmpty()) {
986 Tile* tile = raster_priority_queue_.Top(); 989 Tile* tile = raster_priority_queue_.Top();
987 TileDrawInfo& draw_info = tile->draw_info(); 990 TileDrawInfo& draw_info = tile->draw_info();
988 991
989 if (tile->required_for_activation() && !draw_info.IsReadyToDraw()) { 992 if (tile->required_for_activation() && !draw_info.IsReadyToDraw()) {
990 // If we can't raster on demand, give up early (and don't activate). 993 // If we can't raster on demand, give up early (and don't activate).
991 if (!allow_rasterize_on_demand) { 994 if (!allow_rasterize_on_demand) {
992 ready_to_activate = false; 995 ready_to_activate = false;
993 break; 996 break;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 result -= other; 1053 result -= other;
1051 return result; 1054 return result;
1052 } 1055 }
1053 1056
1054 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { 1057 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const {
1055 return memory_bytes_ > limit.memory_bytes_ || 1058 return memory_bytes_ > limit.memory_bytes_ ||
1056 resource_count_ > limit.resource_count_; 1059 resource_count_ > limit.resource_count_;
1057 } 1060 }
1058 1061
1059 } // namespace cc 1062 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698