 Chromium Code Reviews
 Chromium Code Reviews Issue 1126253005:
  cc: Add LayerTreeHost::InitParams for LayerTreeHost creation.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1126253005:
  cc: Add LayerTreeHost::InitParams for LayerTreeHost creation.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 static scoped_ptr<LayerTreeHostForTesting> Create( | 453 static scoped_ptr<LayerTreeHostForTesting> Create( | 
| 454 TestHooks* test_hooks, | 454 TestHooks* test_hooks, | 
| 455 LayerTreeHostClientForTesting* client, | 455 LayerTreeHostClientForTesting* client, | 
| 456 SharedBitmapManager* shared_bitmap_manager, | 456 SharedBitmapManager* shared_bitmap_manager, | 
| 457 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 457 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 
| 458 TaskGraphRunner* task_graph_runner, | 458 TaskGraphRunner* task_graph_runner, | 
| 459 const LayerTreeSettings& settings, | 459 const LayerTreeSettings& settings, | 
| 460 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 460 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 
| 461 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 461 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 
| 462 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 462 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 
| 463 LayerTreeHost::InitParams params; | |
| 464 params.client = client; | |
| 465 params.shared_bitmap_manager = shared_bitmap_manager; | |
| 466 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager; | |
| 467 params.task_graph_runner = task_graph_runner; | |
| 468 params.settings = &settings; | |
| 469 params.main_task_runner = main_task_runner; | |
| 
danakj
2015/05/07 18:28:32
this is similar, we used to not pass it to the con
 
sadrul
2015/05/07 22:47:43
Done (not setting main_task_runner anymore).
 | |
| 463 scoped_ptr<LayerTreeHostForTesting> layer_tree_host( | 470 scoped_ptr<LayerTreeHostForTesting> layer_tree_host( | 
| 464 new LayerTreeHostForTesting(test_hooks, client, shared_bitmap_manager, | 471 new LayerTreeHostForTesting(test_hooks, ¶ms)); | 
| 465 gpu_memory_buffer_manager, | |
| 466 task_graph_runner, settings)); | |
| 467 if (impl_task_runner.get()) { | 472 if (impl_task_runner.get()) { | 
| 468 layer_tree_host->InitializeForTesting( | 473 layer_tree_host->InitializeForTesting( | 
| 469 ThreadProxyForTest::Create(test_hooks, | 474 ThreadProxyForTest::Create(test_hooks, | 
| 470 layer_tree_host.get(), | 475 layer_tree_host.get(), | 
| 471 main_task_runner, | 476 main_task_runner, | 
| 472 impl_task_runner, | 477 impl_task_runner, | 
| 473 external_begin_frame_source.Pass())); | 478 external_begin_frame_source.Pass())); | 
| 474 } else { | 479 } else { | 
| 475 layer_tree_host->InitializeForTesting( | 480 layer_tree_host->InitializeForTesting( | 
| 476 SingleThreadProxyForTest::Create( | 481 SingleThreadProxyForTest::Create( | 
| (...skipping 16 matching lines...) Expand all Loading... | |
| 493 | 498 | 
| 494 void SetNeedsCommit() override { | 499 void SetNeedsCommit() override { | 
| 495 if (!test_started_) | 500 if (!test_started_) | 
| 496 return; | 501 return; | 
| 497 LayerTreeHost::SetNeedsCommit(); | 502 LayerTreeHost::SetNeedsCommit(); | 
| 498 } | 503 } | 
| 499 | 504 | 
| 500 void set_test_started(bool started) { test_started_ = started; } | 505 void set_test_started(bool started) { test_started_ = started; } | 
| 501 | 506 | 
| 502 private: | 507 private: | 
| 503 LayerTreeHostForTesting( | 508 LayerTreeHostForTesting(TestHooks* test_hooks, | 
| 504 TestHooks* test_hooks, | 509 LayerTreeHost::InitParams* params) | 
| 505 LayerTreeHostClient* client, | 510 : LayerTreeHost(params), | 
| 506 SharedBitmapManager* shared_bitmap_manager, | 511 shared_bitmap_manager_(params->shared_bitmap_manager), | 
| 507 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 512 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), | 
| 508 TaskGraphRunner* task_graph_runner, | 513 task_graph_runner_(params->task_graph_runner), | 
| 
sadrul
2015/05/07 04:39:26
Can you double check this a bit? The old code send
 
danakj
2015/05/07 18:28:32
Right, passing them to the LTH is pointless, cuz t
 
sadrul
2015/05/07 22:47:43
Thanks for explaining! I have made this change.
 | |
| 509 const LayerTreeSettings& settings) | |
| 510 : LayerTreeHost(client, NULL, NULL, NULL, settings), | |
| 511 shared_bitmap_manager_(shared_bitmap_manager), | |
| 512 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | |
| 513 task_graph_runner_(task_graph_runner), | |
| 514 test_hooks_(test_hooks), | 514 test_hooks_(test_hooks), | 
| 515 test_started_(false) {} | 515 test_started_(false) {} | 
| 516 | 516 | 
| 517 SharedBitmapManager* shared_bitmap_manager_; | 517 SharedBitmapManager* shared_bitmap_manager_; | 
| 518 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 518 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 
| 519 TaskGraphRunner* task_graph_runner_; | 519 TaskGraphRunner* task_graph_runner_; | 
| 520 TestHooks* test_hooks_; | 520 TestHooks* test_hooks_; | 
| 521 bool test_started_; | 521 bool test_started_; | 
| 522 }; | 522 }; | 
| 523 | 523 | 
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 LayerTreeHost* LayerTreeTest::layer_tree_host() { | 889 LayerTreeHost* LayerTreeTest::layer_tree_host() { | 
| 890 // We check for a null proxy here as we sometimes ask for the layer tree host | 890 // We check for a null proxy here as we sometimes ask for the layer tree host | 
| 891 // when the proxy does not exist, often for checking settings after a test has | 891 // when the proxy does not exist, often for checking settings after a test has | 
| 892 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See | 892 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See | 
| 893 // elsewhere in this file for other examples. | 893 // elsewhere in this file for other examples. | 
| 894 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); | 894 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); | 
| 895 return layer_tree_host_.get(); | 895 return layer_tree_host_.get(); | 
| 896 } | 896 } | 
| 897 | 897 | 
| 898 } // namespace cc | 898 } // namespace cc | 
| OLD | NEW |