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

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

Issue 508373002: cc: Single-threaded impl-side painting for unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: danakj review Created 6 years, 3 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
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 virtual void NotifyReadyToActivate() OVERRIDE { 197 virtual void NotifyReadyToActivate() OVERRIDE {
198 if (block_notify_ready_to_activate_for_testing_) 198 if (block_notify_ready_to_activate_for_testing_)
199 notify_ready_to_activate_was_blocked_ = true; 199 notify_ready_to_activate_was_blocked_ = true;
200 else 200 else
201 client_->NotifyReadyToActivate(); 201 client_->NotifyReadyToActivate();
202 } 202 }
203 203
204 virtual void BlockNotifyReadyToActivateForTesting(bool block) OVERRIDE { 204 virtual void BlockNotifyReadyToActivateForTesting(bool block) OVERRIDE {
205 CHECK(settings().impl_side_painting);
danakj 2014/09/03 21:14:24 nit: DCHECKs would be sufficient (and be a good ex
enne (OOO) 2014/09/03 21:36:25 It's a CHECK so that it also fails in release. If
206 CHECK(proxy()->ImplThreadTaskRunner())
207 << "Not supported for single-threaded mode.";
205 block_notify_ready_to_activate_for_testing_ = block; 208 block_notify_ready_to_activate_for_testing_ = block;
206 if (!block && notify_ready_to_activate_was_blocked_) { 209 if (!block && notify_ready_to_activate_was_blocked_) {
207 NotifyReadyToActivate(); 210 NotifyReadyToActivate();
208 notify_ready_to_activate_was_blocked_ = false; 211 notify_ready_to_activate_was_blocked_ = false;
209 } 212 }
210 } 213 }
211 214
212 virtual void ActivateSyncTree() OVERRIDE { 215 virtual void ActivateSyncTree() OVERRIDE {
213 test_hooks_->WillActivateTreeOnThread(this); 216 test_hooks_->WillActivateTreeOnThread(this);
214 LayerTreeHostImpl::ActivateSyncTree(); 217 LayerTreeHostImpl::ActivateSyncTree();
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 ASSERT_TRUE(impl_thread_->Start()); 623 ASSERT_TRUE(impl_thread_->Start());
621 } 624 }
622 625
623 main_task_runner_ = base::MessageLoopProxy::current(); 626 main_task_runner_ = base::MessageLoopProxy::current();
624 627
625 delegating_renderer_ = delegating_renderer; 628 delegating_renderer_ = delegating_renderer;
626 629
627 // Spend less time waiting for BeginFrame because the output is 630 // Spend less time waiting for BeginFrame because the output is
628 // mocked out. 631 // mocked out.
629 settings_.refresh_rate = 200.0; 632 settings_.refresh_rate = 200.0;
630 if (impl_side_painting) { 633 settings_.impl_side_painting = impl_side_painting;
631 DCHECK(threaded)
632 << "Don't run single thread + impl side painting, it doesn't exist.";
633 settings_.impl_side_painting = true;
634 }
635 InitializeSettings(&settings_); 634 InitializeSettings(&settings_);
636 635
637 main_task_runner_->PostTask( 636 main_task_runner_->PostTask(
638 FROM_HERE, 637 FROM_HERE,
639 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); 638 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this)));
640 639
641 if (timeout_seconds_) { 640 if (timeout_seconds_) {
642 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); 641 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this)));
643 main_task_runner_->PostDelayedTask( 642 main_task_runner_->PostDelayedTask(
644 FROM_HERE, 643 FROM_HERE,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 return -1; 697 return -1;
699 } 698 }
700 699
701 void LayerTreeTest::DestroyLayerTreeHost() { 700 void LayerTreeTest::DestroyLayerTreeHost() {
702 if (layer_tree_host_ && layer_tree_host_->root_layer()) 701 if (layer_tree_host_ && layer_tree_host_->root_layer())
703 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 702 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL);
704 layer_tree_host_.reset(); 703 layer_tree_host_.reset();
705 } 704 }
706 705
707 } // namespace cc 706 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698