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

Unified Diff: content/browser/renderer_host/display_link_mac.h

Issue 423773002: Unified BeginFrame scheduling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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
Index: content/browser/renderer_host/display_link_mac.h
diff --git a/content/browser/renderer_host/display_link_mac.h b/content/browser/renderer_host/display_link_mac.h
index 1833f8f2d3fee60474bb9bb9e4655aaeb9d09169..555875422c9216da97dfd88537b6c23c9379e8f2 100644
--- a/content/browser/renderer_host/display_link_mac.h
+++ b/content/browser/renderer_host/display_link_mac.h
@@ -11,6 +11,7 @@
#include "base/lazy_instance.h"
#include "base/mac/scoped_typeref.h"
#include "base/memory/ref_counted.h"
+#include "base/observer_list.h"
#include "base/synchronization/lock.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -19,6 +20,12 @@ namespace content {
class DisplayLinkMac : public base::RefCounted<DisplayLinkMac> {
public:
+ class Observer {
+ public:
+ virtual void OnVSync(base::TimeTicks timebase,
+ base::TimeDelta interval) = 0;
+ };
+
static scoped_refptr<DisplayLinkMac> GetForDisplay(
CGDirectDisplayID display_id);
@@ -27,6 +34,9 @@ class DisplayLinkMac : public base::RefCounted<DisplayLinkMac> {
base::TimeTicks* timebase,
base::TimeDelta* interval);
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
private:
friend class base::RefCounted<DisplayLinkMac>;
@@ -65,6 +75,8 @@ class DisplayLinkMac : public base::RefCounted<DisplayLinkMac> {
// Lock for sharing data between UI thread and display-link thread.
base::Lock lock_;
+ ObserverList<Observer> observer_list_;
+
// Each display link instance consumes a non-negligible number of cycles, so
// make all display links on the same screen share the same object.
typedef std::map<CGDirectDisplayID, DisplayLinkMac*> DisplayMap;

Powered by Google App Engine
This is Rietveld 408576698