| 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 "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 DrawResult TestHooks::PrepareToDrawOnThread( | 100 DrawResult TestHooks::PrepareToDrawOnThread( |
| 101 LayerTreeHostImpl* host_impl, | 101 LayerTreeHostImpl* host_impl, |
| 102 LayerTreeHostImpl::FrameData* frame_data, | 102 LayerTreeHostImpl::FrameData* frame_data, |
| 103 DrawResult draw_result) { | 103 DrawResult draw_result) { |
| 104 return draw_result; | 104 return draw_result; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void TestHooks::CreateResourceAndTileTaskWorkerPool( | 107 void TestHooks::CreateResourceAndTileTaskWorkerPool( |
| 108 LayerTreeHostImpl* host_impl, | 108 LayerTreeHostImpl* host_impl, |
| 109 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 109 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 110 scoped_ptr<ResourcePool>* resource_pool) { | 110 scoped_ptr<ResourcePool>* resource_pool, |
| 111 scoped_ptr<ResourcePool>* staging_resource_pool) { |
| 111 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( | 112 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( |
| 112 tile_task_worker_pool, resource_pool); | 113 tile_task_worker_pool, resource_pool, staging_resource_pool); |
| 113 } | 114 } |
| 114 | 115 |
| 115 // Adapts ThreadProxy for test. Injects test hooks for testing. | 116 // Adapts ThreadProxy for test. Injects test hooks for testing. |
| 116 class ThreadProxyForTest : public ThreadProxy { | 117 class ThreadProxyForTest : public ThreadProxy { |
| 117 public: | 118 public: |
| 118 static scoped_ptr<Proxy> Create( | 119 static scoped_ptr<Proxy> Create( |
| 119 TestHooks* test_hooks, | 120 TestHooks* test_hooks, |
| 120 LayerTreeHost* host, | 121 LayerTreeHost* host, |
| 121 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 122 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 122 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 123 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 shared_bitmap_manager, | 296 shared_bitmap_manager, |
| 296 gpu_memory_buffer_manager, | 297 gpu_memory_buffer_manager, |
| 297 task_graph_runner, | 298 task_graph_runner, |
| 298 0), | 299 0), |
| 299 test_hooks_(test_hooks), | 300 test_hooks_(test_hooks), |
| 300 block_notify_ready_to_activate_for_testing_(false), | 301 block_notify_ready_to_activate_for_testing_(false), |
| 301 notify_ready_to_activate_was_blocked_(false) {} | 302 notify_ready_to_activate_was_blocked_(false) {} |
| 302 | 303 |
| 303 void CreateResourceAndTileTaskWorkerPool( | 304 void CreateResourceAndTileTaskWorkerPool( |
| 304 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 305 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 305 scoped_ptr<ResourcePool>* resource_pool) override { | 306 scoped_ptr<ResourcePool>* resource_pool, |
| 307 scoped_ptr<ResourcePool>* staging_resource_pool) override { |
| 306 test_hooks_->CreateResourceAndTileTaskWorkerPool( | 308 test_hooks_->CreateResourceAndTileTaskWorkerPool( |
| 307 this, tile_task_worker_pool, resource_pool); | 309 this, tile_task_worker_pool, resource_pool, staging_resource_pool); |
| 308 } | 310 } |
| 309 | 311 |
| 310 void WillBeginImplFrame(const BeginFrameArgs& args) override { | 312 void WillBeginImplFrame(const BeginFrameArgs& args) override { |
| 311 LayerTreeHostImpl::WillBeginImplFrame(args); | 313 LayerTreeHostImpl::WillBeginImplFrame(args); |
| 312 test_hooks_->WillBeginImplFrameOnThread(this, args); | 314 test_hooks_->WillBeginImplFrameOnThread(this, args); |
| 313 } | 315 } |
| 314 | 316 |
| 315 void DidFinishImplFrame() override { | 317 void DidFinishImplFrame() override { |
| 316 LayerTreeHostImpl::DidFinishImplFrame(); | 318 LayerTreeHostImpl::DidFinishImplFrame(); |
| 317 test_hooks_->DidFinishImplFrameOnThread(this); | 319 test_hooks_->DidFinishImplFrameOnThread(this); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 LayerTreeHost* LayerTreeTest::layer_tree_host() { | 988 LayerTreeHost* LayerTreeTest::layer_tree_host() { |
| 987 // We check for a null proxy here as we sometimes ask for the layer tree host | 989 // We check for a null proxy here as we sometimes ask for the layer tree host |
| 988 // when the proxy does not exist, often for checking settings after a test has | 990 // when the proxy does not exist, often for checking settings after a test has |
| 989 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See | 991 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See |
| 990 // elsewhere in this file for other examples. | 992 // elsewhere in this file for other examples. |
| 991 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); | 993 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); |
| 992 return layer_tree_host_.get(); | 994 return layer_tree_host_.get(); |
| 993 } | 995 } |
| 994 | 996 |
| 995 } // namespace cc | 997 } // namespace cc |
| OLD | NEW |