| 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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 using blink::WebRect; | 29 using blink::WebRect; |
| 30 using blink::WebRenderingStats; | 30 using blink::WebRenderingStats; |
| 31 using blink::WebSize; | 31 using blink::WebSize; |
| 32 | 32 |
| 33 namespace webkit { | 33 namespace webkit { |
| 34 | 34 |
| 35 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() {} | 35 WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting() {} |
| 36 | 36 |
| 37 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} | 37 WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} |
| 38 | 38 |
| 39 bool WebLayerTreeViewImplForTesting::Initialize() { | 39 void WebLayerTreeViewImplForTesting::Initialize() { |
| 40 cc::LayerTreeSettings settings; | 40 cc::LayerTreeSettings settings; |
| 41 | 41 |
| 42 // For web contents, layer transforms should scale up the contents of layers | 42 // For web contents, layer transforms should scale up the contents of layers |
| 43 // to keep content always crisp when possible. | 43 // to keep content always crisp when possible. |
| 44 settings.layer_transforms_should_scale_layer_contents = true; | 44 settings.layer_transforms_should_scale_layer_contents = true; |
| 45 | 45 |
| 46 // Accelerated animations are enabled for unit tests. | 46 // Accelerated animations are enabled for unit tests. |
| 47 settings.accelerated_animation_enabled = true; | 47 settings.accelerated_animation_enabled = true; |
| 48 layer_tree_host_ = | 48 layer_tree_host_ = |
| 49 cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings); | 49 cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings); |
| 50 if (!layer_tree_host_) | 50 DCHECK(layer_tree_host_); |
| 51 return false; | |
| 52 return true; | |
| 53 } | 51 } |
| 54 | 52 |
| 55 void WebLayerTreeViewImplForTesting::setSurfaceReady() { | 53 void WebLayerTreeViewImplForTesting::setSurfaceReady() { |
| 56 layer_tree_host_->SetLayerTreeHostClientReady(); | 54 layer_tree_host_->SetLayerTreeHostClientReady(CreateOutputSurface(false)); |
| 57 } | 55 } |
| 58 | 56 |
| 59 void WebLayerTreeViewImplForTesting::setRootLayer( | 57 void WebLayerTreeViewImplForTesting::setRootLayer( |
| 60 const blink::WebLayer& root) { | 58 const blink::WebLayer& root) { |
| 61 layer_tree_host_->SetRootLayer( | 59 layer_tree_host_->SetRootLayer( |
| 62 static_cast<const WebLayerImpl*>(&root)->layer()); | 60 static_cast<const WebLayerImpl*>(&root)->layer()); |
| 63 } | 61 } |
| 64 | 62 |
| 65 void WebLayerTreeViewImplForTesting::clearRootLayer() { | 63 void WebLayerTreeViewImplForTesting::clearRootLayer() { |
| 66 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); | 64 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 161 } |
| 164 | 162 |
| 165 scoped_refptr<cc::ContextProvider> | 163 scoped_refptr<cc::ContextProvider> |
| 166 WebLayerTreeViewImplForTesting::OffscreenContextProvider() { | 164 WebLayerTreeViewImplForTesting::OffscreenContextProvider() { |
| 167 // Unit tests only run in single threaded mode. | 165 // Unit tests only run in single threaded mode. |
| 168 return webkit::gpu::TestContextProviderFactory::GetInstance()-> | 166 return webkit::gpu::TestContextProviderFactory::GetInstance()-> |
| 169 OffscreenContextProviderForMainThread(); | 167 OffscreenContextProviderForMainThread(); |
| 170 } | 168 } |
| 171 | 169 |
| 172 } // namespace webkit | 170 } // namespace webkit |
| OLD | NEW |