| 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 bool WebLayerTreeViewImplForTesting::Initialize() { | 39 bool 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_ = cc::LayerTreeHost::Create(this, NULL, settings, NULL); | 48 layer_tree_host_ = |
| 49 cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings); |
| 49 if (!layer_tree_host_) | 50 if (!layer_tree_host_) |
| 50 return false; | 51 return false; |
| 51 return true; | 52 return true; |
| 52 } | 53 } |
| 53 | 54 |
| 54 void WebLayerTreeViewImplForTesting::setSurfaceReady() { | 55 void WebLayerTreeViewImplForTesting::setSurfaceReady() { |
| 55 layer_tree_host_->SetLayerTreeHostClientReady(); | 56 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void WebLayerTreeViewImplForTesting::setRootLayer( | 59 void WebLayerTreeViewImplForTesting::setRootLayer( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 void WebLayerTreeViewImplForTesting::ApplyScrollAndScale( | 156 void WebLayerTreeViewImplForTesting::ApplyScrollAndScale( |
| 156 gfx::Vector2d scroll_delta, | 157 gfx::Vector2d scroll_delta, |
| 157 float page_scale) {} | 158 float page_scale) {} |
| 158 | 159 |
| 159 scoped_ptr<cc::OutputSurface> | 160 scoped_ptr<cc::OutputSurface> |
| 160 WebLayerTreeViewImplForTesting::CreateOutputSurface(bool fallback) { | 161 WebLayerTreeViewImplForTesting::CreateOutputSurface(bool fallback) { |
| 161 return make_scoped_ptr( | 162 return make_scoped_ptr( |
| 162 new cc::OutputSurface(cc::TestContextProvider::Create())); | 163 new cc::OutputSurface(cc::TestContextProvider::Create())); |
| 163 } | 164 } |
| 164 | 165 |
| 165 void WebLayerTreeViewImplForTesting::ScheduleComposite() { | |
| 166 } | |
| 167 | |
| 168 scoped_refptr<cc::ContextProvider> | 166 scoped_refptr<cc::ContextProvider> |
| 169 WebLayerTreeViewImplForTesting::OffscreenContextProvider() { | 167 WebLayerTreeViewImplForTesting::OffscreenContextProvider() { |
| 170 // Unit tests only run in single threaded mode. | 168 // Unit tests only run in single threaded mode. |
| 171 return webkit::gpu::TestContextProviderFactory::GetInstance()-> | 169 return webkit::gpu::TestContextProviderFactory::GetInstance()-> |
| 172 OffscreenContextProviderForMainThread(); | 170 OffscreenContextProviderForMainThread(); |
| 173 } | 171 } |
| 174 | 172 |
| 175 } // namespace webkit | 173 } // namespace webkit |
| OLD | NEW |