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

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

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/layer_tree_test.h ('k') | cc/test/test_gpu_memory_buffer_manager.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 "cc/animation/animation.h" 8 #include "cc/animation/animation.h"
9 #include "cc/animation/animation_registrar.h" 9 #include "cc/animation/animation_registrar.h"
10 #include "cc/animation/layer_animation_controller.h" 10 #include "cc/animation/layer_animation_controller.h"
(...skipping 26 matching lines...) Expand all
37 37
38 TestHooks::~TestHooks() {} 38 TestHooks::~TestHooks() {}
39 39
40 DrawResult TestHooks::PrepareToDrawOnThread( 40 DrawResult TestHooks::PrepareToDrawOnThread(
41 LayerTreeHostImpl* host_impl, 41 LayerTreeHostImpl* host_impl,
42 LayerTreeHostImpl::FrameData* frame_data, 42 LayerTreeHostImpl::FrameData* frame_data,
43 DrawResult draw_result) { 43 DrawResult draw_result) {
44 return draw_result; 44 return draw_result;
45 } 45 }
46 46
47 void TestHooks::CreateResourceAndRasterWorkerPool(
48 LayerTreeHostImpl* host_impl,
49 scoped_ptr<RasterWorkerPool>* raster_worker_pool,
50 scoped_ptr<ResourcePool>* resource_pool,
51 scoped_ptr<ResourcePool>* staging_resource_pool) {
52 host_impl->LayerTreeHostImpl::CreateResourceAndRasterWorkerPool(
53 raster_worker_pool, resource_pool, staging_resource_pool);
54 }
55
47 base::TimeDelta TestHooks::LowFrequencyAnimationInterval() const { 56 base::TimeDelta TestHooks::LowFrequencyAnimationInterval() const {
48 return base::TimeDelta::FromMilliseconds(16); 57 return base::TimeDelta::FromMilliseconds(16);
49 } 58 }
50 59
51 // Adapts ThreadProxy for test. Injects test hooks for testing. 60 // Adapts ThreadProxy for test. Injects test hooks for testing.
52 class ThreadProxyForTest : public ThreadProxy { 61 class ThreadProxyForTest : public ThreadProxy {
53 public: 62 public:
54 static scoped_ptr<Proxy> Create( 63 static scoped_ptr<Proxy> Create(
55 TestHooks* test_hooks, 64 TestHooks* test_hooks,
56 LayerTreeHost* host, 65 LayerTreeHost* host,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 host_impl_client, 148 host_impl_client,
140 proxy, 149 proxy,
141 stats_instrumentation, 150 stats_instrumentation,
142 shared_bitmap_manager, 151 shared_bitmap_manager,
143 gpu_memory_buffer_manager, 152 gpu_memory_buffer_manager,
144 0), 153 0),
145 test_hooks_(test_hooks), 154 test_hooks_(test_hooks),
146 block_notify_ready_to_activate_for_testing_(false), 155 block_notify_ready_to_activate_for_testing_(false),
147 notify_ready_to_activate_was_blocked_(false) {} 156 notify_ready_to_activate_was_blocked_(false) {}
148 157
158 void CreateResourceAndRasterWorkerPool(
159 scoped_ptr<RasterWorkerPool>* raster_worker_pool,
160 scoped_ptr<ResourcePool>* resource_pool,
161 scoped_ptr<ResourcePool>* staging_resource_pool) override {
162 test_hooks_->CreateResourceAndRasterWorkerPool(
163 this, raster_worker_pool, resource_pool, staging_resource_pool);
164 }
165
149 void WillBeginImplFrame(const BeginFrameArgs& args) override { 166 void WillBeginImplFrame(const BeginFrameArgs& args) override {
150 LayerTreeHostImpl::WillBeginImplFrame(args); 167 LayerTreeHostImpl::WillBeginImplFrame(args);
151 test_hooks_->WillBeginImplFrameOnThread(this, args); 168 test_hooks_->WillBeginImplFrameOnThread(this, args);
152 } 169 }
153 170
154 void BeginMainFrameAborted(bool did_handle) override { 171 void BeginMainFrameAborted(bool did_handle) override {
155 LayerTreeHostImpl::BeginMainFrameAborted(did_handle); 172 LayerTreeHostImpl::BeginMainFrameAborted(did_handle);
156 test_hooks_->BeginMainFrameAbortedOnThread(this, did_handle); 173 test_hooks_->BeginMainFrameAbortedOnThread(this, did_handle);
157 } 174 }
158 175
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 test_hooks_(test_hooks), 409 test_hooks_(test_hooks),
393 test_started_(false) {} 410 test_started_(false) {}
394 411
395 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; 412 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_;
396 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; 413 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_;
397 TestHooks* test_hooks_; 414 TestHooks* test_hooks_;
398 bool test_started_; 415 bool test_started_;
399 }; 416 };
400 417
401 LayerTreeTest::LayerTreeTest() 418 LayerTreeTest::LayerTreeTest()
402 : beginning_(false), 419 : output_surface_(nullptr),
420 beginning_(false),
403 end_when_begin_returns_(false), 421 end_when_begin_returns_(false),
404 timed_out_(false), 422 timed_out_(false),
405 scheduled_(false), 423 scheduled_(false),
406 started_(false), 424 started_(false),
407 ended_(false), 425 ended_(false),
408 delegating_renderer_(false), 426 delegating_renderer_(false),
409 timeout_seconds_(0), 427 timeout_seconds_(0),
410 weak_factory_(this) { 428 weak_factory_(this) {
411 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); 429 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr();
412 430
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 &LayerTreeTest::DispatchSetVisible, main_thread_weak_ptr_, visible)); 525 &LayerTreeTest::DispatchSetVisible, main_thread_weak_ptr_, visible));
508 } 526 }
509 527
510 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() { 528 void LayerTreeTest::PostSetNextCommitForcesRedrawToMainThread() {
511 main_task_runner_->PostTask( 529 main_task_runner_->PostTask(
512 FROM_HERE, 530 FROM_HERE,
513 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw, 531 base::Bind(&LayerTreeTest::DispatchSetNextCommitForcesRedraw,
514 main_thread_weak_ptr_)); 532 main_thread_weak_ptr_));
515 } 533 }
516 534
535 void LayerTreeTest::PostCompositeImmediatelyToMainThread() {
536 main_task_runner_->PostTask(
537 FROM_HERE,
538 base::Bind(&LayerTreeTest::DispatchCompositeImmediately,
539 main_thread_weak_ptr_));
540 }
541
517 void LayerTreeTest::WillBeginTest() { 542 void LayerTreeTest::WillBeginTest() {
518 layer_tree_host_->SetLayerTreeHostClientReady(); 543 layer_tree_host_->SetLayerTreeHostClientReady();
519 } 544 }
520 545
521 void LayerTreeTest::DoBeginTest() { 546 void LayerTreeTest::DoBeginTest() {
522 client_ = LayerTreeHostClientForTesting::Create(this); 547 client_ = LayerTreeHostClientForTesting::Create(this);
523 548
524 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); 549 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get());
525 layer_tree_host_ = LayerTreeHostForTesting::Create( 550 layer_tree_host_ = LayerTreeHostForTesting::Create(
526 this, 551 this,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 layer_tree_host_->SetVisible(visible); 647 layer_tree_host_->SetVisible(visible);
623 } 648 }
624 649
625 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() { 650 void LayerTreeTest::DispatchSetNextCommitForcesRedraw() {
626 DCHECK(!proxy() || proxy()->IsMainThread()); 651 DCHECK(!proxy() || proxy()->IsMainThread());
627 652
628 if (layer_tree_host_) 653 if (layer_tree_host_)
629 layer_tree_host_->SetNextCommitForcesRedraw(); 654 layer_tree_host_->SetNextCommitForcesRedraw();
630 } 655 }
631 656
657 void LayerTreeTest::DispatchCompositeImmediately() {
658 DCHECK(!proxy() || proxy()->IsMainThread());
659 if (layer_tree_host_)
660 layer_tree_host_->Composite(gfx::FrameTime::Now());
661 }
662
632 void LayerTreeTest::RunTest(bool threaded, 663 void LayerTreeTest::RunTest(bool threaded,
633 bool delegating_renderer, 664 bool delegating_renderer,
634 bool impl_side_painting) { 665 bool impl_side_painting) {
635 if (threaded) { 666 if (threaded) {
636 impl_thread_.reset(new base::Thread("Compositor")); 667 impl_thread_.reset(new base::Thread("Compositor"));
637 ASSERT_TRUE(impl_thread_->Start()); 668 ASSERT_TRUE(impl_thread_->Start());
638 } 669 }
639 670
640 main_task_runner_ = base::MessageLoopProxy::current(); 671 main_task_runner_ = base::MessageLoopProxy::current();
641 672
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 return -1; 746 return -1;
716 } 747 }
717 748
718 void LayerTreeTest::DestroyLayerTreeHost() { 749 void LayerTreeTest::DestroyLayerTreeHost() {
719 if (layer_tree_host_ && layer_tree_host_->root_layer()) 750 if (layer_tree_host_ && layer_tree_host_->root_layer())
720 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 751 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL);
721 layer_tree_host_ = nullptr; 752 layer_tree_host_ = nullptr;
722 } 753 }
723 754
724 } // namespace cc 755 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/test/test_gpu_memory_buffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698