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