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; |