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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 draw_property_utils::FindLayersThatNeedUpdates( | 1043 draw_property_utils::FindLayersThatNeedUpdates( |
1044 this, property_trees_.transform_tree, property_trees_.effect_tree, | 1044 this, property_trees_.transform_tree, property_trees_.effect_tree, |
1045 &update_layer_list); | 1045 &update_layer_list); |
1046 } | 1046 } |
1047 | 1047 |
1048 for (const auto& layer : update_layer_list) | 1048 for (const auto& layer : update_layer_list) |
1049 layer->SavePaintProperties(); | 1049 layer->SavePaintProperties(); |
1050 | 1050 |
1051 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); | 1051 base::AutoReset<bool> painting(&in_paint_layer_contents_, true); |
1052 bool did_paint_content = false; | 1052 bool did_paint_content = false; |
| 1053 bool content_is_suitable_for_gpu = true; |
1053 for (const auto& layer : update_layer_list) { | 1054 for (const auto& layer : update_layer_list) { |
1054 did_paint_content |= layer->Update(); | 1055 did_paint_content |= layer->Update(); |
1055 content_is_suitable_for_gpu_rasterization_ &= | 1056 content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); |
1056 layer->IsSuitableForGpuRasterization(); | 1057 } |
| 1058 |
| 1059 if (content_is_suitable_for_gpu) { |
| 1060 ++num_consecutive_frames_suitable_for_gpu_; |
| 1061 if (num_consecutive_frames_suitable_for_gpu_ >= |
| 1062 kNumFramesToConsiderBeforeGpuRasterization) { |
| 1063 content_is_suitable_for_gpu_rasterization_ = true; |
| 1064 } |
| 1065 } else { |
| 1066 num_consecutive_frames_suitable_for_gpu_ = 0; |
| 1067 content_is_suitable_for_gpu_rasterization_ = false; |
1057 } | 1068 } |
1058 return did_paint_content; | 1069 return did_paint_content; |
1059 } | 1070 } |
1060 | 1071 |
1061 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { | 1072 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
1062 for (auto& swap_promise : info->swap_promises) { | 1073 for (auto& swap_promise : info->swap_promises) { |
1063 TRACE_EVENT_WITH_FLOW1("input,benchmark", | 1074 TRACE_EVENT_WITH_FLOW1("input,benchmark", |
1064 "LatencyInfo.Flow", | 1075 "LatencyInfo.Flow", |
1065 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), | 1076 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), |
1066 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 1077 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 int seq_num = property_trees_.sequence_number; | 1773 int seq_num = property_trees_.sequence_number; |
1763 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { | 1774 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { |
1764 layer->set_property_tree_sequence_number(seq_num); | 1775 layer->set_property_tree_sequence_number(seq_num); |
1765 }); | 1776 }); |
1766 | 1777 |
1767 surface_id_namespace_ = proto.surface_id_namespace(); | 1778 surface_id_namespace_ = proto.surface_id_namespace(); |
1768 next_surface_sequence_ = proto.next_surface_sequence(); | 1779 next_surface_sequence_ = proto.next_surface_sequence(); |
1769 } | 1780 } |
1770 | 1781 |
1771 } // namespace cc | 1782 } // namespace cc |
OLD | NEW |