| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/test/web_layer_tree_view_impl_for_testing.h" | 5 #include "content/test/web_layer_tree_view_impl_for_testing.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "cc/animation/animation_host.h" | 11 #include "cc/animation/animation_host.h" |
| 12 #include "cc/animation/animation_timeline.h" | 12 #include "cc/animation/animation_timeline.h" |
| 13 #include "cc/base/switches.h" | 13 #include "cc/base/switches.h" |
| 14 #include "cc/blink/web_compositor_animation_timeline_impl.h" | |
| 15 #include "cc/blink/web_layer_impl.h" | 14 #include "cc/blink/web_layer_impl.h" |
| 16 #include "cc/input/input_handler.h" | 15 #include "cc/input/input_handler.h" |
| 17 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
| 18 #include "cc/scheduler/begin_frame_source.h" | 17 #include "cc/scheduler/begin_frame_source.h" |
| 19 #include "cc/trees/layer_tree_host.h" | 18 #include "cc/trees/layer_tree_host.h" |
| 20 #include "content/test/test_blink_web_unit_test_support.h" | 19 #include "content/test/test_blink_web_unit_test_support.h" |
| 21 #include "third_party/WebKit/public/platform/Platform.h" | 20 #include "third_party/WebKit/public/platform/Platform.h" |
| 22 #include "third_party/WebKit/public/platform/WebLayer.h" | 21 #include "third_party/WebKit/public/platform/WebLayer.h" |
| 23 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" | 22 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" |
| 24 #include "third_party/WebKit/public/platform/WebSize.h" | 23 #include "third_party/WebKit/public/platform/WebSize.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 const blink::WebLayer& root) { | 58 const blink::WebLayer& root) { |
| 60 layer_tree_host_->SetRootLayer( | 59 layer_tree_host_->SetRootLayer( |
| 61 static_cast<const cc_blink::WebLayerImpl*>(&root)->layer()); | 60 static_cast<const cc_blink::WebLayerImpl*>(&root)->layer()); |
| 62 } | 61 } |
| 63 | 62 |
| 64 void WebLayerTreeViewImplForTesting::clearRootLayer() { | 63 void WebLayerTreeViewImplForTesting::clearRootLayer() { |
| 65 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); | 64 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
| 66 } | 65 } |
| 67 | 66 |
| 68 void WebLayerTreeViewImplForTesting::attachCompositorAnimationTimeline( | 67 void WebLayerTreeViewImplForTesting::attachCompositorAnimationTimeline( |
| 69 blink::WebCompositorAnimationTimeline* compositor_timeline) { | 68 cc::AnimationTimeline* compositor_timeline) { |
| 70 DCHECK(compositor_timeline); | |
| 71 DCHECK(layer_tree_host_->animation_host()); | 69 DCHECK(layer_tree_host_->animation_host()); |
| 72 layer_tree_host_->animation_host()->AddAnimationTimeline( | 70 layer_tree_host_->animation_host()->AddAnimationTimeline(compositor_timeline); |
| 73 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>( | |
| 74 compositor_timeline) | |
| 75 ->animation_timeline()); | |
| 76 } | 71 } |
| 77 | 72 |
| 78 void WebLayerTreeViewImplForTesting::detachCompositorAnimationTimeline( | 73 void WebLayerTreeViewImplForTesting::detachCompositorAnimationTimeline( |
| 79 blink::WebCompositorAnimationTimeline* compositor_timeline) { | 74 cc::AnimationTimeline* compositor_timeline) { |
| 80 DCHECK(compositor_timeline); | |
| 81 DCHECK(layer_tree_host_->animation_host()); | 75 DCHECK(layer_tree_host_->animation_host()); |
| 82 layer_tree_host_->animation_host()->RemoveAnimationTimeline( | 76 layer_tree_host_->animation_host()->RemoveAnimationTimeline( |
| 83 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>( | 77 compositor_timeline); |
| 84 compositor_timeline) | |
| 85 ->animation_timeline()); | |
| 86 } | 78 } |
| 87 | 79 |
| 88 void WebLayerTreeViewImplForTesting::setViewportSize( | 80 void WebLayerTreeViewImplForTesting::setViewportSize( |
| 89 const WebSize& unused_deprecated, | 81 const WebSize& unused_deprecated, |
| 90 const WebSize& device_viewport_size) { | 82 const WebSize& device_viewport_size) { |
| 91 layer_tree_host_->SetViewportSize(device_viewport_size); | 83 layer_tree_host_->SetViewportSize(device_viewport_size); |
| 92 } | 84 } |
| 93 | 85 |
| 94 void WebLayerTreeViewImplForTesting::setViewportSize( | 86 void WebLayerTreeViewImplForTesting::setViewportSize( |
| 95 const WebSize& device_viewport_size) { | 87 const WebSize& device_viewport_size) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 void WebLayerTreeViewImplForTesting::setHaveScrollEventHandlers( | 213 void WebLayerTreeViewImplForTesting::setHaveScrollEventHandlers( |
| 222 bool have_event_handlers) { | 214 bool have_event_handlers) { |
| 223 layer_tree_host_->SetHaveScrollEventHandlers(have_event_handlers); | 215 layer_tree_host_->SetHaveScrollEventHandlers(have_event_handlers); |
| 224 } | 216 } |
| 225 | 217 |
| 226 bool WebLayerTreeViewImplForTesting::haveScrollEventHandlers() const { | 218 bool WebLayerTreeViewImplForTesting::haveScrollEventHandlers() const { |
| 227 return layer_tree_host_->have_scroll_event_handlers(); | 219 return layer_tree_host_->have_scroll_event_handlers(); |
| 228 } | 220 } |
| 229 | 221 |
| 230 } // namespace content | 222 } // namespace content |
| OLD | NEW |