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 > 0) { |
|
danakj
2014/07/07 20:06:28
you can still just do if (append_quads_data.num_in
weiliangc
2014/07/07 21:50:09
Do we still want to sum missing_tiles too? As in a
danakj
2014/07/07 21:52:01
I don't think so, then you'd double count them aga
weiliangc
2014/07/07 21:55:34
Ah, I forgot the parts after += num_incomplete_til
weiliangc
2014/07/07 22:01:21
Done.
| |
| 871 num_incomplete_tiles += append_quads_data.num_incomplete_tiles; | |
| 867 frame->contains_incomplete_tile = true; | 872 frame->contains_incomplete_tile = true; |
| 868 if (active_tree()->RequiresHighResToDraw()) | 873 if (active_tree()->RequiresHighResToDraw()) |
| 869 draw_result = DRAW_ABORTED_MISSING_HIGH_RES_CONTENT; | 874 draw_result = DRAW_ABORTED_MISSING_HIGH_RES_CONTENT; |
| 870 } | 875 } |
| 871 | 876 |
| 872 occlusion_tracker.LeaveLayer(it); | 877 occlusion_tracker.LeaveLayer(it); |
| 873 } | 878 } |
| 874 | 879 |
| 875 if (have_copy_request || | 880 if (have_copy_request || |
| 876 output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) | 881 output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 907 while (!active_tree_->LayersWithCopyOutputRequest().empty()) { | 912 while (!active_tree_->LayersWithCopyOutputRequest().empty()) { |
| 908 LayerImpl* layer = active_tree_->LayersWithCopyOutputRequest().back(); | 913 LayerImpl* layer = active_tree_->LayersWithCopyOutputRequest().back(); |
| 909 layer->TakeCopyRequestsAndTransformToTarget(&requests_to_abort); | 914 layer->TakeCopyRequestsAndTransformToTarget(&requests_to_abort); |
| 910 } | 915 } |
| 911 for (size_t i = 0; i < requests_to_abort.size(); ++i) | 916 for (size_t i = 0; i < requests_to_abort.size(); ++i) |
| 912 requests_to_abort[i]->SendEmptyResult(); | 917 requests_to_abort[i]->SendEmptyResult(); |
| 913 | 918 |
| 914 // If we're making a frame to draw, it better have at least one render pass. | 919 // If we're making a frame to draw, it better have at least one render pass. |
| 915 DCHECK(!frame->render_passes.empty()); | 920 DCHECK(!frame->render_passes.empty()); |
| 916 | 921 |
| 922 if (IsCurrentlyScrolling()) { | |
| 923 UMA_HISTOGRAM_COUNTS( | |
| 924 "Compositing.RenderPass.AppendQuadData.NumMissingTiles", | |
| 925 num_missing_tiles); | |
| 926 UMA_HISTOGRAM_COUNTS_100( | |
| 927 "Compositing.RenderPass.AppendQuadData.NumIncompleteTiles", | |
| 928 num_incomplete_tiles); | |
| 929 } | |
| 930 | |
| 917 // Should only have one render pass in resourceless software mode. | 931 // Should only have one render pass in resourceless software mode. |
| 918 if (output_surface_->ForcedDrawToSoftwareDevice()) | 932 if (output_surface_->ForcedDrawToSoftwareDevice()) |
| 919 DCHECK_EQ(1u, frame->render_passes.size()); | 933 DCHECK_EQ(1u, frame->render_passes.size()); |
| 920 | 934 |
| 921 return draw_result; | 935 return draw_result; |
| 922 } | 936 } |
| 923 | 937 |
| 924 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { | 938 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { |
| 925 if (input_handler_client_) | 939 if (input_handler_client_) |
| 926 input_handler_client_->MainThreadHasStoppedFlinging(); | 940 input_handler_client_->MainThreadHasStoppedFlinging(); |
| (...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3152 } | 3166 } |
| 3153 | 3167 |
| 3154 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3168 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3155 std::vector<PictureLayerImpl*>::iterator it = | 3169 std::vector<PictureLayerImpl*>::iterator it = |
| 3156 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3170 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3157 DCHECK(it != picture_layers_.end()); | 3171 DCHECK(it != picture_layers_.end()); |
| 3158 picture_layers_.erase(it); | 3172 picture_layers_.erase(it); |
| 3159 } | 3173 } |
| 3160 | 3174 |
| 3161 } // namespace cc | 3175 } // namespace cc |
| OLD | NEW |