| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 stack_.back().occlusion_from_inside_target = occlusion; | 43 stack_.back().occlusion_from_inside_target = occlusion; |
| 44 } | 44 } |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class TiledLayerTest : public testing::Test { | 47 class TiledLayerTest : public testing::Test { |
| 48 public: | 48 public: |
| 49 TiledLayerTest() | 49 TiledLayerTest() |
| 50 : proxy_(NULL), | 50 : proxy_(NULL), |
| 51 output_surface_(FakeOutputSurface::Create3d()), | 51 output_surface_(FakeOutputSurface::Create3d()), |
| 52 queue_(make_scoped_ptr(new ResourceUpdateQueue)), | 52 queue_(make_scoped_ptr(new ResourceUpdateQueue)), |
| 53 fake_layer_impl_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D), | 53 impl_thread_("ImplThread"), |
| 54 fake_layer_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D), |
| 54 occlusion_(NULL) { | 55 occlusion_(NULL) { |
| 55 settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); | 56 settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); |
| 56 settings_.layer_transforms_should_scale_layer_contents = true; | 57 settings_.layer_transforms_should_scale_layer_contents = true; |
| 57 } | 58 } |
| 58 | 59 |
| 59 virtual void SetUp() { | 60 virtual void SetUp() { |
| 60 layer_tree_host_ = LayerTreeHost::Create(&fake_layer_impl_tree_host_client_, | 61 impl_thread_.Start(); |
| 62 layer_tree_host_ = LayerTreeHost::Create(&fake_layer_tree_host_client_, |
| 61 settings_, | 63 settings_, |
| 62 NULL); | 64 impl_thread_.message_loop_proxy()); |
| 63 proxy_ = layer_tree_host_->proxy(); | 65 proxy_ = layer_tree_host_->proxy(); |
| 64 resource_manager_ = PrioritizedResourceManager::Create(proxy_); | 66 resource_manager_ = PrioritizedResourceManager::Create(proxy_); |
| 67 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 65 layer_tree_host_->InitializeOutputSurfaceIfNeeded(); | 68 layer_tree_host_->InitializeOutputSurfaceIfNeeded(); |
| 66 layer_tree_host_->SetRootLayer(Layer::Create()); | 69 layer_tree_host_->SetRootLayer(Layer::Create()); |
| 67 | 70 |
| 68 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 71 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 69 | 72 |
| 70 DebugScopedSetImplThreadAndMainThreadBlocked | 73 DebugScopedSetImplThreadAndMainThreadBlocked |
| 71 impl_thread_and_main_thread_blocked(proxy_); | 74 impl_thread_and_main_thread_blocked(proxy_); |
| 72 resource_provider_ = | 75 resource_provider_ = |
| 73 ResourceProvider::Create(output_surface_.get(), 0, false); | 76 ResourceProvider::Create(output_surface_.get(), 0, false); |
| 74 host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(proxy_)); | 77 host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(proxy_)); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 188 } |
| 186 | 189 |
| 187 public: | 190 public: |
| 188 Proxy* proxy_; | 191 Proxy* proxy_; |
| 189 LayerTreeSettings settings_; | 192 LayerTreeSettings settings_; |
| 190 FakeOutputSurfaceClient output_surface_client_; | 193 FakeOutputSurfaceClient output_surface_client_; |
| 191 scoped_ptr<OutputSurface> output_surface_; | 194 scoped_ptr<OutputSurface> output_surface_; |
| 192 scoped_ptr<ResourceProvider> resource_provider_; | 195 scoped_ptr<ResourceProvider> resource_provider_; |
| 193 scoped_ptr<ResourceUpdateQueue> queue_; | 196 scoped_ptr<ResourceUpdateQueue> queue_; |
| 194 PriorityCalculator priority_calculator_; | 197 PriorityCalculator priority_calculator_; |
| 195 FakeLayerTreeHostClient fake_layer_impl_tree_host_client_; | 198 base::Thread impl_thread_; |
| 199 FakeLayerTreeHostClient fake_layer_tree_host_client_; |
| 196 scoped_ptr<LayerTreeHost> layer_tree_host_; | 200 scoped_ptr<LayerTreeHost> layer_tree_host_; |
| 197 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; | 201 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; |
| 198 scoped_ptr<PrioritizedResourceManager> resource_manager_; | 202 scoped_ptr<PrioritizedResourceManager> resource_manager_; |
| 199 TestOcclusionTracker* occlusion_; | 203 TestOcclusionTracker* occlusion_; |
| 200 }; | 204 }; |
| 201 | 205 |
| 202 TEST_F(TiledLayerTest, PushDirtyTiles) { | 206 TEST_F(TiledLayerTest, PushDirtyTiles) { |
| 203 scoped_refptr<FakeTiledLayer> layer = | 207 scoped_refptr<FakeTiledLayer> layer = |
| 204 make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); | 208 make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); |
| 205 scoped_ptr<FakeTiledLayerImpl> layer_impl = | 209 scoped_ptr<FakeTiledLayerImpl> layer_impl = |
| (...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 // Invalidate the entire layer in layer space. When painting, the rect given | 1945 // Invalidate the entire layer in layer space. When painting, the rect given |
| 1942 // to webkit should match the layer's bounds. | 1946 // to webkit should match the layer's bounds. |
| 1943 layer->SetNeedsDisplayRect(layer_rect); | 1947 layer->SetNeedsDisplayRect(layer_rect); |
| 1944 layer->Update(queue_.get(), NULL); | 1948 layer->Update(queue_.get(), NULL); |
| 1945 | 1949 |
| 1946 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); | 1950 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); |
| 1947 } | 1951 } |
| 1948 | 1952 |
| 1949 } // namespace | 1953 } // namespace |
| 1950 } // namespace cc | 1954 } // namespace cc |
| OLD | NEW |