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

Side by Side Diff: ui/base/compositor/begin_frame_manager.h

Issue 423773002: Unified BeginFrame scheduling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working on aura with --enable-begin-frame-scheduling Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
(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 cc {
15 struct BeginFrameArgs;
16 }
17
18 namespace ui {
19
20 // This class delivers a BeginFrame request from the Compositor to its
21 // observers. It also handles next BeginFrame scheduling via its delegate.
22 // Browser compositor will own this.
23 // This class will be run only on main thread.
24 class UI_BASE_EXPORT BeginFrameManager : public base::NonThreadSafe {
25 public:
26 // Subclass should deliver BeginFrame to its client.
27 class Observer {
28 public:
29 virtual void OnSendBeginFrame(const cc::BeginFrameArgs& args) = 0;
30 };
31
32 // Subclass should implement howto schedule next BeginFrame.
33 class Delegate {
34 public:
35 virtual void RequestBeginFrame() = 0;
36 };
37
38 BeginFrameManager(Delegate* delegate);
39 ~BeginFrameManager();
40
41 void SendBeginFrame(const cc::BeginFrameArgs& args);
42 void RequestBeginFrame() const;
43
44 void AddObserver(Observer* observer);
45 void RemoveObserver(Observer* observer);
46
47 private:
48 // Not owned by this class.
49 Delegate* delegate_;
50 ObserverList<BeginFrameManager::Observer> observer_list_;
51
52 DISALLOW_COPY_AND_ASSIGN(BeginFrameManager);
53 };
54
55 } // namespace ui
56
57 #endif // UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698