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 void 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_ = | 48 layer_tree_host_ = |
49 cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings); | 49 cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings); |
50 DCHECK(layer_tree_host_); | 50 if (!layer_tree_host_) |
| 51 return false; |
| 52 return true; |
51 } | 53 } |
52 | 54 |
53 void WebLayerTreeViewImplForTesting::setSurfaceReady() { | 55 void WebLayerTreeViewImplForTesting::setSurfaceReady() { |
54 layer_tree_host_->SetLayerTreeHostClientReady(); | 56 layer_tree_host_->SetLayerTreeHostClientReady(); |
55 } | 57 } |
56 | 58 |
57 void WebLayerTreeViewImplForTesting::setRootLayer( | 59 void WebLayerTreeViewImplForTesting::setRootLayer( |
58 const blink::WebLayer& root) { | 60 const blink::WebLayer& root) { |
59 layer_tree_host_->SetRootLayer( | 61 layer_tree_host_->SetRootLayer( |
60 static_cast<const WebLayerImpl*>(&root)->layer()); | 62 static_cast<const WebLayerImpl*>(&root)->layer()); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 160 } |
159 | 161 |
160 scoped_refptr<cc::ContextProvider> | 162 scoped_refptr<cc::ContextProvider> |
161 WebLayerTreeViewImplForTesting::OffscreenContextProvider() { | 163 WebLayerTreeViewImplForTesting::OffscreenContextProvider() { |
162 // Unit tests only run in single threaded mode. | 164 // Unit tests only run in single threaded mode. |
163 return webkit::gpu::TestContextProviderFactory::GetInstance()-> | 165 return webkit::gpu::TestContextProviderFactory::GetInstance()-> |
164 OffscreenContextProviderForMainThread(); | 166 OffscreenContextProviderForMainThread(); |
165 } | 167 } |
166 | 168 |
167 } // namespace webkit | 169 } // namespace webkit |
OLD | NEW |