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/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "cc/append_quads_data.h" | 12 #include "cc/append_quads_data.h" |
13 #include "cc/damage_tracker.h" | 13 #include "cc/damage_tracker.h" |
14 #include "cc/debug_rect_history.h" | 14 #include "cc/debug_rect_history.h" |
15 #include "cc/delay_based_time_source.h" | 15 #include "cc/delay_based_time_source.h" |
16 #include "cc/delegating_renderer.h" | 16 #include "cc/delegating_renderer.h" |
17 #include "cc/frame_rate_counter.h" | 17 #include "cc/frame_rate_counter.h" |
18 #include "cc/gl_renderer.h" | 18 #include "cc/gl_renderer.h" |
19 #include "cc/heads_up_display_layer_impl.h" | 19 #include "cc/heads_up_display_layer_impl.h" |
20 #include "cc/layer_iterator.h" | 20 #include "cc/layer_iterator.h" |
21 #include "cc/layer_tree_host.h" | 21 #include "cc/layer_tree_host.h" |
22 #include "cc/layer_tree_host_common.h" | 22 #include "cc/layer_tree_host_common.h" |
| 23 #include "cc/layer_tree_impl.h" |
23 #include "cc/math_util.h" | 24 #include "cc/math_util.h" |
24 #include "cc/overdraw_metrics.h" | 25 #include "cc/overdraw_metrics.h" |
25 #include "cc/page_scale_animation.h" | 26 #include "cc/page_scale_animation.h" |
26 #include "cc/prioritized_resource_manager.h" | 27 #include "cc/prioritized_resource_manager.h" |
27 #include "cc/quad_culler.h" | 28 #include "cc/quad_culler.h" |
28 #include "cc/render_pass_draw_quad.h" | 29 #include "cc/render_pass_draw_quad.h" |
29 #include "cc/rendering_stats.h" | 30 #include "cc/rendering_stats.h" |
30 #include "cc/scrollbar_animation_controller.h" | 31 #include "cc/scrollbar_animation_controller.h" |
31 #include "cc/scrollbar_layer_impl.h" | 32 #include "cc/scrollbar_layer_impl.h" |
32 #include "cc/shared_quad_state.h" | 33 #include "cc/shared_quad_state.h" |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 { | 949 { |
949 m_client->onSwapBuffersCompleteOnImplThread(); | 950 m_client->onSwapBuffersCompleteOnImplThread(); |
950 } | 951 } |
951 | 952 |
952 void LayerTreeHostImpl::readback(void* pixels, const gfx::Rect& rect) | 953 void LayerTreeHostImpl::readback(void* pixels, const gfx::Rect& rect) |
953 { | 954 { |
954 DCHECK(m_renderer); | 955 DCHECK(m_renderer); |
955 m_renderer->getFramebufferPixels(pixels, rect); | 956 m_renderer->getFramebufferPixels(pixels, rect); |
956 } | 957 } |
957 | 958 |
| 959 LayerImpl* LayerTreeHostImpl::rootLayer() const |
| 960 { |
| 961 return m_activeTree->RootLayer(); |
| 962 } |
| 963 |
| 964 LayerImpl* LayerTreeHostImpl::rootScrollLayer() const |
| 965 { |
| 966 return m_activeTree->root_scroll_layer(); |
| 967 } |
| 968 |
| 969 LayerImpl* LayerTreeHostImpl::currentlyScrollingLayer() const |
| 970 { |
| 971 return m_activeTree->currently_scrolling_layer(); |
| 972 } |
| 973 |
958 // Content layers can be either directly scrollable or contained in an outer | 974 // Content layers can be either directly scrollable or contained in an outer |
959 // scrolling layer which applies the scroll transform. Given a content layer, | 975 // scrolling layer which applies the scroll transform. Given a content layer, |
960 // this function returns the associated scroll layer if any. | 976 // this function returns the associated scroll layer if any. |
961 static LayerImpl* findScrollLayerForContentLayer(LayerImpl* layerImpl) | 977 static LayerImpl* findScrollLayerForContentLayer(LayerImpl* layerImpl) |
962 { | 978 { |
963 if (!layerImpl) | 979 if (!layerImpl) |
964 return 0; | 980 return 0; |
965 | 981 |
966 if (layerImpl->scrollable()) | 982 if (layerImpl->scrollable()) |
967 return layerImpl; | 983 return layerImpl; |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); | 1720 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio
nController(); |
1705 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 1721 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); |
1706 if (scrollbarController && scrollbarController->animate(monotonicTime)) | 1722 if (scrollbarController && scrollbarController->animate(monotonicTime)) |
1707 m_client->setNeedsRedrawOnImplThread(); | 1723 m_client->setNeedsRedrawOnImplThread(); |
1708 | 1724 |
1709 for (size_t i = 0; i < layer->children().size(); ++i) | 1725 for (size_t i = 0; i < layer->children().size(); ++i) |
1710 animateScrollbarsRecursive(layer->children()[i], time); | 1726 animateScrollbarsRecursive(layer->children()[i], time); |
1711 } | 1727 } |
1712 | 1728 |
1713 } // namespace cc | 1729 } // namespace cc |
OLD | NEW |