Index: ui/gl/gl_surface.h |
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h |
index 56d8ae7a126015b3ecba46466c7c87afcc578dc2..0813d7df1a97658a78a8b034b71b0191d0763e85 100644 |
--- a/ui/gl/gl_surface.h |
+++ b/ui/gl/gl_surface.h |
@@ -7,6 +7,7 @@ |
#include <string> |
+#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
#include "build/build_config.h" |
#include "ui/gfx/native_widget_types.h" |
@@ -107,11 +108,17 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { |
// Get the GL pixel format of the surface, if available. |
virtual unsigned GetFormat(); |
+ typedef base::Callback<void(const base::TimeTicks timebase, |
+ const base::TimeDelta interval)> |
+ UpdateVSyncCallback; |
+ |
// Get the time of the most recent screen refresh, along with the time |
- // between consecutive refreshes. Returns false when these values are |
- // unavailable. |
- virtual bool GetVSyncParameters(base::TimeTicks* timebase, |
- base::TimeDelta* interval); |
+ // between consecutive refreshes. The callback is called as soon as |
+ // the data is available: it could be immediately from this method, |
+ // later via a PostTask to the current MessageLoop, or never (if we have |
+ // no data source). We provide the strong guarantee that the callback will |
+ // not be called once the instance of this class is destroyed. |
+ virtual void GetVSyncParameters(const UpdateVSyncCallback& callback); |
// Create a GL surface that renders directly to a view. |
static scoped_refptr<GLSurface> CreateViewGLSurface( |
@@ -164,8 +171,7 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface { |
virtual void* GetDisplay() OVERRIDE; |
virtual void* GetConfig() OVERRIDE; |
virtual unsigned GetFormat() OVERRIDE; |
- virtual bool GetVSyncParameters(base::TimeTicks* timebase, |
- base::TimeDelta* interval) OVERRIDE; |
+ virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) OVERRIDE; |
GLSurface* surface() const { return surface_.get(); } |