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/compositor_bindings/web_layer_tree_view_impl_for_testing.h" | 5 #include "webkit/compositor_bindings/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/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "cc/context_provider.h" | 10 #include "cc/context_provider.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "webkit/compositor_bindings/web_compositor_support_impl.h" | 26 #include "webkit/compositor_bindings/web_compositor_support_impl.h" |
27 #include "webkit/compositor_bindings/web_compositor_support_software_output_devi
ce.h" | 27 #include "webkit/compositor_bindings/web_compositor_support_software_output_devi
ce.h" |
28 #include "webkit/compositor_bindings/web_layer_impl.h" | 28 #include "webkit/compositor_bindings/web_layer_impl.h" |
29 #include "webkit/compositor_bindings/web_rendering_stats_impl.h" | 29 #include "webkit/compositor_bindings/web_rendering_stats_impl.h" |
30 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" | 30 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" |
31 #include "webkit/gpu/test_context_provider_factory.h" | 31 #include "webkit/gpu/test_context_provider_factory.h" |
32 #include "webkit/support/test_webkit_platform_support.h" | 32 #include "webkit/support/test_webkit_platform_support.h" |
33 | 33 |
34 namespace WebKit { | 34 namespace WebKit { |
35 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting( | 35 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting( |
36 RenderingType type, | 36 webkit_support::LayerTreeViewType type, |
37 webkit_support::DRTLayerTreeViewClient* client) | 37 webkit_support::DRTLayerTreeViewClient* client) |
38 : type_(type), | 38 : type_(type), |
39 client_(client) {} | 39 client_(client) {} |
40 | 40 |
41 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} | 41 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} |
42 | 42 |
43 bool WebLayerTreeViewImplForTesting::initialize( | 43 bool WebLayerTreeViewImplForTesting::initialize( |
44 scoped_ptr<cc::Thread> compositor_thread) { | 44 scoped_ptr<cc::Thread> compositor_thread) { |
45 cc::LayerTreeSettings settings; | 45 cc::LayerTreeSettings settings; |
46 // Accelerated animations are disabled for layout tests, but enabled for unit | 46 // Accelerated animations are disabled for layout tests, but enabled for unit |
47 // tests. | 47 // tests. |
48 settings.acceleratedAnimationEnabled = type_ == FAKE_CONTEXT; | 48 settings.acceleratedAnimationEnabled = type_ == webkit_support::FAKE_CONTEXT; |
49 layer_tree_host_ = | 49 layer_tree_host_ = |
50 cc::LayerTreeHost::create(this, settings, compositor_thread.Pass()); | 50 cc::LayerTreeHost::create(this, settings, compositor_thread.Pass()); |
51 if (!layer_tree_host_.get()) | 51 if (!layer_tree_host_.get()) |
52 return false; | 52 return false; |
53 return true; | 53 return true; |
54 } | 54 } |
55 | 55 |
56 void WebLayerTreeViewImplForTesting::setSurfaceReady() { | 56 void WebLayerTreeViewImplForTesting::setSurfaceReady() { |
57 layer_tree_host_->setSurfaceReady(); | 57 layer_tree_host_->setSurfaceReady(); |
58 } | 58 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 | 171 |
172 void WebLayerTreeViewImplForTesting::applyScrollAndScale( | 172 void WebLayerTreeViewImplForTesting::applyScrollAndScale( |
173 gfx::Vector2d scroll_delta, | 173 gfx::Vector2d scroll_delta, |
174 float page_scale) {} | 174 float page_scale) {} |
175 | 175 |
176 scoped_ptr<cc::OutputSurface> | 176 scoped_ptr<cc::OutputSurface> |
177 WebLayerTreeViewImplForTesting::createOutputSurface() { | 177 WebLayerTreeViewImplForTesting::createOutputSurface() { |
178 scoped_ptr<cc::OutputSurface> surface; | 178 scoped_ptr<cc::OutputSurface> surface; |
179 switch (type_) { | 179 switch (type_) { |
180 case FAKE_CONTEXT: { | 180 case webkit_support::FAKE_CONTEXT: { |
181 scoped_ptr<WebGraphicsContext3D> context3d( | 181 scoped_ptr<WebGraphicsContext3D> context3d( |
182 new cc::FakeWebGraphicsContext3D); | 182 new cc::FakeWebGraphicsContext3D); |
183 surface.reset(new cc::OutputSurface(context3d.Pass())); | 183 surface.reset(new cc::OutputSurface(context3d.Pass())); |
184 break; | 184 break; |
185 } | 185 } |
186 case SOFTWARE_CONTEXT: { | 186 case webkit_support::SOFTWARE_CONTEXT: { |
187 using webkit::WebCompositorSupportSoftwareOutputDevice; | 187 using webkit::WebCompositorSupportSoftwareOutputDevice; |
188 scoped_ptr<WebCompositorSupportSoftwareOutputDevice> software_device = | 188 scoped_ptr<WebCompositorSupportSoftwareOutputDevice> software_device = |
189 make_scoped_ptr(new WebCompositorSupportSoftwareOutputDevice); | 189 make_scoped_ptr(new WebCompositorSupportSoftwareOutputDevice); |
190 surface.reset(new cc::OutputSurface( | 190 surface.reset(new cc::OutputSurface( |
191 software_device.PassAs<cc::SoftwareOutputDevice>())); | 191 software_device.PassAs<cc::SoftwareOutputDevice>())); |
192 break; | 192 break; |
193 } | 193 } |
194 case MESA_CONTEXT: { | 194 case webkit_support::MESA_CONTEXT: { |
195 scoped_ptr<WebGraphicsContext3D> context3d( | 195 scoped_ptr<WebGraphicsContext3D> context3d( |
196 WebKit::Platform::current()->createOffscreenGraphicsContext3D( | 196 WebKit::Platform::current()->createOffscreenGraphicsContext3D( |
197 WebGraphicsContext3D::Attributes())); | 197 WebGraphicsContext3D::Attributes())); |
198 surface.reset(new cc::OutputSurface(context3d.Pass())); | 198 surface.reset(new cc::OutputSurface(context3d.Pass())); |
199 break; | 199 break; |
200 } | 200 } |
201 } | 201 } |
202 return surface.Pass(); | 202 return surface.Pass(); |
203 } | 203 } |
204 | 204 |
(...skipping 23 matching lines...) Expand all Loading... |
228 OffscreenContextProviderForMainThread(); | 228 OffscreenContextProviderForMainThread(); |
229 } | 229 } |
230 | 230 |
231 scoped_refptr<cc::ContextProvider> | 231 scoped_refptr<cc::ContextProvider> |
232 WebLayerTreeViewImplForTesting::OffscreenContextProviderForCompositorThread() { | 232 WebLayerTreeViewImplForTesting::OffscreenContextProviderForCompositorThread() { |
233 return webkit::gpu::TestContextProviderFactory::GetInstance()-> | 233 return webkit::gpu::TestContextProviderFactory::GetInstance()-> |
234 OffscreenContextProviderForCompositorThread(); | 234 OffscreenContextProviderForCompositorThread(); |
235 } | 235 } |
236 | 236 |
237 } // namespace WebKit | 237 } // namespace WebKit |
OLD | NEW |