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_impl.h" | 5 #include "cc/trees/layer_tree_impl.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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 LayerTreeHostCommon::CalcDrawPropsImplInputs inputs( | 1022 LayerTreeHostCommon::CalcDrawPropsImplInputs inputs( |
1023 layer_list_[0], DrawViewportSize(), | 1023 layer_list_[0], DrawViewportSize(), |
1024 layer_tree_host_impl_->DrawTransform(), device_scale_factor(), | 1024 layer_tree_host_impl_->DrawTransform(), device_scale_factor(), |
1025 current_page_scale_factor(), PageScaleLayer(), | 1025 current_page_scale_factor(), PageScaleLayer(), |
1026 InnerViewportScrollLayer(), OuterViewportScrollLayer(), | 1026 InnerViewportScrollLayer(), OuterViewportScrollLayer(), |
1027 elastic_overscroll()->Current(IsActiveTree()), | 1027 elastic_overscroll()->Current(IsActiveTree()), |
1028 OverscrollElasticityLayer(), resource_provider()->max_texture_size(), | 1028 OverscrollElasticityLayer(), resource_provider()->max_texture_size(), |
1029 can_render_to_separate_surface, | 1029 can_render_to_separate_surface, |
1030 settings().layer_transforms_should_scale_layer_contents, | 1030 settings().layer_transforms_should_scale_layer_contents, |
1031 settings().verify_clip_tree_calculations, | 1031 settings().verify_clip_tree_calculations, |
1032 verify_visible_rect_calculations, | 1032 verify_visible_rect_calculations, &render_surface_layer_list_, |
1033 &render_surface_layer_list_, &property_trees_); | 1033 &property_trees_); |
1034 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1034 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
1035 if (const char* client_name = GetClientNameForMetrics()) { | 1035 if (const char* client_name = GetClientNameForMetrics()) { |
1036 UMA_HISTOGRAM_COUNTS( | 1036 UMA_HISTOGRAM_COUNTS( |
1037 base::StringPrintf( | 1037 base::StringPrintf( |
1038 "Compositing.%s.LayerTreeImpl.CalculateDrawPropertiesUs", | 1038 "Compositing.%s.LayerTreeImpl.CalculateDrawPropertiesUs", |
1039 client_name), | 1039 client_name), |
1040 timer.Elapsed().InMicroseconds()); | 1040 timer.Elapsed().InMicroseconds()); |
1041 UMA_HISTOGRAM_COUNTS_100( | 1041 UMA_HISTOGRAM_COUNTS_100( |
1042 base::StringPrintf("Compositing.%s.NumRenderSurfaces", client_name), | 1042 base::StringPrintf("Compositing.%s.NumRenderSurfaces", client_name), |
1043 base::saturated_cast<int>(render_surface_layer_list_.size())); | 1043 base::saturated_cast<int>(render_surface_layer_list_.size())); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 gfx::Size LayerTreeImpl::DrawViewportSize() const { | 1388 gfx::Size LayerTreeImpl::DrawViewportSize() const { |
1389 return layer_tree_host_impl_->DrawViewportSize(); | 1389 return layer_tree_host_impl_->DrawViewportSize(); |
1390 } | 1390 } |
1391 | 1391 |
1392 const gfx::Rect LayerTreeImpl::ViewportRectForTilePriority() const { | 1392 const gfx::Rect LayerTreeImpl::ViewportRectForTilePriority() const { |
1393 return layer_tree_host_impl_->ViewportRectForTilePriority(); | 1393 return layer_tree_host_impl_->ViewportRectForTilePriority(); |
1394 } | 1394 } |
1395 | 1395 |
1396 std::unique_ptr<ScrollbarAnimationController> | 1396 std::unique_ptr<ScrollbarAnimationController> |
1397 LayerTreeImpl::CreateScrollbarAnimationController(int scroll_layer_id) { | 1397 LayerTreeImpl::CreateScrollbarAnimationController(int scroll_layer_id) { |
1398 DCHECK(!settings().scrollbar_fade_delay.is_zero()); | 1398 DCHECK(!settings().scrollbar_fade_out_delay.is_zero()); |
1399 DCHECK(!settings().scrollbar_fade_duration.is_zero()); | 1399 DCHECK(!settings().scrollbar_fade_out_duration.is_zero()); |
1400 base::TimeDelta delay = settings().scrollbar_fade_delay; | 1400 base::TimeDelta fade_out_delay = settings().scrollbar_fade_out_delay; |
1401 base::TimeDelta resize_delay = settings().scrollbar_fade_resize_delay; | 1401 base::TimeDelta fade_out_resize_delay = |
1402 base::TimeDelta fade_duration = settings().scrollbar_fade_duration; | 1402 settings().scrollbar_fade_out_resize_delay; |
| 1403 base::TimeDelta fade_out_duration = settings().scrollbar_fade_out_duration; |
1403 switch (settings().scrollbar_animator) { | 1404 switch (settings().scrollbar_animator) { |
1404 case LayerTreeSettings::ANDROID_OVERLAY: { | 1405 case LayerTreeSettings::ANDROID_OVERLAY: { |
1405 return ScrollbarAnimationController:: | 1406 return ScrollbarAnimationController:: |
1406 CreateScrollbarAnimationControllerAndroid( | 1407 CreateScrollbarAnimationControllerAndroid( |
1407 scroll_layer_id, layer_tree_host_impl_, delay, resize_delay, | 1408 scroll_layer_id, layer_tree_host_impl_, fade_out_delay, |
1408 fade_duration); | 1409 fade_out_resize_delay, fade_out_duration); |
1409 } | 1410 } |
1410 case LayerTreeSettings::AURA_OVERLAY: { | 1411 case LayerTreeSettings::AURA_OVERLAY: { |
| 1412 DCHECK(!settings().scrollbar_show_delay.is_zero()); |
| 1413 base::TimeDelta show_delay = settings().scrollbar_show_delay; |
1411 base::TimeDelta thinning_duration = | 1414 base::TimeDelta thinning_duration = |
1412 settings().scrollbar_thinning_duration; | 1415 settings().scrollbar_thinning_duration; |
1413 return ScrollbarAnimationController:: | 1416 return ScrollbarAnimationController:: |
1414 CreateScrollbarAnimationControllerAuraOverlay( | 1417 CreateScrollbarAnimationControllerAuraOverlay( |
1415 scroll_layer_id, layer_tree_host_impl_, delay, resize_delay, | 1418 scroll_layer_id, layer_tree_host_impl_, show_delay, |
1416 fade_duration, thinning_duration); | 1419 fade_out_delay, fade_out_resize_delay, fade_out_duration, |
| 1420 thinning_duration); |
1417 } | 1421 } |
1418 case LayerTreeSettings::NO_ANIMATOR: | 1422 case LayerTreeSettings::NO_ANIMATOR: |
1419 NOTREACHED(); | 1423 NOTREACHED(); |
1420 break; | 1424 break; |
1421 } | 1425 } |
1422 return nullptr; | 1426 return nullptr; |
1423 } | 1427 } |
1424 | 1428 |
1425 void LayerTreeImpl::DidAnimateScrollOffset() { | 1429 void LayerTreeImpl::DidAnimateScrollOffset() { |
1426 layer_tree_host_impl_->DidAnimateScrollOffset(); | 1430 layer_tree_host_impl_->DidAnimateScrollOffset(); |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 | 2122 |
2119 void LayerTreeImpl::ResetAllChangeTracking() { | 2123 void LayerTreeImpl::ResetAllChangeTracking() { |
2120 layers_that_should_push_properties_.clear(); | 2124 layers_that_should_push_properties_.clear(); |
2121 // Iterate over all layers, including masks. | 2125 // Iterate over all layers, including masks. |
2122 for (auto& layer : *layers_) | 2126 for (auto& layer : *layers_) |
2123 layer->ResetChangeTracking(); | 2127 layer->ResetChangeTracking(); |
2124 property_trees_.ResetAllChangeTracking(); | 2128 property_trees_.ResetAllChangeTracking(); |
2125 } | 2129 } |
2126 | 2130 |
2127 } // namespace cc | 2131 } // namespace cc |
OLD | NEW |