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

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: Rebase Created 6 years, 2 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/layer_tree_test.h ('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 "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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 193 }
194 194
195 virtual void NotifyReadyToActivate() override { 195 virtual void NotifyReadyToActivate() override {
196 if (block_notify_ready_to_activate_for_testing_) 196 if (block_notify_ready_to_activate_for_testing_)
197 notify_ready_to_activate_was_blocked_ = true; 197 notify_ready_to_activate_was_blocked_ = true;
198 else 198 else
199 client_->NotifyReadyToActivate(); 199 client_->NotifyReadyToActivate();
200 } 200 }
201 201
202 virtual void BlockNotifyReadyToActivateForTesting(bool block) override { 202 virtual void BlockNotifyReadyToActivateForTesting(bool block) override {
203 CHECK(settings().impl_side_painting);
204 CHECK(proxy()->ImplThreadTaskRunner())
205 << "Not supported for single-threaded mode.";
203 block_notify_ready_to_activate_for_testing_ = block; 206 block_notify_ready_to_activate_for_testing_ = block;
204 if (!block && notify_ready_to_activate_was_blocked_) { 207 if (!block && notify_ready_to_activate_was_blocked_) {
205 NotifyReadyToActivate(); 208 NotifyReadyToActivate();
206 notify_ready_to_activate_was_blocked_ = false; 209 notify_ready_to_activate_was_blocked_ = false;
207 } 210 }
208 } 211 }
209 212
210 virtual void ActivateSyncTree() override { 213 virtual void ActivateSyncTree() override {
211 test_hooks_->WillActivateTreeOnThread(this); 214 test_hooks_->WillActivateTreeOnThread(this);
212 LayerTreeHostImpl::ActivateSyncTree(); 215 LayerTreeHostImpl::ActivateSyncTree();
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 ASSERT_TRUE(impl_thread_->Start()); 632 ASSERT_TRUE(impl_thread_->Start());
630 } 633 }
631 634
632 main_task_runner_ = base::MessageLoopProxy::current(); 635 main_task_runner_ = base::MessageLoopProxy::current();
633 636
634 delegating_renderer_ = delegating_renderer; 637 delegating_renderer_ = delegating_renderer;
635 638
636 // Spend less time waiting for BeginFrame because the output is 639 // Spend less time waiting for BeginFrame because the output is
637 // mocked out. 640 // mocked out.
638 settings_.refresh_rate = 200.0; 641 settings_.refresh_rate = 200.0;
639 if (impl_side_painting) { 642 settings_.impl_side_painting = impl_side_painting;
640 DCHECK(threaded)
641 << "Don't run single thread + impl side painting, it doesn't exist.";
642 settings_.impl_side_painting = true;
643 }
644 InitializeSettings(&settings_); 643 InitializeSettings(&settings_);
645 644
646 main_task_runner_->PostTask( 645 main_task_runner_->PostTask(
647 FROM_HERE, 646 FROM_HERE,
648 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); 647 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this)));
649 648
650 if (timeout_seconds_) { 649 if (timeout_seconds_) {
651 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); 650 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this)));
652 main_task_runner_->PostDelayedTask( 651 main_task_runner_->PostDelayedTask(
653 FROM_HERE, 652 FROM_HERE,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 return -1; 710 return -1;
712 } 711 }
713 712
714 void LayerTreeTest::DestroyLayerTreeHost() { 713 void LayerTreeTest::DestroyLayerTreeHost() {
715 if (layer_tree_host_ && layer_tree_host_->root_layer()) 714 if (layer_tree_host_ && layer_tree_host_->root_layer())
716 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 715 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL);
717 layer_tree_host_ = nullptr; 716 layer_tree_host_ = nullptr;
718 } 717 }
719 718
720 } // namespace cc 719 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698