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

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

Issue 2776973004: Remove CompositorObserver::OnCompositingEnded() (Closed)
Patch Set: Rename commited_frame_number_ to activated_frame_count_ and move increments back to DidReceiveCompo… Created 3 years, 8 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 | « ui/compositor/layer_unittest.cc ('k') | ui/compositor/test/draw_waiter_for_test.cc » ('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 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 #ifndef UI_COMPOSITOR_TEST_DRAW_WAITER_H_ 5 #ifndef UI_COMPOSITOR_TEST_DRAW_WAITER_H_
6 #define UI_COMPOSITOR_TEST_DRAW_WAITER_H_ 6 #define UI_COMPOSITOR_TEST_DRAW_WAITER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "ui/compositor/compositor_observer.h" 12 #include "ui/compositor/compositor_observer.h"
13 13
14 class Compositor; 14 class Compositor;
15 15
16 namespace ui { 16 namespace ui {
17 17
18 // This is only to be used for test. It allows execution of other tasks on 18 // This is only to be used for test. It allows execution of other tasks on
19 // the current message loop before the current task finishs (there is a 19 // the current message loop before the current task finishs (there is a
20 // potential for re-entrancy). 20 // potential for re-entrancy).
21 class DrawWaiterForTest : public CompositorObserver { 21 class DrawWaiterForTest : public CompositorObserver {
22 public: 22 public:
23 // Waits for a draw to be issued by the compositor. If the test times out 23 // Waits for a draw to be issued by the compositor. If the test times out
24 // here, there may be a logic error in the compositor code causing it 24 // here, there may be a logic error in the compositor code causing it
25 // not to draw. 25 // not to draw.
26 static void WaitForCompositingStarted(Compositor* compositor); 26 static void WaitForCompositingStarted(Compositor* compositor);
27 27
28 // Waits for a swap to be completed from the compositor.
29 static void WaitForCompositingEnded(Compositor* compositor);
30
31 // Waits for a commit instead of a draw. 28 // Waits for a commit instead of a draw.
32 static void WaitForCommit(Compositor* compositor); 29 static void WaitForCommit(Compositor* compositor);
33 30
34 private: 31 private:
35 enum WaitEvent { 32 enum WaitEvent {
36 WAIT_FOR_COMMIT, 33 WAIT_FOR_COMMIT,
37 WAIT_FOR_COMPOSITING_STARTED, 34 WAIT_FOR_COMPOSITING_STARTED,
38 WAIT_FOR_COMPOSITING_ENDED,
39 }; 35 };
40 DrawWaiterForTest(WaitEvent wait_event); 36 DrawWaiterForTest(WaitEvent wait_event);
41 ~DrawWaiterForTest(); 37 ~DrawWaiterForTest();
42 38
43 void WaitImpl(Compositor* compositor); 39 void WaitImpl(Compositor* compositor);
44 40
45 // CompositorObserver implementation. 41 // CompositorObserver implementation.
46 void OnCompositingDidCommit(Compositor* compositor) override; 42 void OnCompositingDidCommit(Compositor* compositor) override;
47 void OnCompositingStarted(Compositor* compositor, 43 void OnCompositingStarted(Compositor* compositor,
48 base::TimeTicks start_time) override; 44 base::TimeTicks start_time) override;
49 void OnCompositingEnded(Compositor* compositor) override;
50 void OnCompositingLockStateChanged(Compositor* compositor) override; 45 void OnCompositingLockStateChanged(Compositor* compositor) override;
51 void OnCompositingShuttingDown(Compositor* compositor) override; 46 void OnCompositingShuttingDown(Compositor* compositor) override;
52 47
53 std::unique_ptr<base::RunLoop> wait_run_loop_; 48 std::unique_ptr<base::RunLoop> wait_run_loop_;
54 49
55 WaitEvent wait_event_; 50 WaitEvent wait_event_;
56 51
57 DISALLOW_COPY_AND_ASSIGN(DrawWaiterForTest); 52 DISALLOW_COPY_AND_ASSIGN(DrawWaiterForTest);
58 }; 53 };
59 54
60 } // namespace ui 55 } // namespace ui
61 56
62 #endif // UI_COMPOSITOR_TEST_DRAW_WAITER_H_ 57 #endif // UI_COMPOSITOR_TEST_DRAW_WAITER_H_
OLDNEW
« no previous file with comments | « ui/compositor/layer_unittest.cc ('k') | ui/compositor/test/draw_waiter_for_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698