| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 DrawResult TestHooks::PrepareToDrawOnThread( | 44 DrawResult TestHooks::PrepareToDrawOnThread( |
| 45 LayerTreeHostImpl* host_impl, | 45 LayerTreeHostImpl* host_impl, |
| 46 LayerTreeHostImpl::FrameData* frame_data, | 46 LayerTreeHostImpl::FrameData* frame_data, |
| 47 DrawResult draw_result) { | 47 DrawResult draw_result) { |
| 48 return draw_result; | 48 return draw_result; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void TestHooks::CreateResourceAndTileTaskWorkerPool( | 51 void TestHooks::CreateResourceAndTileTaskWorkerPool( |
| 52 LayerTreeHostImpl* host_impl, | 52 LayerTreeHostImpl* host_impl, |
| 53 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 53 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 54 scoped_ptr<ResourcePool>* resource_pool, | 54 scoped_ptr<ResourcePool>* resource_pool) { |
| 55 scoped_ptr<ResourcePool>* staging_resource_pool) { | |
| 56 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( | 55 host_impl->LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( |
| 57 tile_task_worker_pool, resource_pool, staging_resource_pool); | 56 tile_task_worker_pool, resource_pool); |
| 58 } | 57 } |
| 59 | 58 |
| 60 // Adapts ThreadProxy for test. Injects test hooks for testing. | 59 // Adapts ThreadProxy for test. Injects test hooks for testing. |
| 61 class ThreadProxyForTest : public ThreadProxy { | 60 class ThreadProxyForTest : public ThreadProxy { |
| 62 public: | 61 public: |
| 63 static scoped_ptr<Proxy> Create( | 62 static scoped_ptr<Proxy> Create( |
| 64 TestHooks* test_hooks, | 63 TestHooks* test_hooks, |
| 65 LayerTreeHost* host, | 64 LayerTreeHost* host, |
| 66 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 65 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 67 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 66 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 shared_bitmap_manager, | 239 shared_bitmap_manager, |
| 241 gpu_memory_buffer_manager, | 240 gpu_memory_buffer_manager, |
| 242 task_graph_runner, | 241 task_graph_runner, |
| 243 0), | 242 0), |
| 244 test_hooks_(test_hooks), | 243 test_hooks_(test_hooks), |
| 245 block_notify_ready_to_activate_for_testing_(false), | 244 block_notify_ready_to_activate_for_testing_(false), |
| 246 notify_ready_to_activate_was_blocked_(false) {} | 245 notify_ready_to_activate_was_blocked_(false) {} |
| 247 | 246 |
| 248 void CreateResourceAndTileTaskWorkerPool( | 247 void CreateResourceAndTileTaskWorkerPool( |
| 249 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 248 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
| 250 scoped_ptr<ResourcePool>* resource_pool, | 249 scoped_ptr<ResourcePool>* resource_pool) override { |
| 251 scoped_ptr<ResourcePool>* staging_resource_pool) override { | |
| 252 test_hooks_->CreateResourceAndTileTaskWorkerPool( | 250 test_hooks_->CreateResourceAndTileTaskWorkerPool( |
| 253 this, tile_task_worker_pool, resource_pool, staging_resource_pool); | 251 this, tile_task_worker_pool, resource_pool); |
| 254 } | 252 } |
| 255 | 253 |
| 256 void WillBeginImplFrame(const BeginFrameArgs& args) override { | 254 void WillBeginImplFrame(const BeginFrameArgs& args) override { |
| 257 LayerTreeHostImpl::WillBeginImplFrame(args); | 255 LayerTreeHostImpl::WillBeginImplFrame(args); |
| 258 test_hooks_->WillBeginImplFrameOnThread(this, args); | 256 test_hooks_->WillBeginImplFrameOnThread(this, args); |
| 259 } | 257 } |
| 260 | 258 |
| 261 void DidFinishImplFrame() override { | 259 void DidFinishImplFrame() override { |
| 262 LayerTreeHostImpl::DidFinishImplFrame(); | 260 LayerTreeHostImpl::DidFinishImplFrame(); |
| 263 test_hooks_->DidFinishImplFrameOnThread(this); | 261 test_hooks_->DidFinishImplFrameOnThread(this); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 LayerTreeHost* LayerTreeTest::layer_tree_host() { | 924 LayerTreeHost* LayerTreeTest::layer_tree_host() { |
| 927 // We check for a null proxy here as we sometimes ask for the layer tree host | 925 // We check for a null proxy here as we sometimes ask for the layer tree host |
| 928 // when the proxy does not exist, often for checking settings after a test has | 926 // when the proxy does not exist, often for checking settings after a test has |
| 929 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See | 927 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See |
| 930 // elsewhere in this file for other examples. | 928 // elsewhere in this file for other examples. |
| 931 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); | 929 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); |
| 932 return layer_tree_host_.get(); | 930 return layer_tree_host_.get(); |
| 933 } | 931 } |
| 934 | 932 |
| 935 } // namespace cc | 933 } // namespace cc |
| OLD | NEW |