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 "webkit/support/web_layer_tree_view_impl_for_testing.h" | 5 #include "webkit/support/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 "cc/base/switches.h" | 10 #include "cc/base/switches.h" |
11 #include "cc/base/thread.h" | |
12 #include "cc/base/thread_impl.h" | |
13 #include "cc/debug/fake_web_graphics_context_3d.h" | 11 #include "cc/debug/fake_web_graphics_context_3d.h" |
14 #include "cc/input/input_handler.h" | 12 #include "cc/input/input_handler.h" |
15 #include "cc/layers/layer.h" | 13 #include "cc/layers/layer.h" |
16 #include "cc/output/context_provider.h" | 14 #include "cc/output/context_provider.h" |
17 #include "cc/output/output_surface.h" | 15 #include "cc/output/output_surface.h" |
18 #include "cc/output/software_output_device.h" | 16 #include "cc/output/software_output_device.h" |
19 #include "cc/trees/layer_tree_host.h" | 17 #include "cc/trees/layer_tree_host.h" |
20 #include "third_party/WebKit/public/platform/Platform.h" | 18 #include "third_party/WebKit/public/platform/Platform.h" |
21 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 19 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
22 #include "third_party/WebKit/public/platform/WebLayer.h" | 20 #include "third_party/WebKit/public/platform/WebLayer.h" |
(...skipping 13 matching lines...) Expand all Loading... |
36 namespace webkit { | 34 namespace webkit { |
37 | 35 |
38 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting( | 36 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting( |
39 webkit_support::LayerTreeViewType type, | 37 webkit_support::LayerTreeViewType type, |
40 webkit_support::DRTLayerTreeViewClient* client) | 38 webkit_support::DRTLayerTreeViewClient* client) |
41 : type_(type), | 39 : type_(type), |
42 client_(client) {} | 40 client_(client) {} |
43 | 41 |
44 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} | 42 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} |
45 | 43 |
46 bool WebLayerTreeViewImplForTesting::Initialize( | 44 bool WebLayerTreeViewImplForTesting::Initialize() { |
47 scoped_ptr<cc::Thread> compositor_thread) { | |
48 cc::LayerTreeSettings settings; | 45 cc::LayerTreeSettings settings; |
49 | 46 |
50 // For web contents, layer transforms should scale up the contents of layers | 47 // For web contents, layer transforms should scale up the contents of layers |
51 // to keep content always crisp when possible. | 48 // to keep content always crisp when possible. |
52 settings.layer_transforms_should_scale_layer_contents = true; | 49 settings.layer_transforms_should_scale_layer_contents = true; |
53 | 50 |
54 // Accelerated animations are disabled for layout tests, but enabled for unit | 51 // Accelerated animations are disabled for layout tests, but enabled for unit |
55 // tests. | 52 // tests. |
56 settings.accelerated_animation_enabled = | 53 settings.accelerated_animation_enabled = |
57 type_ == webkit_support::FAKE_CONTEXT; | 54 type_ == webkit_support::FAKE_CONTEXT; |
58 layer_tree_host_ = | 55 layer_tree_host_ = cc::LayerTreeHost::Create(this, settings, NULL); |
59 cc::LayerTreeHost::Create(this, settings, compositor_thread.Pass()); | |
60 if (!layer_tree_host_) | 56 if (!layer_tree_host_) |
61 return false; | 57 return false; |
62 return true; | 58 return true; |
63 } | 59 } |
64 | 60 |
65 void WebLayerTreeViewImplForTesting::setSurfaceReady() { | 61 void WebLayerTreeViewImplForTesting::setSurfaceReady() { |
66 layer_tree_host_->SetLayerTreeHostClientReady(); | 62 layer_tree_host_->SetLayerTreeHostClientReady(); |
67 } | 63 } |
68 | 64 |
69 void WebLayerTreeViewImplForTesting::setRootLayer( | 65 void WebLayerTreeViewImplForTesting::setRootLayer( |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 OffscreenContextProviderForMainThread(); | 203 OffscreenContextProviderForMainThread(); |
208 } | 204 } |
209 | 205 |
210 scoped_refptr<cc::ContextProvider> | 206 scoped_refptr<cc::ContextProvider> |
211 WebLayerTreeViewImplForTesting::OffscreenContextProviderForCompositorThread() { | 207 WebLayerTreeViewImplForTesting::OffscreenContextProviderForCompositorThread() { |
212 return webkit::gpu::TestContextProviderFactory::GetInstance()-> | 208 return webkit::gpu::TestContextProviderFactory::GetInstance()-> |
213 OffscreenContextProviderForCompositorThread(); | 209 OffscreenContextProviderForCompositorThread(); |
214 } | 210 } |
215 | 211 |
216 } // namespace webkit | 212 } // namespace webkit |
OLD | NEW |