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

Unified Diff: cc/test/layer_tree_test.cc

Issue 342413005: Revert of Make SingleThreadProxy a SchedulerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/layer_tree_test.cc
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index a680441f3cf8dbfc7a73c9eb37553824df47616e..3437f8c9e20aadf0766ea0c7f29964a8556fd2ea 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -321,6 +321,14 @@
test_hooks_->DidCompleteSwapBuffers();
}
+ virtual void ScheduleComposite() OVERRIDE {
+ test_hooks_->ScheduleComposite();
+ }
+
+ virtual void ScheduleAnimation() OVERRIDE {
+ test_hooks_->ScheduleAnimation();
+ }
+
virtual void DidPostSwapBuffers() OVERRIDE {}
virtual void DidAbortSwapBuffers() OVERRIDE {}
@@ -393,6 +401,7 @@
end_when_begin_returns_(false),
timed_out_(false),
scheduled_(false),
+ schedule_when_set_visible_true_(false),
started_(false),
ended_(false),
delegating_renderer_(false),
@@ -555,6 +564,15 @@
EndTest();
}
+void LayerTreeTest::ScheduleComposite() {
+ if (!started_ || scheduled_)
+ return;
+ scheduled_ = true;
+ main_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&LayerTreeTest::DispatchComposite, main_thread_weak_ptr_));
+}
+
void LayerTreeTest::RealEndTest() {
if (layer_tree_host_ && proxy()->CommitPendingForTesting()) {
main_task_runner_->PostTask(
@@ -606,8 +624,16 @@
void LayerTreeTest::DispatchSetVisible(bool visible) {
DCHECK(!proxy() || proxy()->IsMainThread());
- if (layer_tree_host_)
- layer_tree_host_->SetVisible(visible);
+
+ if (!layer_tree_host_)
+ return;
+
+ layer_tree_host_->SetVisible(visible);
+
+ // If the LTH is being made visible and a previous ScheduleComposite() was
+ // deferred because the LTH was not visible, re-schedule the composite now.
+ if (layer_tree_host_->visible() && schedule_when_set_visible_true_)
+ ScheduleComposite();
}
void LayerTreeTest::DispatchSetNextCommitForcesRedraw() {
@@ -615,6 +641,24 @@
if (layer_tree_host_)
layer_tree_host_->SetNextCommitForcesRedraw();
+}
+
+void LayerTreeTest::DispatchComposite() {
+ scheduled_ = false;
+
+ if (!layer_tree_host_)
+ return;
+
+ // If the LTH is not visible, defer the composite until the LTH is made
+ // visible.
+ if (!layer_tree_host_->visible()) {
+ schedule_when_set_visible_true_ = true;
+ return;
+ }
+
+ schedule_when_set_visible_true_ = false;
+ base::TimeTicks now = gfx::FrameTime::Now();
+ layer_tree_host_->Composite(now);
}
void LayerTreeTest::RunTest(bool threaded,
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698