Chromium Code Reviews| Index: ui/gl/gl_surface.h |
| diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h |
| index 56d8ae7a126015b3ecba46466c7c87afcc578dc2..e87801c9e7d669c55a3cf4e485f7e25cd0c37b0c 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,15 @@ 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 (possibly never). The callback will not be called |
| + // if the instance of this class is destroyed. |
|
piman
2012/11/08 23:51:16
Can you just mention that possibly the callback is
jonathan.backer
2012/11/09 17:02:35
Done.
|
| + virtual void GetVSyncParameters(const UpdateVSyncCallback& callback); |
| // Create a GL surface that renders directly to a view. |
| static scoped_refptr<GLSurface> CreateViewGLSurface( |
| @@ -164,8 +169,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(); } |