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

Side by Side Diff: content/test/web_layer_tree_view_impl_for_testing.cc

Issue 1413373007: CC AnimationHost: Fix LinkHighlights detach scope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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 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"
12 #include "cc/animation/animation_timeline.h"
11 #include "cc/base/switches.h" 13 #include "cc/base/switches.h"
14 #include "cc/blink/web_compositor_animation_timeline_impl.h"
12 #include "cc/blink/web_layer_impl.h" 15 #include "cc/blink/web_layer_impl.h"
13 #include "cc/input/input_handler.h" 16 #include "cc/input/input_handler.h"
14 #include "cc/layers/layer.h" 17 #include "cc/layers/layer.h"
15 #include "cc/scheduler/begin_frame_source.h" 18 #include "cc/scheduler/begin_frame_source.h"
16 #include "cc/trees/layer_tree_host.h" 19 #include "cc/trees/layer_tree_host.h"
17 #include "content/test/test_blink_web_unit_test_support.h" 20 #include "content/test/test_blink_web_unit_test_support.h"
18 #include "third_party/WebKit/public/platform/Platform.h" 21 #include "third_party/WebKit/public/platform/Platform.h"
19 #include "third_party/WebKit/public/platform/WebLayer.h" 22 #include "third_party/WebKit/public/platform/WebLayer.h"
20 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" 23 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
21 #include "third_party/WebKit/public/platform/WebSize.h" 24 #include "third_party/WebKit/public/platform/WebSize.h"
25 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
22 26
23 using blink::WebColor; 27 using blink::WebColor;
24 using blink::WebRect; 28 using blink::WebRect;
25 using blink::WebSize; 29 using blink::WebSize;
26 30
27 namespace content { 31 namespace content {
28 32
29 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() {} 33 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() {}
30 34
31 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} 35 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {}
32 36
33 void WebLayerTreeViewImplForTesting::Initialize() { 37 void WebLayerTreeViewImplForTesting::Initialize(
38 bool use_compositor_animation_timelines) {
34 cc::LayerTreeSettings settings; 39 cc::LayerTreeSettings settings;
35 40
36 // For web contents, layer transforms should scale up the contents of layers 41 // For web contents, layer transforms should scale up the contents of layers
37 // to keep content always crisp when possible. 42 // to keep content always crisp when possible.
38 settings.layer_transforms_should_scale_layer_contents = true; 43 settings.layer_transforms_should_scale_layer_contents = true;
39 44
40 // Accelerated animations are enabled for unit tests. 45 // Accelerated animations are enabled for unit tests.
41 settings.accelerated_animation_enabled = true; 46 settings.accelerated_animation_enabled = true;
47 settings.use_compositor_animation_timelines =
48 use_compositor_animation_timelines;
49 blink::WebRuntimeFeatures::enableCompositorAnimationTimelines(
50 use_compositor_animation_timelines);
loyso (OOO) 2015/11/03 05:08:53 Alternatively, we can land it with 'settings.use_c
chrishtr 2015/11/03 05:43:29 I think that would be better, since you'll want to
51
42 cc::LayerTreeHost::InitParams params; 52 cc::LayerTreeHost::InitParams params;
43 params.client = this; 53 params.client = this;
44 params.settings = &settings; 54 params.settings = &settings;
45 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); 55 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
46 params.task_graph_runner = &task_graph_runner_; 56 params.task_graph_runner = &task_graph_runner_;
47 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params); 57 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params);
48 DCHECK(layer_tree_host_); 58 DCHECK(layer_tree_host_);
49 } 59 }
50 60
51 void WebLayerTreeViewImplForTesting::setRootLayer( 61 void WebLayerTreeViewImplForTesting::setRootLayer(
52 const blink::WebLayer& root) { 62 const blink::WebLayer& root) {
53 layer_tree_host_->SetRootLayer( 63 layer_tree_host_->SetRootLayer(
54 static_cast<const cc_blink::WebLayerImpl*>(&root)->layer()); 64 static_cast<const cc_blink::WebLayerImpl*>(&root)->layer());
55 } 65 }
56 66
57 void WebLayerTreeViewImplForTesting::clearRootLayer() { 67 void WebLayerTreeViewImplForTesting::clearRootLayer() {
58 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); 68 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>());
59 } 69 }
60 70
71 void WebLayerTreeViewImplForTesting::attachCompositorAnimationTimeline(
72 blink::WebCompositorAnimationTimeline* compositor_timeline) {
73 DCHECK(compositor_timeline);
74 DCHECK(layer_tree_host_->animation_host());
75 layer_tree_host_->animation_host()->AddAnimationTimeline(
76 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>(
77 compositor_timeline)
78 ->animation_timeline());
79 }
80
81 void WebLayerTreeViewImplForTesting::detachCompositorAnimationTimeline(
82 blink::WebCompositorAnimationTimeline* compositor_timeline) {
83 DCHECK(compositor_timeline);
84 DCHECK(layer_tree_host_->animation_host());
85 layer_tree_host_->animation_host()->RemoveAnimationTimeline(
86 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>(
87 compositor_timeline)
88 ->animation_timeline());
89 }
90
61 void WebLayerTreeViewImplForTesting::setViewportSize( 91 void WebLayerTreeViewImplForTesting::setViewportSize(
62 const WebSize& unused_deprecated, 92 const WebSize& unused_deprecated,
63 const WebSize& device_viewport_size) { 93 const WebSize& device_viewport_size) {
64 layer_tree_host_->SetViewportSize(device_viewport_size); 94 layer_tree_host_->SetViewportSize(device_viewport_size);
65 } 95 }
66 96
67 void WebLayerTreeViewImplForTesting::setViewportSize( 97 void WebLayerTreeViewImplForTesting::setViewportSize(
68 const WebSize& device_viewport_size) { 98 const WebSize& device_viewport_size) {
69 layer_tree_host_->SetViewportSize(device_viewport_size); 99 layer_tree_host_->SetViewportSize(device_viewport_size);
70 } 100 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 197 }
168 198
169 void WebLayerTreeViewImplForTesting::registerSelection( 199 void WebLayerTreeViewImplForTesting::registerSelection(
170 const blink::WebSelection& selection) { 200 const blink::WebSelection& selection) {
171 } 201 }
172 202
173 void WebLayerTreeViewImplForTesting::clearSelection() { 203 void WebLayerTreeViewImplForTesting::clearSelection() {
174 } 204 }
175 205
176 } // namespace content 206 } // namespace content
OLDNEW
« no previous file with comments | « content/test/web_layer_tree_view_impl_for_testing.h ('k') | third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698