| 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/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "cc/resources/bitmap_content_layer_updater.h" | 11 #include "cc/resources/bitmap_content_layer_updater.h" |
| 12 #include "cc/resources/layer_painter.h" | 12 #include "cc/resources/layer_painter.h" |
| 13 #include "cc/resources/prioritized_resource_manager.h" | 13 #include "cc/resources/prioritized_resource_manager.h" |
| 14 #include "cc/resources/resource_update_controller.h" | 14 #include "cc/resources/resource_update_controller.h" |
| 15 #include "cc/test/animation_test_common.h" | 15 #include "cc/test/animation_test_common.h" |
| 16 #include "cc/test/fake_layer_tree_host_client.h" | 16 #include "cc/test/fake_layer_tree_host_client.h" |
| 17 #include "cc/test/fake_layer_tree_host_impl.h" | 17 #include "cc/test/fake_layer_tree_host_impl.h" |
| 18 #include "cc/test/fake_output_surface.h" | 18 #include "cc/test/fake_output_surface.h" |
| 19 #include "cc/test/fake_output_surface_client.h" | 19 #include "cc/test/fake_output_surface_client.h" |
| 20 #include "cc/test/fake_proxy.h" | 20 #include "cc/test/fake_proxy.h" |
| 21 #include "cc/test/fake_rendering_stats_instrumentation.h" | 21 #include "cc/test/fake_rendering_stats_instrumentation.h" |
| 22 #include "cc/test/geometry_test_utils.h" | 22 #include "cc/test/geometry_test_utils.h" |
| 23 #include "cc/test/test_shared_bitmap_manager.h" |
| 23 #include "cc/test/tiled_layer_test_common.h" | 24 #include "cc/test/tiled_layer_test_common.h" |
| 24 #include "cc/trees/occlusion_tracker.h" | 25 #include "cc/trees/occlusion_tracker.h" |
| 25 #include "cc/trees/single_thread_proxy.h" | 26 #include "cc/trees/single_thread_proxy.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 27 #include "ui/gfx/rect_conversions.h" | 28 #include "ui/gfx/rect_conversions.h" |
| 28 #include "ui/gfx/transform.h" | 29 #include "ui/gfx/transform.h" |
| 29 | 30 |
| 30 namespace cc { | 31 namespace cc { |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 queue_(make_scoped_ptr(new ResourceUpdateQueue)), | 100 queue_(make_scoped_ptr(new ResourceUpdateQueue)), |
| 100 impl_thread_("ImplThread"), | 101 impl_thread_("ImplThread"), |
| 101 fake_layer_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D), | 102 fake_layer_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D), |
| 102 occlusion_(NULL) { | 103 occlusion_(NULL) { |
| 103 settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); | 104 settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); |
| 104 settings_.layer_transforms_should_scale_layer_contents = true; | 105 settings_.layer_transforms_should_scale_layer_contents = true; |
| 105 } | 106 } |
| 106 | 107 |
| 107 virtual void SetUp() { | 108 virtual void SetUp() { |
| 108 impl_thread_.Start(); | 109 impl_thread_.Start(); |
| 110 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
| 109 layer_tree_host_ = SynchronousOutputSurfaceLayerTreeHost::Create( | 111 layer_tree_host_ = SynchronousOutputSurfaceLayerTreeHost::Create( |
| 110 &fake_layer_tree_host_client_, | 112 &fake_layer_tree_host_client_, |
| 111 NULL, | 113 shared_bitmap_manager_.get(), |
| 112 settings_, | 114 settings_, |
| 113 impl_thread_.message_loop_proxy()); | 115 impl_thread_.message_loop_proxy()); |
| 114 proxy_ = layer_tree_host_->proxy(); | 116 proxy_ = layer_tree_host_->proxy(); |
| 115 resource_manager_ = PrioritizedResourceManager::Create(proxy_); | 117 resource_manager_ = PrioritizedResourceManager::Create(proxy_); |
| 116 layer_tree_host_->SetLayerTreeHostClientReady(); | 118 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 117 CHECK(layer_tree_host_->EnsureOutputSurfaceCreated()); | 119 CHECK(layer_tree_host_->EnsureOutputSurfaceCreated()); |
| 118 layer_tree_host_->SetRootLayer(Layer::Create()); | 120 layer_tree_host_->SetRootLayer(Layer::Create()); |
| 119 | 121 |
| 120 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 122 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 121 | 123 |
| 122 DebugScopedSetImplThreadAndMainThreadBlocked | 124 DebugScopedSetImplThreadAndMainThreadBlocked |
| 123 impl_thread_and_main_thread_blocked(proxy_); | 125 impl_thread_and_main_thread_blocked(proxy_); |
| 124 resource_provider_ = | 126 resource_provider_ = ResourceProvider::Create( |
| 125 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); | 127 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1); |
| 126 host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(proxy_)); | 128 host_impl_ = make_scoped_ptr( |
| 129 new FakeLayerTreeHostImpl(proxy_, shared_bitmap_manager_.get())); |
| 127 } | 130 } |
| 128 | 131 |
| 129 virtual ~TiledLayerTest() { | 132 virtual ~TiledLayerTest() { |
| 130 ResourceManagerClearAllMemory(resource_manager_.get(), | 133 ResourceManagerClearAllMemory(resource_manager_.get(), |
| 131 resource_provider_.get()); | 134 resource_provider_.get()); |
| 132 | 135 |
| 133 DebugScopedSetImplThreadAndMainThreadBlocked | 136 DebugScopedSetImplThreadAndMainThreadBlocked |
| 134 impl_thread_and_main_thread_blocked(proxy_); | 137 impl_thread_and_main_thread_blocked(proxy_); |
| 135 resource_provider_.reset(); | 138 resource_provider_.reset(); |
| 136 host_impl_.reset(); | 139 host_impl_.reset(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 LayerPushPropertiesTo(layer2.get(), layer_impl2.get()); | 237 LayerPushPropertiesTo(layer2.get(), layer_impl2.get()); |
| 235 | 238 |
| 236 return needs_update; | 239 return needs_update; |
| 237 } | 240 } |
| 238 | 241 |
| 239 public: | 242 public: |
| 240 Proxy* proxy_; | 243 Proxy* proxy_; |
| 241 LayerTreeSettings settings_; | 244 LayerTreeSettings settings_; |
| 242 FakeOutputSurfaceClient output_surface_client_; | 245 FakeOutputSurfaceClient output_surface_client_; |
| 243 scoped_ptr<OutputSurface> output_surface_; | 246 scoped_ptr<OutputSurface> output_surface_; |
| 247 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
| 244 scoped_ptr<ResourceProvider> resource_provider_; | 248 scoped_ptr<ResourceProvider> resource_provider_; |
| 245 scoped_ptr<ResourceUpdateQueue> queue_; | 249 scoped_ptr<ResourceUpdateQueue> queue_; |
| 246 PriorityCalculator priority_calculator_; | 250 PriorityCalculator priority_calculator_; |
| 247 base::Thread impl_thread_; | 251 base::Thread impl_thread_; |
| 248 FakeLayerTreeHostClient fake_layer_tree_host_client_; | 252 FakeLayerTreeHostClient fake_layer_tree_host_client_; |
| 249 scoped_ptr<SynchronousOutputSurfaceLayerTreeHost> layer_tree_host_; | 253 scoped_ptr<SynchronousOutputSurfaceLayerTreeHost> layer_tree_host_; |
| 250 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; | 254 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; |
| 251 scoped_ptr<PrioritizedResourceManager> resource_manager_; | 255 scoped_ptr<PrioritizedResourceManager> resource_manager_; |
| 252 TestOcclusionTracker* occlusion_; | 256 TestOcclusionTracker* occlusion_; |
| 253 }; | 257 }; |
| (...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 // Invalidate the entire layer in layer space. When painting, the rect given | 1816 // Invalidate the entire layer in layer space. When painting, the rect given |
| 1813 // to webkit should match the layer's bounds. | 1817 // to webkit should match the layer's bounds. |
| 1814 layer->SetNeedsDisplayRect(layer_rect); | 1818 layer->SetNeedsDisplayRect(layer_rect); |
| 1815 layer->Update(queue_.get(), NULL); | 1819 layer->Update(queue_.get(), NULL); |
| 1816 | 1820 |
| 1817 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); | 1821 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); |
| 1818 } | 1822 } |
| 1819 | 1823 |
| 1820 } // namespace | 1824 } // namespace |
| 1821 } // namespace cc | 1825 } // namespace cc |
| OLD | NEW |