OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_ | |
6 #define UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/observer_list.h" | |
10 #include "base/threading/non_thread_safe.h" | |
11 #include "base/time/time.h" | |
12 #include "ui/base/ui_base_export.h" | |
13 | |
14 namespace ui { | |
15 | |
16 // This class delivers a BeginFrame request from the Compositor to its | |
17 // observers. It also handles next BeginFrame scheduling via its delegate. | |
18 // Browser compositor will own this. | |
19 // This class will be run only on main thread. | |
20 class UI_BASE_EXPORT BeginFrameManager : public base::NonThreadSafe { | |
21 public: | |
22 // Subclass should deliver BeginFrame to its client. | |
23 class Observer { | |
24 public: | |
25 virtual void OnSendBeginFrame(base::TimeTicks timebase, | |
26 base::TimeTicks deadline, | |
27 base::TimeDelta interval) = 0; | |
28 }; | |
29 | |
30 // Subclass should implement howto schedule next BeginFrame. | |
31 class Delegate { | |
32 public: | |
33 virtual void RequestBeginFrame() = 0; | |
34 }; | |
35 | |
36 BeginFrameManager(); | |
37 ~BeginFrameManager(); | |
38 | |
39 void SendBeginFrame(base::TimeTicks frame_time, | |
brianderson
2014/07/30 19:44:29
Please use BeginFrameArgs instead.
simonhong
2014/07/31 00:18:03
Done.
| |
40 base::TimeTicks deadline, | |
41 base::TimeDelta interval); | |
42 void RequestBeginFrame() const; | |
43 | |
44 void AddObserver(Observer* observer); | |
45 void RemoveObserver(Observer* observer); | |
46 | |
47 void set_delegate(Delegate* delegate) { | |
48 delegate_ = delegate; | |
49 } | |
50 | |
51 private: | |
52 // Not owned by this class. | |
53 Delegate* delegate_; | |
54 ObserverList<BeginFrameManager::Observer> observer_list_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(BeginFrameManager); | |
57 }; | |
58 | |
59 } // namespace ui | |
60 | |
61 #endif // UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_ | |
OLD | NEW |