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

Side by Side Diff: cc/trees/layer_tree_host.cc

Issue 180243014: Revert "Revert 253606 "Revert 251238 "cc: Clean up iterator template to ..."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/render_surface_impl.h ('k') | cc/trees/layer_tree_host_common.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 #include <string> 9 #include <string>
10 10
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 surface_memory_placeholder_->SetTextureManager( 880 surface_memory_placeholder_->SetTextureManager(
881 contents_texture_manager_.get()); 881 contents_texture_manager_.get());
882 surface_memory_placeholder_->set_request_priority( 882 surface_memory_placeholder_->set_request_priority(
883 PriorityCalculator::RenderSurfacePriority()); 883 PriorityCalculator::RenderSurfacePriority());
884 surface_memory_placeholder_->SetToSelfManagedMemoryPlaceholder( 884 surface_memory_placeholder_->SetToSelfManagedMemoryPlaceholder(
885 surface_memory_bytes); 885 surface_memory_bytes);
886 } 886 }
887 887
888 void LayerTreeHost::SetPrioritiesForLayers( 888 void LayerTreeHost::SetPrioritiesForLayers(
889 const RenderSurfaceLayerList& update_list) { 889 const RenderSurfaceLayerList& update_list) {
890 typedef LayerIterator<Layer,
891 RenderSurfaceLayerList,
892 RenderSurface,
893 LayerIteratorActions::FrontToBack> LayerIteratorType;
894
890 PriorityCalculator calculator; 895 PriorityCalculator calculator;
891 typedef LayerIterator<Layer> LayerIteratorType;
892 LayerIteratorType end = LayerIteratorType::End(&update_list); 896 LayerIteratorType end = LayerIteratorType::End(&update_list);
893 for (LayerIteratorType it = LayerIteratorType::Begin(&update_list); 897 for (LayerIteratorType it = LayerIteratorType::Begin(&update_list);
894 it != end; 898 it != end;
895 ++it) { 899 ++it) {
896 if (it.represents_itself()) { 900 if (it.represents_itself()) {
897 it->SetTexturePriorities(calculator); 901 it->SetTexturePriorities(calculator);
898 } else if (it.represents_target_render_surface()) { 902 } else if (it.represents_target_render_surface()) {
899 if (it->mask_layer()) 903 if (it->mask_layer())
900 it->mask_layer()->SetTexturePriorities(calculator); 904 it->mask_layer()->SetTexturePriorities(calculator);
901 if (it->replica_layer() && it->replica_layer()->mask_layer()) 905 if (it->replica_layer() && it->replica_layer()->mask_layer())
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 *did_paint_content |= replica_mask_layer->Update(queue, NULL); 982 *did_paint_content |= replica_mask_layer->Update(queue, NULL);
979 *need_more_updates |= replica_mask_layer->NeedMoreUpdates(); 983 *need_more_updates |= replica_mask_layer->NeedMoreUpdates();
980 } 984 }
981 } 985 }
982 986
983 void LayerTreeHost::PaintLayerContents( 987 void LayerTreeHost::PaintLayerContents(
984 const RenderSurfaceLayerList& render_surface_layer_list, 988 const RenderSurfaceLayerList& render_surface_layer_list,
985 ResourceUpdateQueue* queue, 989 ResourceUpdateQueue* queue,
986 bool* did_paint_content, 990 bool* did_paint_content,
987 bool* need_more_updates) { 991 bool* need_more_updates) {
992 // Use FrontToBack to allow for testing occlusion and performing culling
993 // during the tree walk.
994 typedef LayerIterator<Layer,
995 RenderSurfaceLayerList,
996 RenderSurface,
997 LayerIteratorActions::FrontToBack> LayerIteratorType;
998
988 bool record_metrics_for_frame = 999 bool record_metrics_for_frame =
989 settings_.show_overdraw_in_tracing && 1000 settings_.show_overdraw_in_tracing &&
990 base::debug::TraceLog::GetInstance() && 1001 base::debug::TraceLog::GetInstance() &&
991 base::debug::TraceLog::GetInstance()->IsEnabled(); 1002 base::debug::TraceLog::GetInstance()->IsEnabled();
992 OcclusionTracker occlusion_tracker( 1003 OcclusionTracker occlusion_tracker(
993 root_layer_->render_surface()->content_rect(), record_metrics_for_frame); 1004 root_layer_->render_surface()->content_rect(), record_metrics_for_frame);
994 occlusion_tracker.set_minimum_tracking_size( 1005 occlusion_tracker.set_minimum_tracking_size(
995 settings_.minimum_occlusion_tracking_size); 1006 settings_.minimum_occlusion_tracking_size);
996 1007
997 PrioritizeTextures(render_surface_layer_list, 1008 PrioritizeTextures(render_surface_layer_list,
998 occlusion_tracker.overdraw_metrics()); 1009 occlusion_tracker.overdraw_metrics());
999 1010
1000 in_paint_layer_contents_ = true; 1011 in_paint_layer_contents_ = true;
1001 1012
1002 // Iterates front-to-back to allow for testing occlusion and performing
1003 // culling during the tree walk.
1004 typedef LayerIterator<Layer> LayerIteratorType;
1005 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list); 1013 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list);
1006 for (LayerIteratorType it = 1014 for (LayerIteratorType it =
1007 LayerIteratorType::Begin(&render_surface_layer_list); 1015 LayerIteratorType::Begin(&render_surface_layer_list);
1008 it != end; 1016 it != end;
1009 ++it) { 1017 ++it) {
1010 occlusion_tracker.EnterLayer(it); 1018 occlusion_tracker.EnterLayer(it);
1011 1019
1012 if (it.represents_target_render_surface()) { 1020 if (it.represents_target_render_surface()) {
1013 PaintMasksForRenderSurface( 1021 PaintMasksForRenderSurface(
1014 *it, queue, did_paint_content, need_more_updates); 1022 *it, queue, did_paint_content, need_more_updates);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 swap_promise_list_.push_back(swap_promise.Pass()); 1320 swap_promise_list_.push_back(swap_promise.Pass());
1313 } 1321 }
1314 1322
1315 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1323 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1316 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1324 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1317 swap_promise_list_[i]->DidNotSwap(reason); 1325 swap_promise_list_[i]->DidNotSwap(reason);
1318 swap_promise_list_.clear(); 1326 swap_promise_list_.clear();
1319 } 1327 }
1320 1328
1321 } // namespace cc 1329 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/render_surface_impl.h ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698