| 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/test/layer_tree_test.h" | 5 #include "cc/test/layer_tree_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
| 9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
| 10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 TestHooks::~TestHooks() {} | 40 TestHooks::~TestHooks() {} |
| 41 | 41 |
| 42 DrawResult TestHooks::PrepareToDrawOnThread( | 42 DrawResult TestHooks::PrepareToDrawOnThread( |
| 43 LayerTreeHostImpl* host_impl, | 43 LayerTreeHostImpl* host_impl, |
| 44 LayerTreeHostImpl::FrameData* frame_data, | 44 LayerTreeHostImpl::FrameData* frame_data, |
| 45 DrawResult draw_result) { | 45 DrawResult draw_result) { |
| 46 return draw_result; | 46 return draw_result; |
| 47 } | 47 } |
| 48 | 48 |
| 49 scoped_ptr<Rasterizer> TestHooks::CreateRasterizer( |
| 50 LayerTreeHostImpl* host_impl) { |
| 51 return host_impl->LayerTreeHostImpl::CreateRasterizer(); |
| 52 } |
| 53 |
| 49 void TestHooks::CreateResourceAndTileTaskWorkerPool( | 54 void TestHooks::CreateResourceAndTileTaskWorkerPool( |
| 50 LayerTreeHostImpl* host_impl, | 55 LayerTreeHostImpl* host_impl, |
| 51 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 56 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 52 scoped_ptr<ResourcePool>* resource_pool, | 57 scoped_ptr<ResourcePool>* resource_pool, |
| 53 scoped_ptr<ResourcePool>* staging_resource_pool) { | 58 scoped_ptr<ResourcePool>* staging_resource_pool) { |
| 54 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( | 59 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( |
| 55 tile_task_worker_pool, resource_pool, staging_resource_pool); | 60 tile_task_worker_pool, resource_pool, staging_resource_pool); |
| 56 } | 61 } |
| 57 | 62 |
| 58 // Adapts ThreadProxy for test. Injects test hooks for testing. | 63 // Adapts ThreadProxy for test. Injects test hooks for testing. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 host_impl_client, | 164 host_impl_client, |
| 160 proxy, | 165 proxy, |
| 161 stats_instrumentation, | 166 stats_instrumentation, |
| 162 shared_bitmap_manager, | 167 shared_bitmap_manager, |
| 163 gpu_memory_buffer_manager, | 168 gpu_memory_buffer_manager, |
| 164 0), | 169 0), |
| 165 test_hooks_(test_hooks), | 170 test_hooks_(test_hooks), |
| 166 block_notify_ready_to_activate_for_testing_(false), | 171 block_notify_ready_to_activate_for_testing_(false), |
| 167 notify_ready_to_activate_was_blocked_(false) {} | 172 notify_ready_to_activate_was_blocked_(false) {} |
| 168 | 173 |
| 174 scoped_ptr<Rasterizer> CreateRasterizer() override { |
| 175 return test_hooks_->CreateRasterizer(this); |
| 176 } |
| 177 |
| 169 void CreateResourceAndTileTaskWorkerPool( | 178 void CreateResourceAndTileTaskWorkerPool( |
| 170 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 179 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 171 scoped_ptr<ResourcePool>* resource_pool, | 180 scoped_ptr<ResourcePool>* resource_pool, |
| 172 scoped_ptr<ResourcePool>* staging_resource_pool) override { | 181 scoped_ptr<ResourcePool>* staging_resource_pool) override { |
| 173 test_hooks_->CreateResourceAndTileTaskWorkerPool( | 182 test_hooks_->CreateResourceAndTileTaskWorkerPool( |
| 174 this, tile_task_worker_pool, resource_pool, staging_resource_pool); | 183 this, tile_task_worker_pool, resource_pool, staging_resource_pool); |
| 175 } | 184 } |
| 176 | 185 |
| 177 void WillBeginImplFrame(const BeginFrameArgs& args) override { | 186 void WillBeginImplFrame(const BeginFrameArgs& args) override { |
| 178 LayerTreeHostImpl::WillBeginImplFrame(args); | 187 LayerTreeHostImpl::WillBeginImplFrame(args); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 } | 573 } |
| 565 | 574 |
| 566 void LayerTreeTest::WillBeginTest() { | 575 void LayerTreeTest::WillBeginTest() { |
| 567 layer_tree_host_->SetLayerTreeHostClientReady(); | 576 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 568 } | 577 } |
| 569 | 578 |
| 570 void LayerTreeTest::DoBeginTest() { | 579 void LayerTreeTest::DoBeginTest() { |
| 571 client_ = LayerTreeHostClientForTesting::Create(this); | 580 client_ = LayerTreeHostClientForTesting::Create(this); |
| 572 | 581 |
| 573 scoped_ptr<FakeExternalBeginFrameSource> external_begin_frame_source; | 582 scoped_ptr<FakeExternalBeginFrameSource> external_begin_frame_source; |
| 574 if (settings_.use_external_begin_frame_source && | 583 if (settings_.use_external_begin_frame_source) { |
| 575 settings_.throttle_frame_production) { | |
| 576 external_begin_frame_source.reset(new FakeExternalBeginFrameSource( | 584 external_begin_frame_source.reset(new FakeExternalBeginFrameSource( |
| 577 settings_.renderer_settings.refresh_rate)); | 585 settings_.renderer_settings.refresh_rate)); |
| 578 external_begin_frame_source_ = external_begin_frame_source.get(); | 586 external_begin_frame_source_ = external_begin_frame_source.get(); |
| 579 } | 587 } |
| 580 | 588 |
| 581 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); | 589 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); |
| 582 layer_tree_host_ = LayerTreeHostForTesting::Create( | 590 layer_tree_host_ = LayerTreeHostForTesting::Create( |
| 583 this, | 591 this, |
| 584 client_.get(), | 592 client_.get(), |
| 585 settings_, | 593 settings_, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 void LayerTreeTest::RequestNewOutputSurface() { | 754 void LayerTreeTest::RequestNewOutputSurface() { |
| 747 layer_tree_host_->SetOutputSurface(CreateOutputSurface()); | 755 layer_tree_host_->SetOutputSurface(CreateOutputSurface()); |
| 748 } | 756 } |
| 749 | 757 |
| 750 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() { | 758 scoped_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() { |
| 751 scoped_ptr<FakeOutputSurface> output_surface = CreateFakeOutputSurface(); | 759 scoped_ptr<FakeOutputSurface> output_surface = CreateFakeOutputSurface(); |
| 752 DCHECK_EQ(delegating_renderer_, | 760 DCHECK_EQ(delegating_renderer_, |
| 753 output_surface->capabilities().delegated_rendering); | 761 output_surface->capabilities().delegated_rendering); |
| 754 output_surface_ = output_surface.get(); | 762 output_surface_ = output_surface.get(); |
| 755 | 763 |
| 756 if (settings_.use_external_begin_frame_source && | 764 if (settings_.use_external_begin_frame_source) { |
| 757 settings_.throttle_frame_production) { | |
| 758 DCHECK(external_begin_frame_source_); | 765 DCHECK(external_begin_frame_source_); |
| 759 DCHECK(external_begin_frame_source_->is_ready()); | 766 DCHECK(external_begin_frame_source_->is_ready()); |
| 760 } | 767 } |
| 761 return output_surface.Pass(); | 768 return output_surface.Pass(); |
| 762 } | 769 } |
| 763 | 770 |
| 764 scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface() { | 771 scoped_ptr<FakeOutputSurface> LayerTreeTest::CreateFakeOutputSurface() { |
| 765 if (delegating_renderer_) | 772 if (delegating_renderer_) |
| 766 return FakeOutputSurface::CreateDelegating3d(); | 773 return FakeOutputSurface::CreateDelegating3d(); |
| 767 else | 774 else |
| (...skipping 15 matching lines...) Expand all Loading... |
| 783 return -1; | 790 return -1; |
| 784 } | 791 } |
| 785 | 792 |
| 786 void LayerTreeTest::DestroyLayerTreeHost() { | 793 void LayerTreeTest::DestroyLayerTreeHost() { |
| 787 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 794 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 788 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 795 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 789 layer_tree_host_ = nullptr; | 796 layer_tree_host_ = nullptr; |
| 790 } | 797 } |
| 791 | 798 |
| 792 } // namespace cc | 799 } // namespace cc |
| OLD | NEW |