Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: cc/test/layer_tree_test.cc

Issue 1126253005: cc: Add LayerTreeHost::InitParams for LayerTreeHost creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/fake_layer_tree_host.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
463 scoped_ptr<LayerTreeHostForTesting> layer_tree_host( 469 scoped_ptr<LayerTreeHostForTesting> layer_tree_host(
464 new LayerTreeHostForTesting(test_hooks, client, shared_bitmap_manager, 470 new LayerTreeHostForTesting(test_hooks, &params));
465 gpu_memory_buffer_manager,
466 task_graph_runner, settings));
467 if (impl_task_runner.get()) { 471 if (impl_task_runner.get()) {
468 layer_tree_host->InitializeForTesting( 472 layer_tree_host->InitializeForTesting(
469 ThreadProxyForTest::Create(test_hooks, 473 ThreadProxyForTest::Create(test_hooks,
470 layer_tree_host.get(), 474 layer_tree_host.get(),
471 main_task_runner, 475 main_task_runner,
472 impl_task_runner, 476 impl_task_runner,
473 external_begin_frame_source.Pass())); 477 external_begin_frame_source.Pass()));
474 } else { 478 } else {
475 layer_tree_host->InitializeForTesting( 479 layer_tree_host->InitializeForTesting(
476 SingleThreadProxyForTest::Create( 480 SingleThreadProxyForTest::Create(
477 test_hooks, 481 test_hooks,
478 layer_tree_host.get(), 482 layer_tree_host.get(),
479 client, 483 client,
480 main_task_runner, 484 main_task_runner,
481 external_begin_frame_source.Pass())); 485 external_begin_frame_source.Pass()));
482 } 486 }
483 return layer_tree_host.Pass(); 487 return layer_tree_host.Pass();
484 } 488 }
485 489
486 scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( 490 scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl(
487 LayerTreeHostImplClient* host_impl_client) override { 491 LayerTreeHostImplClient* host_impl_client) override {
488 return LayerTreeHostImplForTesting::Create( 492 return LayerTreeHostImplForTesting::Create(
489 test_hooks_, settings(), host_impl_client, proxy(), 493 test_hooks_, settings(), host_impl_client, proxy(),
490 shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_, 494 shared_bitmap_manager(), gpu_memory_buffer_manager(),
491 rendering_stats_instrumentation()); 495 task_graph_runner(), rendering_stats_instrumentation());
492 } 496 }
493 497
494 void SetNeedsCommit() override { 498 void SetNeedsCommit() override {
495 if (!test_started_) 499 if (!test_started_)
496 return; 500 return;
497 LayerTreeHost::SetNeedsCommit(); 501 LayerTreeHost::SetNeedsCommit();
498 } 502 }
499 503
500 void set_test_started(bool started) { test_started_ = started; } 504 void set_test_started(bool started) { test_started_ = started; }
501 505
502 private: 506 private:
503 LayerTreeHostForTesting( 507 LayerTreeHostForTesting(TestHooks* test_hooks,
504 TestHooks* test_hooks, 508 LayerTreeHost::InitParams* params)
505 LayerTreeHostClient* client, 509 : LayerTreeHost(params), test_hooks_(test_hooks), test_started_(false) {}
506 SharedBitmapManager* shared_bitmap_manager,
507 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
508 TaskGraphRunner* task_graph_runner,
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),
515 test_started_(false) {}
516 510
517 SharedBitmapManager* shared_bitmap_manager_;
518 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
519 TaskGraphRunner* task_graph_runner_;
520 TestHooks* test_hooks_; 511 TestHooks* test_hooks_;
521 bool test_started_; 512 bool test_started_;
522 }; 513 };
523 514
524 LayerTreeTest::LayerTreeTest() 515 LayerTreeTest::LayerTreeTest()
525 : output_surface_(nullptr), 516 : output_surface_(nullptr),
526 external_begin_frame_source_(nullptr), 517 external_begin_frame_source_(nullptr),
527 beginning_(false), 518 beginning_(false),
528 end_when_begin_returns_(false), 519 end_when_begin_returns_(false),
529 timed_out_(false), 520 timed_out_(false),
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 LayerTreeHost* LayerTreeTest::layer_tree_host() { 880 LayerTreeHost* LayerTreeTest::layer_tree_host() {
890 // We check for a null proxy here as we sometimes ask for the layer tree host 881 // 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 882 // when the proxy does not exist, often for checking settings after a test has
892 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See 883 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See
893 // elsewhere in this file for other examples. 884 // elsewhere in this file for other examples.
894 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); 885 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked());
895 return layer_tree_host_.get(); 886 return layer_tree_host_.get();
896 } 887 }
897 888
898 } // namespace cc 889 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698