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

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

Issue 12426024: cc: Switch RenderingStats collection in Layer::Update() to RenderingStatsInstrumentation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 190697 Created 7 years, 8 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 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 max_background_texture_bytes = bytes; 807 max_background_texture_bytes = bytes;
808 if (!readback_bytes) { 808 if (!readback_bytes) {
809 readback_bytes = Resource::MemorySizeBytes(device_viewport_size_, 809 readback_bytes = Resource::MemorySizeBytes(device_viewport_size_,
810 GL_RGBA); 810 GL_RGBA);
811 } 811 }
812 } 812 }
813 return readback_bytes + max_background_texture_bytes + contents_texture_bytes; 813 return readback_bytes + max_background_texture_bytes + contents_texture_bytes;
814 } 814 }
815 815
816 bool LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer, 816 bool LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer,
817 ResourceUpdateQueue* queue, 817 ResourceUpdateQueue* queue) {
818 RenderingStats* stats) {
819 // Note: Masks and replicas only exist for layers that own render surfaces. If 818 // Note: Masks and replicas only exist for layers that own render surfaces. If
820 // we reach this point in code, we already know that at least something will 819 // we reach this point in code, we already know that at least something will
821 // be drawn into this render surface, so the mask and replica should be 820 // be drawn into this render surface, so the mask and replica should be
822 // painted. 821 // painted.
823 822
824 bool need_more_updates = false; 823 bool need_more_updates = false;
825 Layer* mask_layer = render_surface_layer->mask_layer(); 824 Layer* mask_layer = render_surface_layer->mask_layer();
826 if (mask_layer) { 825 if (mask_layer) {
827 mask_layer->Update(queue, NULL, stats); 826 mask_layer->Update(queue, NULL);
828 need_more_updates |= mask_layer->NeedMoreUpdates(); 827 need_more_updates |= mask_layer->NeedMoreUpdates();
829 } 828 }
830 829
831 Layer* replica_mask_layer = 830 Layer* replica_mask_layer =
832 render_surface_layer->replica_layer() ? 831 render_surface_layer->replica_layer() ?
833 render_surface_layer->replica_layer()->mask_layer() : NULL; 832 render_surface_layer->replica_layer()->mask_layer() : NULL;
834 if (replica_mask_layer) { 833 if (replica_mask_layer) {
835 replica_mask_layer->Update(queue, NULL, stats); 834 replica_mask_layer->Update(queue, NULL);
836 need_more_updates |= replica_mask_layer->NeedMoreUpdates(); 835 need_more_updates |= replica_mask_layer->NeedMoreUpdates();
837 } 836 }
838 return need_more_updates; 837 return need_more_updates;
839 } 838 }
840 839
841 bool LayerTreeHost::PaintLayerContents( 840 bool LayerTreeHost::PaintLayerContents(
842 const LayerList& render_surface_layer_list, ResourceUpdateQueue* queue) { 841 const LayerList& render_surface_layer_list, ResourceUpdateQueue* queue) {
843 // Use FrontToBack to allow for testing occlusion and performing culling 842 // Use FrontToBack to allow for testing occlusion and performing culling
844 // during the tree walk. 843 // during the tree walk.
845 typedef LayerIterator<Layer, 844 typedef LayerIterator<Layer,
846 LayerList, 845 LayerList,
847 RenderSurface, 846 RenderSurface,
848 LayerIteratorActions::FrontToBack> LayerIteratorType; 847 LayerIteratorActions::FrontToBack> LayerIteratorType;
849 848
850 bool need_more_updates = false; 849 bool need_more_updates = false;
851 bool record_metrics_for_frame = 850 bool record_metrics_for_frame =
852 settings_.show_overdraw_in_tracing && 851 settings_.show_overdraw_in_tracing &&
853 base::debug::TraceLog::GetInstance() && 852 base::debug::TraceLog::GetInstance() &&
854 base::debug::TraceLog::GetInstance()->IsEnabled(); 853 base::debug::TraceLog::GetInstance()->IsEnabled();
855 OcclusionTracker occlusion_tracker( 854 OcclusionTracker occlusion_tracker(
856 root_layer_->render_surface()->content_rect(), record_metrics_for_frame); 855 root_layer_->render_surface()->content_rect(), record_metrics_for_frame);
857 occlusion_tracker.set_minimum_tracking_size( 856 occlusion_tracker.set_minimum_tracking_size(
858 settings_.minimum_occlusion_tracking_size); 857 settings_.minimum_occlusion_tracking_size);
859 858
860 PrioritizeTextures(render_surface_layer_list, 859 PrioritizeTextures(render_surface_layer_list,
861 occlusion_tracker.overdraw_metrics()); 860 occlusion_tracker.overdraw_metrics());
862 861
863 // TODO(egraether): Use RenderingStatsInstrumentation in Layer::update()
864 RenderingStats stats;
865 RenderingStats* stats_ptr =
866 debug_state_.RecordRenderingStats() ? &stats : NULL;
867
868 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list); 862 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list);
869 for (LayerIteratorType it = 863 for (LayerIteratorType it =
870 LayerIteratorType::Begin(&render_surface_layer_list); 864 LayerIteratorType::Begin(&render_surface_layer_list);
871 it != end; 865 it != end;
872 ++it) { 866 ++it) {
873 occlusion_tracker.EnterLayer(it); 867 occlusion_tracker.EnterLayer(it);
874 868
875 if (it.represents_target_render_surface()) { 869 if (it.represents_target_render_surface()) {
876 DCHECK(it->render_surface()->draw_opacity() || 870 DCHECK(it->render_surface()->draw_opacity() ||
877 it->render_surface()->draw_opacity_is_animating()); 871 it->render_surface()->draw_opacity_is_animating());
878 need_more_updates |= PaintMasksForRenderSurface(*it, queue, stats_ptr); 872 need_more_updates |= PaintMasksForRenderSurface(*it, queue);
879 } else if (it.represents_itself()) { 873 } else if (it.represents_itself()) {
880 DCHECK(!it->bounds().IsEmpty()); 874 DCHECK(!it->bounds().IsEmpty());
881 it->Update(queue, &occlusion_tracker, stats_ptr); 875 it->Update(queue, &occlusion_tracker);
882 need_more_updates |= it->NeedMoreUpdates(); 876 need_more_updates |= it->NeedMoreUpdates();
883 } 877 }
884 878
885 occlusion_tracker.LeaveLayer(it); 879 occlusion_tracker.LeaveLayer(it);
886 } 880 }
887 881
888 rendering_stats_instrumentation_->AddStats(stats);
889
890 occlusion_tracker.overdraw_metrics()->RecordMetrics(this); 882 occlusion_tracker.overdraw_metrics()->RecordMetrics(this);
891 883
892 return need_more_updates; 884 return need_more_updates;
893 } 885 }
894 886
895 void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) { 887 void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) {
896 if (!root_layer_) 888 if (!root_layer_)
897 return; 889 return;
898 890
899 Layer* root_scroll_layer = FindFirstScrollableLayer(root_layer_.get()); 891 Layer* root_scroll_layer = FindFirstScrollableLayer(root_layer_.get());
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 SetAnimationEventsRecursive(events, 1033 SetAnimationEventsRecursive(events,
1042 layer->children()[child_index].get(), 1034 layer->children()[child_index].get(),
1043 wall_clock_time); 1035 wall_clock_time);
1044 } 1036 }
1045 1037
1046 skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() { 1038 skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() {
1047 return proxy_->CapturePicture(); 1039 return proxy_->CapturePicture();
1048 } 1040 }
1049 1041
1050 } // namespace cc 1042 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698