| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 void TestHooks::CreateResourceAndTileTaskWorkerPool( | 49 void TestHooks::CreateResourceAndTileTaskWorkerPool( |
| 50 LayerTreeHostImpl* host_impl, | 50 LayerTreeHostImpl* host_impl, |
| 51 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 51 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 52 scoped_ptr<Rasterizer>* rasterizer, |
| 52 scoped_ptr<ResourcePool>* resource_pool, | 53 scoped_ptr<ResourcePool>* resource_pool, |
| 53 scoped_ptr<ResourcePool>* staging_resource_pool) { | 54 scoped_ptr<ResourcePool>* staging_resource_pool) { |
| 54 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( | 55 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( |
| 55 tile_task_worker_pool, resource_pool, staging_resource_pool); | 56 tile_task_worker_pool, rasterizer, resource_pool, staging_resource_pool); |
| 56 } | 57 } |
| 57 | 58 |
| 58 // Adapts ThreadProxy for test. Injects test hooks for testing. | 59 // Adapts ThreadProxy for test. Injects test hooks for testing. |
| 59 class ThreadProxyForTest : public ThreadProxy { | 60 class ThreadProxyForTest : public ThreadProxy { |
| 60 public: | 61 public: |
| 61 static scoped_ptr<Proxy> Create( | 62 static scoped_ptr<Proxy> Create( |
| 62 TestHooks* test_hooks, | 63 TestHooks* test_hooks, |
| 63 LayerTreeHost* host, | 64 LayerTreeHost* host, |
| 64 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 65 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 65 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 66 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 stats_instrumentation, | 162 stats_instrumentation, |
| 162 shared_bitmap_manager, | 163 shared_bitmap_manager, |
| 163 gpu_memory_buffer_manager, | 164 gpu_memory_buffer_manager, |
| 164 0), | 165 0), |
| 165 test_hooks_(test_hooks), | 166 test_hooks_(test_hooks), |
| 166 block_notify_ready_to_activate_for_testing_(false), | 167 block_notify_ready_to_activate_for_testing_(false), |
| 167 notify_ready_to_activate_was_blocked_(false) {} | 168 notify_ready_to_activate_was_blocked_(false) {} |
| 168 | 169 |
| 169 void CreateResourceAndTileTaskWorkerPool( | 170 void CreateResourceAndTileTaskWorkerPool( |
| 170 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 171 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 172 scoped_ptr<Rasterizer>* rasterizer, |
| 171 scoped_ptr<ResourcePool>* resource_pool, | 173 scoped_ptr<ResourcePool>* resource_pool, |
| 172 scoped_ptr<ResourcePool>* staging_resource_pool) override { | 174 scoped_ptr<ResourcePool>* staging_resource_pool) override { |
| 173 test_hooks_->CreateResourceAndTileTaskWorkerPool( | 175 test_hooks_->CreateResourceAndTileTaskWorkerPool( |
| 174 this, tile_task_worker_pool, resource_pool, staging_resource_pool); | 176 this, tile_task_worker_pool, rasterizer, resource_pool, |
| 177 staging_resource_pool); |
| 175 } | 178 } |
| 176 | 179 |
| 177 void WillBeginImplFrame(const BeginFrameArgs& args) override { | 180 void WillBeginImplFrame(const BeginFrameArgs& args) override { |
| 178 LayerTreeHostImpl::WillBeginImplFrame(args); | 181 LayerTreeHostImpl::WillBeginImplFrame(args); |
| 179 test_hooks_->WillBeginImplFrameOnThread(this, args); | 182 test_hooks_->WillBeginImplFrameOnThread(this, args); |
| 180 } | 183 } |
| 181 | 184 |
| 182 void BeginMainFrameAborted(CommitEarlyOutReason reason) override { | 185 void BeginMainFrameAborted(CommitEarlyOutReason reason) override { |
| 183 LayerTreeHostImpl::BeginMainFrameAborted(reason); | 186 LayerTreeHostImpl::BeginMainFrameAborted(reason); |
| 184 test_hooks_->BeginMainFrameAbortedOnThread(this, reason); | 187 test_hooks_->BeginMainFrameAbortedOnThread(this, reason); |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 return -1; | 786 return -1; |
| 784 } | 787 } |
| 785 | 788 |
| 786 void LayerTreeTest::DestroyLayerTreeHost() { | 789 void LayerTreeTest::DestroyLayerTreeHost() { |
| 787 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 790 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 788 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 791 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 789 layer_tree_host_ = nullptr; | 792 layer_tree_host_ = nullptr; |
| 790 } | 793 } |
| 791 | 794 |
| 792 } // namespace cc | 795 } // namespace cc |
| OLD | NEW |