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..b095b32f2f1e2b5f589e24e331a7373c4fb76c0e 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,7 +20,12 @@ namespace content { |
class DisplayLinkMac : public base::RefCounted<DisplayLinkMac> { |
public: |
- static scoped_refptr<DisplayLinkMac> GetForDisplay( |
+ class Observer { |
+ public: |
+ void OnVSync(base::TimeTicks timebase, base::TimeDelta interval) = 0; |
+ }; |
+ |
+ static scoped_refptr<DisplayLinkMac> GetForDisplay( |
CGDirectDisplayID display_id); |
// Get vsync scheduling parameters. |
@@ -27,6 +33,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 +74,8 @@ class DisplayLinkMac : public base::RefCounted<DisplayLinkMac> { |
// Lock for sharing data between UI thread and display-link thread. |
base::Lock lock_; |
+ base::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; |