| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( | 49 scoped_ptr<Rasterizer> TestHooks::CreateRasterizer( |
| 50 LayerTreeHostImpl* host_impl) { | 50 LayerTreeHostImpl* host_impl) { |
| 51 return host_impl->LayerTreeHostImpl::CreateRasterizer(); | 51 return host_impl->LayerTreeHostImpl::CreateRasterizer(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void TestHooks::CreateResourceAndTileTaskWorkerPool( | 54 ResourceFormat TestHooks::CreateResourceAndTileTaskWorkerPool( |
| 55 LayerTreeHostImpl* host_impl, | 55 LayerTreeHostImpl* host_impl, |
| 56 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 56 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 57 scoped_ptr<ResourcePool>* resource_pool, | 57 scoped_ptr<ResourcePool>* resource_pool, |
| 58 scoped_ptr<ResourcePool>* staging_resource_pool) { | 58 scoped_ptr<ResourcePool>* staging_resource_pool) { |
| 59 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( | 59 return host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( |
| 60 tile_task_worker_pool, resource_pool, staging_resource_pool); | 60 tile_task_worker_pool, resource_pool, staging_resource_pool); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Adapts ThreadProxy for test. Injects test hooks for testing. | 63 // Adapts ThreadProxy for test. Injects test hooks for testing. |
| 64 class ThreadProxyForTest : public ThreadProxy { | 64 class ThreadProxyForTest : public ThreadProxy { |
| 65 public: | 65 public: |
| 66 static scoped_ptr<Proxy> Create( | 66 static scoped_ptr<Proxy> Create( |
| 67 TestHooks* test_hooks, | 67 TestHooks* test_hooks, |
| 68 LayerTreeHost* host, | 68 LayerTreeHost* host, |
| 69 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 69 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 gpu_memory_buffer_manager, | 168 gpu_memory_buffer_manager, |
| 169 0), | 169 0), |
| 170 test_hooks_(test_hooks), | 170 test_hooks_(test_hooks), |
| 171 block_notify_ready_to_activate_for_testing_(false), | 171 block_notify_ready_to_activate_for_testing_(false), |
| 172 notify_ready_to_activate_was_blocked_(false) {} | 172 notify_ready_to_activate_was_blocked_(false) {} |
| 173 | 173 |
| 174 scoped_ptr<Rasterizer> CreateRasterizer() override { | 174 scoped_ptr<Rasterizer> CreateRasterizer() override { |
| 175 return test_hooks_->CreateRasterizer(this); | 175 return test_hooks_->CreateRasterizer(this); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void CreateResourceAndTileTaskWorkerPool( | 178 ResourceFormat CreateResourceAndTileTaskWorkerPool( |
| 179 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 179 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 180 scoped_ptr<ResourcePool>* resource_pool, | 180 scoped_ptr<ResourcePool>* resource_pool, |
| 181 scoped_ptr<ResourcePool>* staging_resource_pool) override { | 181 scoped_ptr<ResourcePool>* staging_resource_pool) override { |
| 182 test_hooks_->CreateResourceAndTileTaskWorkerPool( | 182 return test_hooks_->CreateResourceAndTileTaskWorkerPool( |
| 183 this, tile_task_worker_pool, resource_pool, staging_resource_pool); | 183 this, tile_task_worker_pool, resource_pool, staging_resource_pool); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void WillBeginImplFrame(const BeginFrameArgs& args) override { | 186 void WillBeginImplFrame(const BeginFrameArgs& args) override { |
| 187 LayerTreeHostImpl::WillBeginImplFrame(args); | 187 LayerTreeHostImpl::WillBeginImplFrame(args); |
| 188 test_hooks_->WillBeginImplFrameOnThread(this, args); | 188 test_hooks_->WillBeginImplFrameOnThread(this, args); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void BeginMainFrameAborted(CommitEarlyOutReason reason) override { | 191 void BeginMainFrameAborted(CommitEarlyOutReason reason) override { |
| 192 LayerTreeHostImpl::BeginMainFrameAborted(reason); | 192 LayerTreeHostImpl::BeginMainFrameAborted(reason); |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 return -1; | 790 return -1; |
| 791 } | 791 } |
| 792 | 792 |
| 793 void LayerTreeTest::DestroyLayerTreeHost() { | 793 void LayerTreeTest::DestroyLayerTreeHost() { |
| 794 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 794 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 795 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 795 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 796 layer_tree_host_ = nullptr; | 796 layer_tree_host_ = nullptr; |
| 797 } | 797 } |
| 798 | 798 |
| 799 } // namespace cc | 799 } // namespace cc |
| OLD | NEW |