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

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

Issue 868803002: cc: Change the activation/ready for draw check from layer to queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment format 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 used_layer_counts_[tile->layer_id()]++; 855 used_layer_counts_[tile->layer_id()]++;
856 return tile; 856 return tile;
857 } 857 }
858 858
859 void TileManager::SetTileTaskRunnerForTesting( 859 void TileManager::SetTileTaskRunnerForTesting(
860 TileTaskRunner* tile_task_runner) { 860 TileTaskRunner* tile_task_runner) {
861 tile_task_runner_ = tile_task_runner; 861 tile_task_runner_ = tile_task_runner;
862 tile_task_runner_->SetClient(this); 862 tile_task_runner_->SetClient(this);
863 } 863 }
864 864
865 bool TileManager::AreRequiredTilesReadyToDraw(
866 RasterTilePriorityQueue::Type type) const {
867 scoped_ptr<RasterTilePriorityQueue> raster_priority_queue(
868 client_->BuildRasterQueue(global_state_.tree_priority, type));
869 // The queue returns tiles that need raster. However, if the tiles were marked
870 // as rasterize on demand, they might already be ready to draw, which is the
871 // check we really want. Hence, we need to iterate the tiles and only return
danakj 2015/01/28 00:48:18 ITYM this to explain why we're checking IsReadyToD
vmpstr 2015/01/28 19:51:17 I'm just trying to convey the fact that we still n
872 // false if at least one of them is not ready to draw.
873 for (; !raster_priority_queue->IsEmpty(); raster_priority_queue->Pop()) {
874 if (!raster_priority_queue->Top()->IsReadyToDraw())
875 return false;
876 }
877 return true;
878 }
865 bool TileManager::IsReadyToActivate() const { 879 bool TileManager::IsReadyToActivate() const {
866 TRACE_EVENT0("cc", "TileManager::IsReadyToActivate"); 880 TRACE_EVENT0("cc", "TileManager::IsReadyToActivate");
867 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); 881 return AreRequiredTilesReadyToDraw(
868 882 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION);
869 // TODO(vmpstr): Replace this with building a REQUIRED_TO_ACTIVATE raster
870 // queue and checking if the tiles it contains are all ready to draw.
871 for (const auto& layer : layers) {
872 if (!layer->AllTilesRequiredForActivationAreReadyToDraw())
873 return false;
874 }
875
876 return true;
877 } 883 }
878 884
879 bool TileManager::IsReadyToDraw() const { 885 bool TileManager::IsReadyToDraw() const {
880 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); 886 TRACE_EVENT0("cc", "TileManager::IsReadyToDraw");
881 887 return AreRequiredTilesReadyToDraw(
882 // TODO(vmpstr): Replace this with building a REQUIRED_TO_DRAW raster queue 888 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW);
883 // and checking if the tiles it contains are all ready to draw.
884 for (const auto& layer : layers) {
885 if (!layer->AllTilesRequiredForDrawAreReadyToDraw())
886 return false;
887 }
888
889 return true;
890 } 889 }
891 890
892 void TileManager::NotifyReadyToActivate() { 891 void TileManager::NotifyReadyToActivate() {
893 TRACE_EVENT0("cc", "TileManager::NotifyReadyToActivate"); 892 TRACE_EVENT0("cc", "TileManager::NotifyReadyToActivate");
894 if (did_notify_ready_to_activate_) 893 if (did_notify_ready_to_activate_)
895 return; 894 return;
896 client_->NotifyReadyToActivate(); 895 client_->NotifyReadyToActivate();
897 did_notify_ready_to_activate_ = true; 896 did_notify_ready_to_activate_ = true;
898 } 897 }
899 898
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 result -= other; 1039 result -= other;
1041 return result; 1040 return result;
1042 } 1041 }
1043 1042
1044 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { 1043 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const {
1045 return memory_bytes_ > limit.memory_bytes_ || 1044 return memory_bytes_ > limit.memory_bytes_ ||
1046 resource_count_ > limit.resource_count_; 1045 resource_count_ > limit.resource_count_;
1047 } 1046 }
1048 1047
1049 } // namespace cc 1048 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698