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

Unified 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: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/compositor/begin_frame_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/compositor/begin_frame_manager.h
diff --git a/ui/base/compositor/begin_frame_manager.h b/ui/base/compositor/begin_frame_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..8cb95a3f8c52b4ada44583c2505833e49fbf1a02
--- /dev/null
+++ b/ui/base/compositor/begin_frame_manager.h
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_
+#define UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_
+
+#include "base/basictypes.h"
+#include "base/observer_list.h"
+#include "base/threading/non_thread_safe.h"
+#include "base/time/time.h"
+#include "ui/base/ui_base_export.h"
+
+namespace ui {
+
+// This class delivers a BeginFrame request from the Compositor to its
+// observers. It also handles next BeginFrame scheduling via its delegate.
+// Browser compositor will own this.
+// This class will be run only on main thread.
+class UI_BASE_EXPORT BeginFrameManager : public base::NonThreadSafe {
+ public:
+ // Subclass should deliver BeginFrame to its client.
+ class Observer {
+ public:
+ virtual void OnSendBeginFrame(base::TimeTicks timebase,
+ base::TimeDelta interval) = 0;
+ };
+
+ // Subclass should implement howto schedule next BeginFrame.
+ class Delegate {
+ public:
+ virtual void RequestBeginFrame() = 0;
+ };
+
+ BeginFrameManager();
+ ~BeginFrameManager();
+
+ 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
+ void RequestBeginFrame() const;
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ void set_delegate(Delegate* delegate) {
+ delegate_ = delegate;
+ }
+
+ private:
+ // Not owned by this class.
+ Delegate* delegate_;
+ ObserverList<BeginFrameManager::Observer> observer_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(BeginFrameManager);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_COMPOSITOR_BEGIN_FRAME_MANAGER_H_
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/compositor/begin_frame_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698