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 "cc/debug/overdraw_metrics.h" | 10 #include "cc/debug/overdraw_metrics.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 : proxy_(NULL), | 49 : proxy_(NULL), |
50 output_surface_(CreateFakeOutputSurface()), | 50 output_surface_(CreateFakeOutputSurface()), |
51 queue_(make_scoped_ptr(new ResourceUpdateQueue)), | 51 queue_(make_scoped_ptr(new ResourceUpdateQueue)), |
52 fake_layer_impl_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D), | 52 fake_layer_impl_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D), |
53 occlusion_(NULL) { | 53 occlusion_(NULL) { |
54 settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); | 54 settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); |
55 settings_.layer_transforms_should_scale_layer_contents = true; | 55 settings_.layer_transforms_should_scale_layer_contents = true; |
56 } | 56 } |
57 | 57 |
58 virtual void SetUp() { | 58 virtual void SetUp() { |
59 layer_tree_host_ = LayerTreeHost::Create( | 59 layer_tree_host_ = LayerTreeHost::Create(&fake_layer_impl_tree_host_client_, |
60 &fake_layer_impl_tree_host_client_, settings_, scoped_ptr<Thread>()); | 60 settings_, |
| 61 NULL); |
61 proxy_ = layer_tree_host_->proxy(); | 62 proxy_ = layer_tree_host_->proxy(); |
62 resource_manager_ = PrioritizedResourceManager::Create(proxy_); | 63 resource_manager_ = PrioritizedResourceManager::Create(proxy_); |
63 layer_tree_host_->InitializeOutputSurfaceIfNeeded(); | 64 layer_tree_host_->InitializeOutputSurfaceIfNeeded(); |
64 layer_tree_host_->SetRootLayer(Layer::Create()); | 65 layer_tree_host_->SetRootLayer(Layer::Create()); |
65 | 66 |
66 DebugScopedSetImplThreadAndMainThreadBlocked | 67 DebugScopedSetImplThreadAndMainThreadBlocked |
67 impl_thread_and_main_thread_blocked(proxy_); | 68 impl_thread_and_main_thread_blocked(proxy_); |
68 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); | 69 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); |
69 host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(proxy_)); | 70 host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(proxy_)); |
70 } | 71 } |
(...skipping 19 matching lines...) Expand all Loading... |
90 } | 91 } |
91 resource_manager->UnlinkAndClearEvictedBackings(); | 92 resource_manager->UnlinkAndClearEvictedBackings(); |
92 } | 93 } |
93 | 94 |
94 void UpdateTextures() { | 95 void UpdateTextures() { |
95 DebugScopedSetImplThreadAndMainThreadBlocked | 96 DebugScopedSetImplThreadAndMainThreadBlocked |
96 impl_thread_and_main_thread_blocked(proxy_); | 97 impl_thread_and_main_thread_blocked(proxy_); |
97 DCHECK(queue_); | 98 DCHECK(queue_); |
98 scoped_ptr<ResourceUpdateController> update_controller = | 99 scoped_ptr<ResourceUpdateController> update_controller = |
99 ResourceUpdateController::Create(NULL, | 100 ResourceUpdateController::Create(NULL, |
100 NULL, | 101 proxy_->ImplThreadTaskRunner(), |
101 queue_.Pass(), | 102 queue_.Pass(), |
102 resource_provider_.get()); | 103 resource_provider_.get()); |
103 update_controller->Finalize(); | 104 update_controller->Finalize(); |
104 queue_ = make_scoped_ptr(new ResourceUpdateQueue); | 105 queue_ = make_scoped_ptr(new ResourceUpdateQueue); |
105 } | 106 } |
106 | 107 |
107 void LayerPushPropertiesTo(FakeTiledLayer* layer, | 108 void LayerPushPropertiesTo(FakeTiledLayer* layer, |
108 FakeTiledLayerImpl* layer_impl) { | 109 FakeTiledLayerImpl* layer_impl) { |
109 DebugScopedSetImplThreadAndMainThreadBlocked | 110 DebugScopedSetImplThreadAndMainThreadBlocked |
110 impl_thread_and_main_thread_blocked(proxy_); | 111 impl_thread_and_main_thread_blocked(proxy_); |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 // Invalidate the entire layer in layer space. When painting, the rect given | 1846 // Invalidate the entire layer in layer space. When painting, the rect given |
1846 // to webkit should match the layer's bounds. | 1847 // to webkit should match the layer's bounds. |
1847 layer->SetNeedsDisplayRect(layer_rect); | 1848 layer->SetNeedsDisplayRect(layer_rect); |
1848 layer->Update(queue_.get(), 0, NULL); | 1849 layer->Update(queue_.get(), 0, NULL); |
1849 | 1850 |
1850 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); | 1851 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); |
1851 } | 1852 } |
1852 | 1853 |
1853 } // namespace | 1854 } // namespace |
1854 } // namespace cc | 1855 } // namespace cc |
OLD | NEW |