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

Side by Side Diff: ui/compositor/test/draw_waiter_for_test.cc

Issue 784653002: Revert of Make ui::Compositor use ui::Scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/compositor/test/draw_waiter_for_test.h" 5 #include "ui/compositor/test/draw_waiter_for_test.h"
6 6
7 #include "ui/compositor/compositor.h" 7 #include "ui/compositor/compositor.h"
8 8
9 namespace ui { 9 namespace ui {
10 10
11 // static 11 // static
12 void DrawWaiterForTest::WaitForCompositingStarted(Compositor* compositor) { 12 void DrawWaiterForTest::Wait(Compositor* compositor) {
13 DrawWaiterForTest waiter(WAIT_FOR_COMPOSITING_STARTED); 13 DrawWaiterForTest waiter;
14 waiter.WaitImpl(compositor); 14 waiter.wait_for_commit_ = false;
15 }
16
17 void DrawWaiterForTest::WaitForCompositingEnded(Compositor* compositor) {
18 DrawWaiterForTest waiter(WAIT_FOR_COMPOSITING_ENDED);
19 waiter.WaitImpl(compositor); 15 waiter.WaitImpl(compositor);
20 } 16 }
21 17
22 // static 18 // static
23 void DrawWaiterForTest::WaitForCommit(Compositor* compositor) { 19 void DrawWaiterForTest::WaitForCommit(Compositor* compositor) {
24 DrawWaiterForTest waiter(WAIT_FOR_COMMIT); 20 DrawWaiterForTest waiter;
21 waiter.wait_for_commit_ = true;
25 waiter.WaitImpl(compositor); 22 waiter.WaitImpl(compositor);
26 } 23 }
27 24
28 DrawWaiterForTest::DrawWaiterForTest(WaitEvent wait_event) 25 DrawWaiterForTest::DrawWaiterForTest() {
29 : wait_event_(wait_event) {
30 } 26 }
31 27
32 DrawWaiterForTest::~DrawWaiterForTest() {} 28 DrawWaiterForTest::~DrawWaiterForTest() {}
33 29
34 void DrawWaiterForTest::WaitImpl(Compositor* compositor) { 30 void DrawWaiterForTest::WaitImpl(Compositor* compositor) {
35 compositor->AddObserver(this); 31 compositor->AddObserver(this);
36 wait_run_loop_.reset(new base::RunLoop()); 32 wait_run_loop_.reset(new base::RunLoop());
37 wait_run_loop_->Run(); 33 wait_run_loop_->Run();
38 compositor->RemoveObserver(this); 34 compositor->RemoveObserver(this);
39 } 35 }
40 36
41 void DrawWaiterForTest::OnCompositingDidCommit(Compositor* compositor) { 37 void DrawWaiterForTest::OnCompositingDidCommit(Compositor* compositor) {
42 if (wait_event_ == WAIT_FOR_COMMIT) 38 if (wait_for_commit_)
43 wait_run_loop_->Quit(); 39 wait_run_loop_->Quit();
44 } 40 }
45 41
46 void DrawWaiterForTest::OnCompositingStarted(Compositor* compositor, 42 void DrawWaiterForTest::OnCompositingStarted(Compositor* compositor,
47 base::TimeTicks start_time) { 43 base::TimeTicks start_time) {
48 if (wait_event_ == WAIT_FOR_COMPOSITING_STARTED) 44 }
45
46 void DrawWaiterForTest::OnCompositingEnded(Compositor* compositor) {
47 if (!wait_for_commit_)
49 wait_run_loop_->Quit(); 48 wait_run_loop_->Quit();
50 } 49 }
51 50
52 void DrawWaiterForTest::OnCompositingEnded(Compositor* compositor) {
53 if (wait_event_ == WAIT_FOR_COMPOSITING_ENDED)
54 wait_run_loop_->Quit();
55 }
56
57 void DrawWaiterForTest::OnCompositingAborted(Compositor* compositor) { 51 void DrawWaiterForTest::OnCompositingAborted(Compositor* compositor) {
58 } 52 }
59 53
60 void DrawWaiterForTest::OnCompositingLockStateChanged(Compositor* compositor) {} 54 void DrawWaiterForTest::OnCompositingLockStateChanged(Compositor* compositor) {}
61 55
62 } // namespace ui 56 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/test/draw_waiter_for_test.h ('k') | ui/compositor/test/in_process_context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698