| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( |
| 60 &fake_layer_impl_tree_host_client_, settings_, scoped_ptr<Thread>()); | 60 &fake_layer_impl_tree_host_client_, |
| 61 settings_, |
| 62 scoped_refptr<base::SingleThreadTaskRunner>()); |
| 61 proxy_ = layer_tree_host_->proxy(); | 63 proxy_ = layer_tree_host_->proxy(); |
| 62 resource_manager_ = PrioritizedResourceManager::Create(proxy_); | 64 resource_manager_ = PrioritizedResourceManager::Create(proxy_); |
| 63 layer_tree_host_->InitializeOutputSurfaceIfNeeded(); | 65 layer_tree_host_->InitializeOutputSurfaceIfNeeded(); |
| 64 layer_tree_host_->SetRootLayer(Layer::Create()); | 66 layer_tree_host_->SetRootLayer(Layer::Create()); |
| 65 | 67 |
| 66 DebugScopedSetImplThreadAndMainThreadBlocked | 68 DebugScopedSetImplThreadAndMainThreadBlocked |
| 67 impl_thread_and_main_thread_blocked(proxy_); | 69 impl_thread_and_main_thread_blocked(proxy_); |
| 68 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); | 70 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); |
| 69 host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(proxy_)); | 71 host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(proxy_)); |
| 70 } | 72 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 90 } | 92 } |
| 91 resource_manager->UnlinkAndClearEvictedBackings(); | 93 resource_manager->UnlinkAndClearEvictedBackings(); |
| 92 } | 94 } |
| 93 | 95 |
| 94 void UpdateTextures() { | 96 void UpdateTextures() { |
| 95 DebugScopedSetImplThreadAndMainThreadBlocked | 97 DebugScopedSetImplThreadAndMainThreadBlocked |
| 96 impl_thread_and_main_thread_blocked(proxy_); | 98 impl_thread_and_main_thread_blocked(proxy_); |
| 97 DCHECK(queue_); | 99 DCHECK(queue_); |
| 98 scoped_ptr<ResourceUpdateController> update_controller = | 100 scoped_ptr<ResourceUpdateController> update_controller = |
| 99 ResourceUpdateController::Create(NULL, | 101 ResourceUpdateController::Create(NULL, |
| 100 proxy_->ImplThread()->TaskRunner(), | 102 proxy_->ImplThreadTaskRunner(), |
| 101 queue_.Pass(), | 103 queue_.Pass(), |
| 102 resource_provider_.get()); | 104 resource_provider_.get()); |
| 103 update_controller->Finalize(); | 105 update_controller->Finalize(); |
| 104 queue_ = make_scoped_ptr(new ResourceUpdateQueue); | 106 queue_ = make_scoped_ptr(new ResourceUpdateQueue); |
| 105 } | 107 } |
| 106 | 108 |
| 107 void LayerPushPropertiesTo(FakeTiledLayer* layer, | 109 void LayerPushPropertiesTo(FakeTiledLayer* layer, |
| 108 FakeTiledLayerImpl* layer_impl) { | 110 FakeTiledLayerImpl* layer_impl) { |
| 109 DebugScopedSetImplThreadAndMainThreadBlocked | 111 DebugScopedSetImplThreadAndMainThreadBlocked |
| 110 impl_thread_and_main_thread_blocked(proxy_); | 112 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 | 1847 // Invalidate the entire layer in layer space. When painting, the rect given |
| 1846 // to webkit should match the layer's bounds. | 1848 // to webkit should match the layer's bounds. |
| 1847 layer->SetNeedsDisplayRect(layer_rect); | 1849 layer->SetNeedsDisplayRect(layer_rect); |
| 1848 layer->Update(queue_.get(), 0, NULL); | 1850 layer->Update(queue_.get(), 0, NULL); |
| 1849 | 1851 |
| 1850 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); | 1852 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); |
| 1851 } | 1853 } |
| 1852 | 1854 |
| 1853 } // namespace | 1855 } // namespace |
| 1854 } // namespace cc | 1856 } // namespace cc |
| OLD | NEW |