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 <algorithm> | 7 #include <algorithm> |
8 #include <stack> | 8 #include <stack> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/atomic_sequence_num.h" | 11 #include "base/atomic_sequence_num.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "cc/animation/animation_registrar.h" | 19 #include "cc/animation/animation_registrar.h" |
20 #include "cc/animation/layer_animation_controller.h" | 20 #include "cc/animation/layer_animation_controller.h" |
21 #include "cc/base/latency_info_swap_promise.h" | |
21 #include "cc/base/math_util.h" | 22 #include "cc/base/math_util.h" |
22 #include "cc/debug/devtools_instrumentation.h" | 23 #include "cc/debug/devtools_instrumentation.h" |
23 #include "cc/debug/rendering_stats_instrumentation.h" | 24 #include "cc/debug/rendering_stats_instrumentation.h" |
24 #include "cc/input/top_controls_manager.h" | 25 #include "cc/input/top_controls_manager.h" |
25 #include "cc/layers/heads_up_display_layer.h" | 26 #include "cc/layers/heads_up_display_layer.h" |
26 #include "cc/layers/heads_up_display_layer_impl.h" | 27 #include "cc/layers/heads_up_display_layer_impl.h" |
27 #include "cc/layers/layer.h" | 28 #include "cc/layers/layer.h" |
28 #include "cc/layers/layer_iterator.h" | 29 #include "cc/layers/layer_iterator.h" |
29 #include "cc/layers/painted_scrollbar_layer.h" | 30 #include "cc/layers/painted_scrollbar_layer.h" |
30 #include "cc/layers/render_surface.h" | 31 #include "cc/layers/render_surface.h" |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1007 occlusion_tracker.LeaveLayer(it); | 1008 occlusion_tracker.LeaveLayer(it); |
1008 } | 1009 } |
1009 | 1010 |
1010 in_paint_layer_contents_ = false; | 1011 in_paint_layer_contents_ = false; |
1011 } | 1012 } |
1012 | 1013 |
1013 void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) { | 1014 void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) { |
1014 if (!root_layer_.get()) | 1015 if (!root_layer_.get()) |
1015 return; | 1016 return; |
1016 | 1017 |
1018 for (size_t i = 0; i < info.latency_infos.size(); ++i) { | |
1019 ui::LatencyInfo latency_info = info.latency_infos[i]; | |
1020 if (!latency_info.FindLatency( | |
Yufeng Shen (Slow to review)
2014/07/04 18:34:34
why do we need this check ?
Sami
2014/07/07 14:28:18
Ah, you're right, the latency infos can only flow
| |
1021 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_BLINK_COMPONENT, 0, 0)) { | |
1022 latency_info.AddLatencyNumber( | |
1023 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_BLINK_COMPONENT, 0, 0); | |
Yufeng Shen (Slow to review)
2014/07/04 18:34:34
Are we planning to use this new component anywhere
Sami
2014/07/07 14:28:18
Yeah, end-to-end is what really matters here. I wa
| |
1024 TRACE_EVENT_FLOW_STEP0("input", | |
1025 "LatencyInfo.Flow", | |
1026 TRACE_ID_DONT_MANGLE(latency_info.trace_id), | |
1027 "Blink"); | |
1028 scoped_ptr<SwapPromise> swap_promise( | |
1029 new LatencyInfoSwapPromise(latency_info)); | |
1030 QueueSwapPromise(swap_promise.Pass()); | |
1031 } | |
1032 } | |
1033 | |
1017 gfx::Vector2d inner_viewport_scroll_delta; | 1034 gfx::Vector2d inner_viewport_scroll_delta; |
1018 gfx::Vector2d outer_viewport_scroll_delta; | 1035 gfx::Vector2d outer_viewport_scroll_delta; |
1019 | 1036 |
1020 for (size_t i = 0; i < info.scrolls.size(); ++i) { | 1037 for (size_t i = 0; i < info.scrolls.size(); ++i) { |
1021 Layer* layer = | 1038 Layer* layer = |
1022 LayerTreeHostCommon::FindLayerInSubtree(root_layer_.get(), | 1039 LayerTreeHostCommon::FindLayerInSubtree(root_layer_.get(), |
1023 info.scrolls[i].layer_id); | 1040 info.scrolls[i].layer_id); |
1024 if (!layer) | 1041 if (!layer) |
1025 continue; | 1042 continue; |
1026 if (layer == outer_viewport_scroll_layer_.get()) { | 1043 if (layer == outer_viewport_scroll_layer_.get()) { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1255 swap_promise_list_.push_back(swap_promise.Pass()); | 1272 swap_promise_list_.push_back(swap_promise.Pass()); |
1256 } | 1273 } |
1257 | 1274 |
1258 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1275 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1259 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1276 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1260 swap_promise_list_[i]->DidNotSwap(reason); | 1277 swap_promise_list_[i]->DidNotSwap(reason); |
1261 swap_promise_list_.clear(); | 1278 swap_promise_list_.clear(); |
1262 } | 1279 } |
1263 | 1280 |
1264 } // namespace cc | 1281 } // namespace cc |
OLD | NEW |