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

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: WIP in mac and android 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 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..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;

Powered by Google App Engine
This is Rietveld 408576698