Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 771 // still draw the frame. However when the layer being checkerboarded is moving | 771 // still draw the frame. However when the layer being checkerboarded is moving |
| 772 // due to an impl-animation, we drop the frame to avoid flashing due to the | 772 // due to an impl-animation, we drop the frame to avoid flashing due to the |
| 773 // texture suddenly appearing in the future. | 773 // texture suddenly appearing in the future. |
| 774 DrawResult draw_result = DRAW_SUCCESS; | 774 DrawResult draw_result = DRAW_SUCCESS; |
| 775 // When we have a copy request for a layer, we need to draw no matter | 775 // When we have a copy request for a layer, we need to draw no matter |
| 776 // what, as the layer may disappear after this frame. | 776 // what, as the layer may disappear after this frame. |
| 777 bool have_copy_request = false; | 777 bool have_copy_request = false; |
| 778 | 778 |
| 779 int layers_drawn = 0; | 779 int layers_drawn = 0; |
| 780 | 780 |
| 781 int num_missing_tiles = 0; | |
| 782 int num_incomplete_tiles = 0; | |
| 783 | |
| 781 const DrawMode draw_mode = GetDrawMode(output_surface_.get()); | 784 const DrawMode draw_mode = GetDrawMode(output_surface_.get()); |
| 782 | 785 |
| 783 LayerIteratorType end = | 786 LayerIteratorType end = |
| 784 LayerIteratorType::End(frame->render_surface_layer_list); | 787 LayerIteratorType::End(frame->render_surface_layer_list); |
| 785 for (LayerIteratorType it = | 788 for (LayerIteratorType it = |
| 786 LayerIteratorType::Begin(frame->render_surface_layer_list); | 789 LayerIteratorType::Begin(frame->render_surface_layer_list); |
| 787 it != end; | 790 it != end; |
| 788 ++it) { | 791 ++it) { |
| 789 RenderPass::Id target_render_pass_id = | 792 RenderPass::Id target_render_pass_id = |
| 790 it.target_render_surface_layer()->render_surface()->RenderPassId(); | 793 it.target_render_surface_layer()->render_surface()->RenderPassId(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 849 | 852 |
| 850 ++layers_drawn; | 853 ++layers_drawn; |
| 851 } | 854 } |
| 852 | 855 |
| 853 rendering_stats_instrumentation_->AddVisibleContentArea( | 856 rendering_stats_instrumentation_->AddVisibleContentArea( |
| 854 append_quads_data.visible_content_area); | 857 append_quads_data.visible_content_area); |
| 855 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea( | 858 rendering_stats_instrumentation_->AddApproximatedVisibleContentArea( |
| 856 append_quads_data.approximated_visible_content_area); | 859 append_quads_data.approximated_visible_content_area); |
| 857 | 860 |
| 858 if (append_quads_data.num_missing_tiles) { | 861 if (append_quads_data.num_missing_tiles) { |
| 862 num_missing_tiles += append_quads_data.num_missing_tiles; | |
| 859 bool layer_has_animating_transform = | 863 bool layer_has_animating_transform = |
| 860 it->screen_space_transform_is_animating() || | 864 it->screen_space_transform_is_animating() || |
| 861 it->draw_transform_is_animating(); | 865 it->draw_transform_is_animating(); |
| 862 if (layer_has_animating_transform) | 866 if (layer_has_animating_transform) |
| 863 draw_result = DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; | 867 draw_result = DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; |
| 864 } | 868 } |
| 865 | 869 |
| 866 if (append_quads_data.had_incomplete_tile) { | 870 if (append_quads_data.num_incomplete_tiles || |
| 871 append_quads_data.num_missing_tiles) { | |
| 872 num_incomplete_tiles += append_quads_data.num_incomplete_tiles; | |
|
danakj
2014/07/07 22:07:40
maybe these += don't really fit inside these if bl
| |
| 867 frame->contains_incomplete_tile = true; | 873 frame->contains_incomplete_tile = true; |
| 868 if (active_tree()->RequiresHighResToDraw()) | 874 if (active_tree()->RequiresHighResToDraw()) |
| 869 draw_result = DRAW_ABORTED_MISSING_HIGH_RES_CONTENT; | 875 draw_result = DRAW_ABORTED_MISSING_HIGH_RES_CONTENT; |
| 870 } | 876 } |
| 871 | 877 |
| 872 occlusion_tracker.LeaveLayer(it); | 878 occlusion_tracker.LeaveLayer(it); |
| 873 } | 879 } |
| 874 | 880 |
| 875 if (have_copy_request || | 881 if (have_copy_request || |
| 876 output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) | 882 output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 907 while (!active_tree_->LayersWithCopyOutputRequest().empty()) { | 913 while (!active_tree_->LayersWithCopyOutputRequest().empty()) { |
| 908 LayerImpl* layer = active_tree_->LayersWithCopyOutputRequest().back(); | 914 LayerImpl* layer = active_tree_->LayersWithCopyOutputRequest().back(); |
| 909 layer->TakeCopyRequestsAndTransformToTarget(&requests_to_abort); | 915 layer->TakeCopyRequestsAndTransformToTarget(&requests_to_abort); |
| 910 } | 916 } |
| 911 for (size_t i = 0; i < requests_to_abort.size(); ++i) | 917 for (size_t i = 0; i < requests_to_abort.size(); ++i) |
| 912 requests_to_abort[i]->SendEmptyResult(); | 918 requests_to_abort[i]->SendEmptyResult(); |
| 913 | 919 |
| 914 // If we're making a frame to draw, it better have at least one render pass. | 920 // If we're making a frame to draw, it better have at least one render pass. |
| 915 DCHECK(!frame->render_passes.empty()); | 921 DCHECK(!frame->render_passes.empty()); |
| 916 | 922 |
| 923 if (IsCurrentlyScrolling()) { | |
| 924 UMA_HISTOGRAM_COUNTS_100( | |
| 925 "Compositing.RenderPass.AppendQuadData.NumMissingTiles", | |
| 926 num_missing_tiles); | |
| 927 UMA_HISTOGRAM_COUNTS_100( | |
| 928 "Compositing.RenderPass.AppendQuadData.NumIncompleteTiles", | |
| 929 num_incomplete_tiles); | |
| 930 } | |
| 931 | |
| 917 // Should only have one render pass in resourceless software mode. | 932 // Should only have one render pass in resourceless software mode. |
| 918 if (output_surface_->ForcedDrawToSoftwareDevice()) | 933 if (output_surface_->ForcedDrawToSoftwareDevice()) |
| 919 DCHECK_EQ(1u, frame->render_passes.size()); | 934 DCHECK_EQ(1u, frame->render_passes.size()); |
| 920 | 935 |
| 921 return draw_result; | 936 return draw_result; |
| 922 } | 937 } |
| 923 | 938 |
| 924 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { | 939 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { |
| 925 if (input_handler_client_) | 940 if (input_handler_client_) |
| 926 input_handler_client_->MainThreadHasStoppedFlinging(); | 941 input_handler_client_->MainThreadHasStoppedFlinging(); |
| (...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3152 } | 3167 } |
| 3153 | 3168 |
| 3154 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3169 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3155 std::vector<PictureLayerImpl*>::iterator it = | 3170 std::vector<PictureLayerImpl*>::iterator it = |
| 3156 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3171 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3157 DCHECK(it != picture_layers_.end()); | 3172 DCHECK(it != picture_layers_.end()); |
| 3158 picture_layers_.erase(it); | 3173 picture_layers_.erase(it); |
| 3159 } | 3174 } |
| 3160 | 3175 |
| 3161 } // namespace cc | 3176 } // namespace cc |
| OLD | NEW |