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 "cc/base/switches.h" | 10 #include "cc/base/switches.h" |
11 #include "cc/input/input_handler.h" | 11 #include "cc/input/input_handler.h" |
12 #include "cc/layers/layer.h" | 12 #include "cc/layers/layer.h" |
13 #include "cc/output/output_surface.h" | 13 #include "cc/output/output_surface.h" |
14 #include "cc/test/test_context_provider.h" | 14 #include "cc/test/test_context_provider.h" |
15 #include "cc/trees/layer_tree_host.h" | 15 #include "cc/trees/layer_tree_host.h" |
16 #include "content/test/test_context_provider_factory.h" | |
17 #include "content/test/test_webkit_platform_support.h" | 16 #include "content/test/test_webkit_platform_support.h" |
18 #include "third_party/WebKit/public/platform/Platform.h" | 17 #include "third_party/WebKit/public/platform/Platform.h" |
19 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 18 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
20 #include "third_party/WebKit/public/platform/WebLayer.h" | 19 #include "third_party/WebKit/public/platform/WebLayer.h" |
21 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" | 20 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" |
22 #include "third_party/WebKit/public/platform/WebSize.h" | 21 #include "third_party/WebKit/public/platform/WebSize.h" |
23 #include "ui/gfx/frame_time.h" | 22 #include "ui/gfx/frame_time.h" |
24 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 23 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
25 | 24 |
26 using blink::WebColor; | 25 using blink::WebColor; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void WebLayerTreeViewImplForTesting::ApplyScrollAndScale( | 142 void WebLayerTreeViewImplForTesting::ApplyScrollAndScale( |
144 const gfx::Vector2d& scroll_delta, | 143 const gfx::Vector2d& scroll_delta, |
145 float page_scale) {} | 144 float page_scale) {} |
146 | 145 |
147 scoped_ptr<cc::OutputSurface> | 146 scoped_ptr<cc::OutputSurface> |
148 WebLayerTreeViewImplForTesting::CreateOutputSurface(bool fallback) { | 147 WebLayerTreeViewImplForTesting::CreateOutputSurface(bool fallback) { |
149 return make_scoped_ptr( | 148 return make_scoped_ptr( |
150 new cc::OutputSurface(cc::TestContextProvider::Create())); | 149 new cc::OutputSurface(cc::TestContextProvider::Create())); |
151 } | 150 } |
152 | 151 |
153 scoped_refptr<cc::ContextProvider> | |
154 WebLayerTreeViewImplForTesting::OffscreenContextProvider() { | |
155 // Unit tests only run in single threaded mode. | |
156 return content::TestContextProviderFactory::GetInstance()-> | |
157 OffscreenContextProviderForMainThread(); | |
158 } | |
159 | |
160 void WebLayerTreeViewImplForTesting::registerViewportLayers( | 152 void WebLayerTreeViewImplForTesting::registerViewportLayers( |
161 const blink::WebLayer* pageScaleLayer, | 153 const blink::WebLayer* pageScaleLayer, |
162 const blink::WebLayer* innerViewportScrollLayer, | 154 const blink::WebLayer* innerViewportScrollLayer, |
163 const blink::WebLayer* outerViewportScrollLayer) { | 155 const blink::WebLayer* outerViewportScrollLayer) { |
164 layer_tree_host_->RegisterViewportLayers( | 156 layer_tree_host_->RegisterViewportLayers( |
165 static_cast<const WebLayerImpl*>(pageScaleLayer)->layer(), | 157 static_cast<const WebLayerImpl*>(pageScaleLayer)->layer(), |
166 static_cast<const WebLayerImpl*>(innerViewportScrollLayer)->layer(), | 158 static_cast<const WebLayerImpl*>(innerViewportScrollLayer)->layer(), |
167 // The outer viewport layer will only exist when using pinch virtual | 159 // The outer viewport layer will only exist when using pinch virtual |
168 // viewports. | 160 // viewports. |
169 outerViewportScrollLayer | 161 outerViewportScrollLayer |
170 ? static_cast<const WebLayerImpl*>(outerViewportScrollLayer)->layer() | 162 ? static_cast<const WebLayerImpl*>(outerViewportScrollLayer)->layer() |
171 : NULL); | 163 : NULL); |
172 } | 164 } |
173 | 165 |
174 void WebLayerTreeViewImplForTesting::clearViewportLayers() { | 166 void WebLayerTreeViewImplForTesting::clearViewportLayers() { |
175 layer_tree_host_->RegisterViewportLayers(scoped_refptr<cc::Layer>(), | 167 layer_tree_host_->RegisterViewportLayers(scoped_refptr<cc::Layer>(), |
176 scoped_refptr<cc::Layer>(), | 168 scoped_refptr<cc::Layer>(), |
177 scoped_refptr<cc::Layer>()); | 169 scoped_refptr<cc::Layer>()); |
178 } | 170 } |
179 | 171 |
180 } // namespace content | 172 } // namespace content |
OLD | NEW |