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

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

Issue 2692243005: Merge Compositor's ScrollbarAnimationControllers into single class (Closed)
Patch Set: fix confict constant Created 3 years, 10 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_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>
11 #include <iterator> 11 #include <iterator>
12 #include <limits> 12 #include <limits>
13 #include <set> 13 #include <set>
14 14
15 #include "base/containers/adapters.h" 15 #include "base/containers/adapters.h"
16 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
17 #include "base/timer/elapsed_timer.h" 17 #include "base/timer/elapsed_timer.h"
18 #include "base/trace_event/trace_event.h" 18 #include "base/trace_event/trace_event.h"
19 #include "base/trace_event/trace_event_argument.h" 19 #include "base/trace_event/trace_event_argument.h"
20 #include "cc/base/histograms.h" 20 #include "cc/base/histograms.h"
21 #include "cc/base/math_util.h" 21 #include "cc/base/math_util.h"
22 #include "cc/base/synced_property.h" 22 #include "cc/base/synced_property.h"
23 #include "cc/debug/devtools_instrumentation.h" 23 #include "cc/debug/devtools_instrumentation.h"
24 #include "cc/debug/traced_value.h" 24 #include "cc/debug/traced_value.h"
25 #include "cc/input/page_scale_animation.h" 25 #include "cc/input/page_scale_animation.h"
26 #include "cc/input/scrollbar_animation_controller.h" 26 #include "cc/input/scrollbar_animation_controller.h"
27 #include "cc/input/scrollbar_animation_controller_linear_fade.h"
28 #include "cc/input/scrollbar_animation_controller_thinning.h"
29 #include "cc/layers/heads_up_display_layer_impl.h" 27 #include "cc/layers/heads_up_display_layer_impl.h"
30 #include "cc/layers/layer.h" 28 #include "cc/layers/layer.h"
31 #include "cc/layers/layer_iterator.h" 29 #include "cc/layers/layer_iterator.h"
32 #include "cc/layers/layer_list_iterator.h" 30 #include "cc/layers/layer_list_iterator.h"
33 #include "cc/layers/render_surface_impl.h" 31 #include "cc/layers/render_surface_impl.h"
34 #include "cc/layers/scrollbar_layer_impl_base.h" 32 #include "cc/layers/scrollbar_layer_impl_base.h"
35 #include "cc/output/compositor_frame_sink.h" 33 #include "cc/output/compositor_frame_sink.h"
36 #include "cc/resources/ui_resource_request.h" 34 #include "cc/resources/ui_resource_request.h"
37 #include "cc/trees/clip_node.h" 35 #include "cc/trees/clip_node.h"
38 #include "cc/trees/draw_property_utils.h" 36 #include "cc/trees/draw_property_utils.h"
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 } 1369 }
1372 1370
1373 std::unique_ptr<ScrollbarAnimationController> 1371 std::unique_ptr<ScrollbarAnimationController>
1374 LayerTreeImpl::CreateScrollbarAnimationController(int scroll_layer_id) { 1372 LayerTreeImpl::CreateScrollbarAnimationController(int scroll_layer_id) {
1375 DCHECK(!settings().scrollbar_fade_delay.is_zero()); 1373 DCHECK(!settings().scrollbar_fade_delay.is_zero());
1376 DCHECK(!settings().scrollbar_fade_duration.is_zero()); 1374 DCHECK(!settings().scrollbar_fade_duration.is_zero());
1377 base::TimeDelta delay = settings().scrollbar_fade_delay; 1375 base::TimeDelta delay = settings().scrollbar_fade_delay;
1378 base::TimeDelta resize_delay = settings().scrollbar_fade_resize_delay; 1376 base::TimeDelta resize_delay = settings().scrollbar_fade_resize_delay;
1379 base::TimeDelta fade_duration = settings().scrollbar_fade_duration; 1377 base::TimeDelta fade_duration = settings().scrollbar_fade_duration;
1380 switch (settings().scrollbar_animator) { 1378 switch (settings().scrollbar_animator) {
1381 case LayerTreeSettings::LINEAR_FADE: { 1379 case LayerTreeSettings::ANDROID_OVERLAY: {
1382 return ScrollbarAnimationControllerLinearFade::Create( 1380 return ScrollbarAnimationController::
1383 scroll_layer_id, layer_tree_host_impl_, delay, resize_delay, 1381 CreateScrollbarAnimationControllerAndroid(
1384 fade_duration); 1382 scroll_layer_id, layer_tree_host_impl_, delay, resize_delay,
1383 fade_duration);
1385 } 1384 }
1386 case LayerTreeSettings::THINNING: { 1385 case LayerTreeSettings::AURA_OVERLAY: {
1387 base::TimeDelta thinning_duration = 1386 base::TimeDelta thinning_duration =
1388 settings().scrollbar_thinning_duration; 1387 settings().scrollbar_thinning_duration;
1389 return ScrollbarAnimationControllerThinning::Create( 1388 return ScrollbarAnimationController::
1390 scroll_layer_id, layer_tree_host_impl_, delay, resize_delay, 1389 CreateScrollbarAnimationControllerAuraOverlay(
1391 fade_duration, thinning_duration); 1390 scroll_layer_id, layer_tree_host_impl_, delay, resize_delay,
1391 fade_duration, thinning_duration);
1392 } 1392 }
1393 case LayerTreeSettings::NO_ANIMATOR: 1393 case LayerTreeSettings::NO_ANIMATOR:
1394 NOTREACHED(); 1394 NOTREACHED();
1395 break; 1395 break;
1396 } 1396 }
1397 return nullptr; 1397 return nullptr;
1398 } 1398 }
1399 1399
1400 void LayerTreeImpl::DidAnimateScrollOffset() { 1400 void LayerTreeImpl::DidAnimateScrollOffset() {
1401 layer_tree_host_impl_->DidAnimateScrollOffset(); 1401 layer_tree_host_impl_->DidAnimateScrollOffset();
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 2093
2094 void LayerTreeImpl::ResetAllChangeTracking() { 2094 void LayerTreeImpl::ResetAllChangeTracking() {
2095 layers_that_should_push_properties_.clear(); 2095 layers_that_should_push_properties_.clear();
2096 // Iterate over all layers, including masks. 2096 // Iterate over all layers, including masks.
2097 for (auto& layer : *layers_) 2097 for (auto& layer : *layers_)
2098 layer->ResetChangeTracking(); 2098 layer->ResetChangeTracking();
2099 property_trees_.ResetAllChangeTracking(); 2099 property_trees_.ResetAllChangeTracking();
2100 } 2100 }
2101 2101
2102 } // namespace cc 2102 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698