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

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
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_perftest.cc » ('j') | 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/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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 bool had_enough_memory_to_schedule_tiles_needed_now = true; 551 bool had_enough_memory_to_schedule_tiles_needed_now = true;
552 552
553 MemoryUsage hard_memory_limit(global_state_.hard_memory_limit_in_bytes, 553 MemoryUsage hard_memory_limit(global_state_.hard_memory_limit_in_bytes,
554 global_state_.num_resources_limit); 554 global_state_.num_resources_limit);
555 MemoryUsage soft_memory_limit(global_state_.soft_memory_limit_in_bytes, 555 MemoryUsage soft_memory_limit(global_state_.soft_memory_limit_in_bytes,
556 global_state_.num_resources_limit); 556 global_state_.num_resources_limit);
557 MemoryUsage memory_usage(resource_pool_->acquired_memory_usage_bytes(), 557 MemoryUsage memory_usage(resource_pool_->acquired_memory_usage_bytes(),
558 resource_pool_->acquired_resource_count()); 558 resource_pool_->acquired_resource_count());
559 559
560 eviction_priority_queue_is_up_to_date_ = false; 560 eviction_priority_queue_is_up_to_date_ = false;
561 // TODO(vmpstr): Take this as a parameter and have SynchronousRaster build a
562 // REQUIRED_FOR_DRAW queue.
561 client_->BuildRasterQueue(&raster_priority_queue_, 563 client_->BuildRasterQueue(&raster_priority_queue_,
562 global_state_.tree_priority); 564 global_state_.tree_priority,
565 RasterTilePriorityQueue::Type::ALL);
563 566
564 while (!raster_priority_queue_.IsEmpty()) { 567 while (!raster_priority_queue_.IsEmpty()) {
565 Tile* tile = raster_priority_queue_.Top(); 568 Tile* tile = raster_priority_queue_.Top();
566 569
567 // TODO(vmpstr): Remove this when the iterator returns the correct tiles 570 // TODO(vmpstr): Remove this when the iterator returns the correct tiles
568 // to draw for GPU rasterization. 571 // to draw for GPU rasterization.
569 if (required_for_draw_only) { 572 if (required_for_draw_only) {
570 if (!tile->required_for_draw()) { 573 if (!tile->required_for_draw()) {
571 raster_priority_queue_.Pop(); 574 raster_priority_queue_.Pop();
572 continue; 575 continue;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 void TileManager::SetTileTaskRunnerForTesting( 854 void TileManager::SetTileTaskRunnerForTesting(
852 TileTaskRunner* tile_task_runner) { 855 TileTaskRunner* tile_task_runner) {
853 tile_task_runner_ = tile_task_runner; 856 tile_task_runner_ = tile_task_runner;
854 tile_task_runner_->SetClient(this); 857 tile_task_runner_->SetClient(this);
855 } 858 }
856 859
857 bool TileManager::IsReadyToActivate() const { 860 bool TileManager::IsReadyToActivate() const {
858 TRACE_EVENT0("cc", "TileManager::IsReadyToActivate"); 861 TRACE_EVENT0("cc", "TileManager::IsReadyToActivate");
859 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); 862 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers();
860 863
864 // TODO(vmpstr): Replace this with building a REQUIRED_TO_ACTIVATE raster
865 // queue and checking if it's empty.
861 for (const auto& layer : layers) { 866 for (const auto& layer : layers) {
862 if (!layer->AllTilesRequiredForActivationAreReadyToDraw()) 867 if (!layer->AllTilesRequiredForActivationAreReadyToDraw())
863 return false; 868 return false;
864 } 869 }
865 870
866 return true; 871 return true;
867 } 872 }
868 873
869 bool TileManager::IsReadyToDraw() const { 874 bool TileManager::IsReadyToDraw() const {
870 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); 875 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers();
871 876
877 // TODO(vmpstr): Replace this with building a REQUIRED_TO_DRAW raster queue
878 // and checking if it's empty.
872 for (const auto& layer : layers) { 879 for (const auto& layer : layers) {
873 if (!layer->AllTilesRequiredForDrawAreReadyToDraw()) 880 if (!layer->AllTilesRequiredForDrawAreReadyToDraw())
874 return false; 881 return false;
875 } 882 }
876 883
877 return true; 884 return true;
878 } 885 }
879 886
880 void TileManager::NotifyReadyToActivate() { 887 void TileManager::NotifyReadyToActivate() {
881 TRACE_EVENT0("cc", "TileManager::NotifyReadyToActivate"); 888 TRACE_EVENT0("cc", "TileManager::NotifyReadyToActivate");
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 // activate as activation can cause checkerboards. 957 // activate as activation can cause checkerboards.
951 bool allow_rasterize_on_demand = 958 bool allow_rasterize_on_demand =
952 global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY && 959 global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY &&
953 global_state_.memory_limit_policy != ALLOW_NOTHING; 960 global_state_.memory_limit_policy != ALLOW_NOTHING;
954 961
955 // Use on-demand raster for any required-for-activation tiles that have 962 // Use on-demand raster for any required-for-activation tiles that have
956 // not been been assigned memory after reaching a steady memory state. This 963 // not been been assigned memory after reaching a steady memory state. This
957 // ensures that we activate even when OOM. Note that we have to rebuilt the 964 // ensures that we activate even when OOM. Note that we have to rebuilt the
958 // queue in case the last AssignGpuMemoryToTiles evicted some tiles that 965 // queue in case the last AssignGpuMemoryToTiles evicted some tiles that
959 // would otherwise not be picked up by the old raster queue. 966 // would otherwise not be picked up by the old raster queue.
967 // TODO(vmpstr): Make this use REQUIRED_FOR_ACTIVAITON queue.
960 client_->BuildRasterQueue(&raster_priority_queue_, 968 client_->BuildRasterQueue(&raster_priority_queue_,
961 global_state_.tree_priority); 969 global_state_.tree_priority,
970 RasterTilePriorityQueue::Type::ALL);
962 bool ready_to_activate = true; 971 bool ready_to_activate = true;
963 while (!raster_priority_queue_.IsEmpty()) { 972 while (!raster_priority_queue_.IsEmpty()) {
964 Tile* tile = raster_priority_queue_.Top(); 973 Tile* tile = raster_priority_queue_.Top();
965 TileDrawInfo& draw_info = tile->draw_info(); 974 TileDrawInfo& draw_info = tile->draw_info();
966 975
967 if (tile->required_for_activation() && !draw_info.IsReadyToDraw()) { 976 if (tile->required_for_activation() && !draw_info.IsReadyToDraw()) {
968 // If we can't raster on demand, give up early (and don't activate). 977 // If we can't raster on demand, give up early (and don't activate).
969 if (!allow_rasterize_on_demand) { 978 if (!allow_rasterize_on_demand) {
970 ready_to_activate = false; 979 ready_to_activate = false;
971 break; 980 break;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 result -= other; 1037 result -= other;
1029 return result; 1038 return result;
1030 } 1039 }
1031 1040
1032 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { 1041 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const {
1033 return memory_bytes_ > limit.memory_bytes_ || 1042 return memory_bytes_ > limit.memory_bytes_ ||
1034 resource_count_ > limit.resource_count_; 1043 resource_count_ > limit.resource_count_;
1035 } 1044 }
1036 1045
1037 } // namespace cc 1046 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698