OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMPOSITOR_OBSERVER_H_ | 5 #ifndef UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_ |
6 #define UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_ | 6 #define UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_ |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "ui/compositor/compositor_export.h" | 9 #include "ui/compositor/compositor_export.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 class Compositor; | 13 class Compositor; |
14 | 14 |
15 // A compositor observer is notified when compositing completes. | 15 // A compositor observer is notified when compositing completes. |
16 class COMPOSITOR_EXPORT CompositorObserver { | 16 class COMPOSITOR_EXPORT CompositorObserver { |
17 public: | 17 public: |
18 CompositorObserver(); | |
19 | |
20 // A commit proxies information from the main thread to the compositor | 18 // A commit proxies information from the main thread to the compositor |
21 // thread. It typically happens when some state changes that will require a | 19 // thread. It typically happens when some state changes that will require a |
22 // composite. In the multi-threaded case, many commits may happen between | 20 // composite. In the multi-threaded case, many commits may happen between |
23 // two successive composites. In the single-threaded, a single commit | 21 // two successive composites. In the single-threaded, a single commit |
24 // between two composites (just before the composite as part of the | 22 // between two composites (just before the composite as part of the |
25 // composite cycle). If the compositor is locked, it will not send this | 23 // composite cycle). If the compositor is locked, it will not send this |
26 // this signal. | 24 // this signal. |
27 virtual void OnCompositingDidCommit(Compositor* compositor) = 0; | 25 virtual void OnCompositingDidCommit(Compositor* compositor) = 0; |
28 | 26 |
29 // Called when compositing started: it has taken all the layer changes into | 27 // Called when compositing started: it has taken all the layer changes into |
30 // account and has issued the graphics commands. | 28 // account and has issued the graphics commands. |
31 virtual void OnCompositingStarted(Compositor* compositor, | 29 virtual void OnCompositingStarted(Compositor* compositor, |
32 base::TimeTicks start_time) = 0; | 30 base::TimeTicks start_time) = 0; |
33 | 31 |
34 // Called when compositing completes: the present to screen has completed. | 32 // Called when compositing completes: the present to screen has completed. |
35 virtual void OnCompositingEnded(Compositor* compositor) = 0; | 33 virtual void OnCompositingEnded(Compositor* compositor) = 0; |
36 | 34 |
37 // Called when compositing is aborted (e.g. lost graphics context). | 35 // Called when compositing is aborted (e.g. lost graphics context). |
38 virtual void OnCompositingAborted(Compositor* compositor) = 0; | 36 virtual void OnCompositingAborted(Compositor* compositor) = 0; |
39 | 37 |
40 // Called when the compositor lock state changes. | 38 // Called when the compositor lock state changes. |
41 virtual void OnCompositingLockStateChanged(Compositor* compositor) = 0; | 39 virtual void OnCompositingLockStateChanged(Compositor* compositor) = 0; |
42 | 40 |
43 protected: | 41 // Called at the top of the compositor's destructor, to give observers a |
44 #if defined(OS_MACOSX) | 42 // chance to remove themselves. |
45 // Debugging instrumentation for crbug.com/401630. | 43 virtual void OnCompositingShuttingDown(Compositor* compositor) = 0; |
46 // TODO(ccameron): remove this. | |
47 friend class Compositor; | |
48 int32 observing_count_; | |
49 #endif | |
50 | |
51 virtual ~CompositorObserver(); | |
52 }; | 44 }; |
53 | 45 |
54 } // namespace ui | 46 } // namespace ui |
55 | 47 |
56 #endif // UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_ | 48 #endif // UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_ |
OLD | NEW |