OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/layers/tiled_layer.h" | 5 #include "cc/layers/tiled_layer.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 occlusion_(nullptr) { | 87 occlusion_(nullptr) { |
88 settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); | 88 settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); |
89 settings_.layer_transforms_should_scale_layer_contents = true; | 89 settings_.layer_transforms_should_scale_layer_contents = true; |
90 settings_.verify_property_trees = true; | 90 settings_.verify_property_trees = true; |
91 settings_.impl_side_painting = false; | 91 settings_.impl_side_painting = false; |
92 } | 92 } |
93 | 93 |
94 void SetUp() override { | 94 void SetUp() override { |
95 impl_thread_.Start(); | 95 impl_thread_.Start(); |
96 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 96 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
97 layer_tree_host_ = LayerTreeHost::CreateThreaded( | 97 LayerTreeHost::InitParams params; |
98 &synchonous_output_surface_client_, shared_bitmap_manager_.get(), | 98 params.client = &synchronous_output_surface_client_; |
99 nullptr, nullptr, settings_, base::ThreadTaskRunnerHandle::Get(), | 99 params.shared_bitmap_manager = shared_bitmap_manager_.get(); |
100 impl_thread_.task_runner(), nullptr); | 100 params.settings = &settings_; |
101 synchonous_output_surface_client_.SetLayerTreeHost(layer_tree_host_.get()); | 101 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 102 |
| 103 layer_tree_host_ = |
| 104 LayerTreeHost::CreateThreaded(impl_thread_.task_runner(), ¶ms); |
| 105 synchronous_output_surface_client_.SetLayerTreeHost(layer_tree_host_.get()); |
102 proxy_ = layer_tree_host_->proxy(); | 106 proxy_ = layer_tree_host_->proxy(); |
103 resource_manager_ = PrioritizedResourceManager::Create(proxy_); | 107 resource_manager_ = PrioritizedResourceManager::Create(proxy_); |
104 layer_tree_host_->SetLayerTreeHostClientReady(); | 108 layer_tree_host_->SetLayerTreeHostClientReady(); |
105 CHECK(synchonous_output_surface_client_.EnsureOutputSurfaceCreated()); | 109 CHECK(synchronous_output_surface_client_.EnsureOutputSurfaceCreated()); |
106 | 110 |
107 layer_tree_host_->SetRootLayer(Layer::Create()); | 111 layer_tree_host_->SetRootLayer(Layer::Create()); |
108 | 112 |
109 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 113 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
110 | 114 |
111 DebugScopedSetImplThreadAndMainThreadBlocked | 115 DebugScopedSetImplThreadAndMainThreadBlocked |
112 impl_thread_and_main_thread_blocked(proxy_); | 116 impl_thread_and_main_thread_blocked(proxy_); |
113 resource_provider_ = ResourceProvider::Create(output_surface_.get(), | 117 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
114 shared_bitmap_manager_.get(), | 118 shared_bitmap_manager_.get(), |
115 nullptr, | 119 nullptr, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 public: | 238 public: |
235 Proxy* proxy_; | 239 Proxy* proxy_; |
236 LayerTreeSettings settings_; | 240 LayerTreeSettings settings_; |
237 FakeOutputSurfaceClient output_surface_client_; | 241 FakeOutputSurfaceClient output_surface_client_; |
238 scoped_ptr<OutputSurface> output_surface_; | 242 scoped_ptr<OutputSurface> output_surface_; |
239 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | 243 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
240 scoped_ptr<ResourceProvider> resource_provider_; | 244 scoped_ptr<ResourceProvider> resource_provider_; |
241 scoped_ptr<ResourceUpdateQueue> queue_; | 245 scoped_ptr<ResourceUpdateQueue> queue_; |
242 PriorityCalculator priority_calculator_; | 246 PriorityCalculator priority_calculator_; |
243 base::Thread impl_thread_; | 247 base::Thread impl_thread_; |
244 SynchronousOutputSurfaceClient synchonous_output_surface_client_; | 248 SynchronousOutputSurfaceClient synchronous_output_surface_client_; |
245 scoped_ptr<LayerTreeHost> layer_tree_host_; | 249 scoped_ptr<LayerTreeHost> layer_tree_host_; |
246 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; | 250 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; |
247 scoped_ptr<PrioritizedResourceManager> resource_manager_; | 251 scoped_ptr<PrioritizedResourceManager> resource_manager_; |
248 TestOcclusionTracker* occlusion_; | 252 TestOcclusionTracker* occlusion_; |
249 }; | 253 }; |
250 | 254 |
251 TEST_F(TiledLayerTest, PushDirtyTiles) { | 255 TEST_F(TiledLayerTest, PushDirtyTiles) { |
252 layer_tree_host_->SetViewportSize(gfx::Size(1000, 1000)); | 256 layer_tree_host_->SetViewportSize(gfx::Size(1000, 1000)); |
253 | 257 |
254 scoped_refptr<FakeTiledLayer> layer = | 258 scoped_refptr<FakeTiledLayer> layer = |
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 | 1752 |
1749 // Rounding leads to an extra pixel. | 1753 // Rounding leads to an extra pixel. |
1750 gfx::Rect expanded_layer_rect(layer_rect); | 1754 gfx::Rect expanded_layer_rect(layer_rect); |
1751 expanded_layer_rect.set_height(32); | 1755 expanded_layer_rect.set_height(32); |
1752 EXPECT_EQ(expanded_layer_rect, | 1756 EXPECT_EQ(expanded_layer_rect, |
1753 layer->tracking_layer_painter()->PaintedRect()); | 1757 layer->tracking_layer_painter()->PaintedRect()); |
1754 } | 1758 } |
1755 | 1759 |
1756 } // namespace | 1760 } // namespace |
1757 } // namespace cc | 1761 } // namespace cc |
OLD | NEW |