| 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/blink/web_layer_impl.h" |
| 11 #include "cc/input/input_handler.h" | 12 #include "cc/input/input_handler.h" |
| 12 #include "cc/layers/layer.h" | 13 #include "cc/layers/layer.h" |
| 13 #include "cc/output/output_surface.h" | 14 #include "cc/output/output_surface.h" |
| 14 #include "cc/test/test_context_provider.h" | 15 #include "cc/test/test_context_provider.h" |
| 15 #include "cc/trees/layer_tree_host.h" | 16 #include "cc/trees/layer_tree_host.h" |
| 16 #include "content/renderer/compositor_bindings/web_layer_impl.h" | |
| 17 #include "content/test/test_webkit_platform_support.h" | 17 #include "content/test/test_webkit_platform_support.h" |
| 18 #include "third_party/WebKit/public/platform/Platform.h" | 18 #include "third_party/WebKit/public/platform/Platform.h" |
| 19 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 19 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 20 #include "third_party/WebKit/public/platform/WebLayer.h" | 20 #include "third_party/WebKit/public/platform/WebLayer.h" |
| 21 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" | 21 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" |
| 22 #include "third_party/WebKit/public/platform/WebSize.h" | 22 #include "third_party/WebKit/public/platform/WebSize.h" |
| 23 #include "ui/gfx/frame_time.h" | 23 #include "ui/gfx/frame_time.h" |
| 24 | 24 |
| 25 using blink::WebColor; | 25 using blink::WebColor; |
| 26 using blink::WebGraphicsContext3D; | 26 using blink::WebGraphicsContext3D; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 47 DCHECK(layer_tree_host_); | 47 DCHECK(layer_tree_host_); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void WebLayerTreeViewImplForTesting::setSurfaceReady() { | 50 void WebLayerTreeViewImplForTesting::setSurfaceReady() { |
| 51 layer_tree_host_->SetLayerTreeHostClientReady(); | 51 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void WebLayerTreeViewImplForTesting::setRootLayer( | 54 void WebLayerTreeViewImplForTesting::setRootLayer( |
| 55 const blink::WebLayer& root) { | 55 const blink::WebLayer& root) { |
| 56 layer_tree_host_->SetRootLayer( | 56 layer_tree_host_->SetRootLayer( |
| 57 static_cast<const WebLayerImpl*>(&root)->layer()); | 57 static_cast<const cc_blink::WebLayerImpl*>(&root)->layer()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void WebLayerTreeViewImplForTesting::clearRootLayer() { | 60 void WebLayerTreeViewImplForTesting::clearRootLayer() { |
| 61 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); | 61 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void WebLayerTreeViewImplForTesting::setViewportSize( | 64 void WebLayerTreeViewImplForTesting::setViewportSize( |
| 65 const WebSize& unused_deprecated, | 65 const WebSize& unused_deprecated, |
| 66 const WebSize& device_viewport_size) { | 66 const WebSize& device_viewport_size) { |
| 67 layer_tree_host_->SetViewportSize(device_viewport_size); | 67 layer_tree_host_->SetViewportSize(device_viewport_size); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 WebLayerTreeViewImplForTesting::CreateOutputSurface(bool fallback) { | 145 WebLayerTreeViewImplForTesting::CreateOutputSurface(bool fallback) { |
| 146 return make_scoped_ptr( | 146 return make_scoped_ptr( |
| 147 new cc::OutputSurface(cc::TestContextProvider::Create())); | 147 new cc::OutputSurface(cc::TestContextProvider::Create())); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void WebLayerTreeViewImplForTesting::registerViewportLayers( | 150 void WebLayerTreeViewImplForTesting::registerViewportLayers( |
| 151 const blink::WebLayer* pageScaleLayer, | 151 const blink::WebLayer* pageScaleLayer, |
| 152 const blink::WebLayer* innerViewportScrollLayer, | 152 const blink::WebLayer* innerViewportScrollLayer, |
| 153 const blink::WebLayer* outerViewportScrollLayer) { | 153 const blink::WebLayer* outerViewportScrollLayer) { |
| 154 layer_tree_host_->RegisterViewportLayers( | 154 layer_tree_host_->RegisterViewportLayers( |
| 155 static_cast<const WebLayerImpl*>(pageScaleLayer)->layer(), | 155 static_cast<const cc_blink::WebLayerImpl*>(pageScaleLayer)->layer(), |
| 156 static_cast<const WebLayerImpl*>(innerViewportScrollLayer)->layer(), | 156 static_cast<const cc_blink::WebLayerImpl*>(innerViewportScrollLayer) |
| 157 ->layer(), |
| 157 // The outer viewport layer will only exist when using pinch virtual | 158 // The outer viewport layer will only exist when using pinch virtual |
| 158 // viewports. | 159 // viewports. |
| 159 outerViewportScrollLayer | 160 outerViewportScrollLayer ? static_cast<const cc_blink::WebLayerImpl*>( |
| 160 ? static_cast<const WebLayerImpl*>(outerViewportScrollLayer)->layer() | 161 outerViewportScrollLayer)->layer() |
| 161 : NULL); | 162 : NULL); |
| 162 } | 163 } |
| 163 | 164 |
| 164 void WebLayerTreeViewImplForTesting::clearViewportLayers() { | 165 void WebLayerTreeViewImplForTesting::clearViewportLayers() { |
| 165 layer_tree_host_->RegisterViewportLayers(scoped_refptr<cc::Layer>(), | 166 layer_tree_host_->RegisterViewportLayers(scoped_refptr<cc::Layer>(), |
| 166 scoped_refptr<cc::Layer>(), | 167 scoped_refptr<cc::Layer>(), |
| 167 scoped_refptr<cc::Layer>()); | 168 scoped_refptr<cc::Layer>()); |
| 168 } | 169 } |
| 169 | 170 |
| 170 void WebLayerTreeViewImplForTesting::registerSelection( | 171 void WebLayerTreeViewImplForTesting::registerSelection( |
| 171 const blink::WebSelectionBound& start, | 172 const blink::WebSelectionBound& start, |
| 172 const blink::WebSelectionBound& end) { | 173 const blink::WebSelectionBound& end) { |
| 173 } | 174 } |
| 174 | 175 |
| 175 void WebLayerTreeViewImplForTesting::clearSelection() { | 176 void WebLayerTreeViewImplForTesting::clearSelection() { |
| 176 } | 177 } |
| 177 | 178 |
| 178 } // namespace content | 179 } // namespace content |
| OLD | NEW |