| 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 "base/thread_task_runner_handle.h" |
| 10 #include "cc/base/switches.h" | 11 #include "cc/base/switches.h" |
| 11 #include "cc/blink/web_layer_impl.h" | 12 #include "cc/blink/web_layer_impl.h" |
| 12 #include "cc/input/input_handler.h" | 13 #include "cc/input/input_handler.h" |
| 13 #include "cc/layers/layer.h" | 14 #include "cc/layers/layer.h" |
| 14 #include "cc/scheduler/begin_frame_source.h" | 15 #include "cc/scheduler/begin_frame_source.h" |
| 15 #include "cc/test/pixel_test_output_surface.h" | 16 #include "cc/test/pixel_test_output_surface.h" |
| 16 #include "cc/test/test_context_provider.h" | 17 #include "cc/test/test_context_provider.h" |
| 17 #include "cc/trees/layer_tree_host.h" | 18 #include "cc/trees/layer_tree_host.h" |
| 18 #include "content/test/test_blink_web_unit_test_support.h" | 19 #include "content/test/test_blink_web_unit_test_support.h" |
| 19 #include "third_party/WebKit/public/platform/Platform.h" | 20 #include "third_party/WebKit/public/platform/Platform.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 36 | 37 |
| 37 void WebLayerTreeViewImplForTesting::Initialize() { | 38 void WebLayerTreeViewImplForTesting::Initialize() { |
| 38 cc::LayerTreeSettings settings; | 39 cc::LayerTreeSettings settings; |
| 39 | 40 |
| 40 // For web contents, layer transforms should scale up the contents of layers | 41 // For web contents, layer transforms should scale up the contents of layers |
| 41 // to keep content always crisp when possible. | 42 // to keep content always crisp when possible. |
| 42 settings.layer_transforms_should_scale_layer_contents = true; | 43 settings.layer_transforms_should_scale_layer_contents = true; |
| 43 | 44 |
| 44 // Accelerated animations are enabled for unit tests. | 45 // Accelerated animations are enabled for unit tests. |
| 45 settings.accelerated_animation_enabled = true; | 46 settings.accelerated_animation_enabled = true; |
| 46 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( | 47 cc::LayerTreeHost::InitParams params; |
| 47 this, this, nullptr, nullptr, nullptr, settings, | 48 params.client = this; |
| 48 base::MessageLoopProxy::current(), nullptr); | 49 params.settings = &settings; |
| 50 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 51 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); |
| 49 DCHECK(layer_tree_host_); | 52 DCHECK(layer_tree_host_); |
| 50 } | 53 } |
| 51 | 54 |
| 52 void WebLayerTreeViewImplForTesting::setRootLayer( | 55 void WebLayerTreeViewImplForTesting::setRootLayer( |
| 53 const blink::WebLayer& root) { | 56 const blink::WebLayer& root) { |
| 54 layer_tree_host_->SetRootLayer( | 57 layer_tree_host_->SetRootLayer( |
| 55 static_cast<const cc_blink::WebLayerImpl*>(&root)->layer()); | 58 static_cast<const cc_blink::WebLayerImpl*>(&root)->layer()); |
| 56 } | 59 } |
| 57 | 60 |
| 58 void WebLayerTreeViewImplForTesting::clearRootLayer() { | 61 void WebLayerTreeViewImplForTesting::clearRootLayer() { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 193 } |
| 191 | 194 |
| 192 void WebLayerTreeViewImplForTesting::registerSelection( | 195 void WebLayerTreeViewImplForTesting::registerSelection( |
| 193 const blink::WebSelection& selection) { | 196 const blink::WebSelection& selection) { |
| 194 } | 197 } |
| 195 | 198 |
| 196 void WebLayerTreeViewImplForTesting::clearSelection() { | 199 void WebLayerTreeViewImplForTesting::clearSelection() { |
| 197 } | 200 } |
| 198 | 201 |
| 199 } // namespace content | 202 } // namespace content |
| OLD | NEW |