Chromium Code Reviews| 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::TimeDelta interval) = 0; | |
| 27 }; | |
| 28 | |
| 29 // Subclass should implement howto schedule next BeginFrame. | |
| 30 class Delegate { | |
| 31 public: | |
| 32 virtual void RequestBeginFrame() = 0; | |
| 33 }; | |
| 34 | |
| 35 BeginFrameManager(); | |
| 36 ~BeginFrameManager(); | |
| 37 | |
| 38 void SendBeginFrame(base::TimeTicks timebase, base::TimeDelta interval); | |
|
brianderson
2014/07/28 21:13:47
Would BeginFrameArgs work better than timebase+int
simonhong
2014/07/28 23:37:40
IMO, RWHV is more better place to calculate deadli
| |
| 39 void RequestBeginFrame() const; | |
| 40 | |
| 41 void AddObserver(Observer* observer); | |
| 42 void RemoveObserver(Observer* observer); | |
| 43 | |
| 44 void set_delegate(Delegate* delegate) { | |
| 45 delegate_ = delegate; | |
| 46 } | |
| 47 | |
| 48 private: | |
| 49 // Not owned by this class. | |
| 50 Delegate* delegate_; | |
| 51 ObserverList<BeginFrameManager::Observer> observer_list_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(BeginFrameManager); | |
| 54 }; | |
| 55 | |
| 56 } // namespace ui | |
| 57 | |
| 58 #endif // UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_ | |
| OLD | NEW |