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

Side by Side Diff: ui/gl/gl_surface.h

Issue 11359114: Use GLX_SGI_video_sync to get a vblank signal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "" Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GL_GL_SURFACE_H_ 5 #ifndef UI_GL_GL_SURFACE_H_
6 #define UI_GL_GL_SURFACE_H_ 6 #define UI_GL_GL_SURFACE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h"
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 #include "build/build_config.h" 12 #include "build/build_config.h"
12 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
13 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
14 #include "ui/gl/gl_export.h" 15 #include "ui/gl/gl_export.h"
15 16
16 namespace base { 17 namespace base {
17 class TimeDelta; 18 class TimeDelta;
18 class TimeTicks; 19 class TimeTicks;
19 } 20 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Get the platform specific display on which this surface resides, if 101 // Get the platform specific display on which this surface resides, if
101 // available. 102 // available.
102 virtual void* GetDisplay(); 103 virtual void* GetDisplay();
103 104
104 // Get the platfrom specific configuration for this surface, if available. 105 // Get the platfrom specific configuration for this surface, if available.
105 virtual void* GetConfig(); 106 virtual void* GetConfig();
106 107
107 // Get the GL pixel format of the surface, if available. 108 // Get the GL pixel format of the surface, if available.
108 virtual unsigned GetFormat(); 109 virtual unsigned GetFormat();
109 110
111 typedef base::Callback<void(const base::TimeTicks timebase,
112 const base::TimeDelta interval)>
113 UpdateVSyncCallback;
114
110 // Get the time of the most recent screen refresh, along with the time 115 // Get the time of the most recent screen refresh, along with the time
111 // between consecutive refreshes. Returns false when these values are 116 // between consecutive refreshes. The callback is called as soon as
112 // unavailable. 117 // the data is available (possibly never). The callback will not be called
113 virtual bool GetVSyncParameters(base::TimeTicks* timebase, 118 // 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.
114 base::TimeDelta* interval); 119 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback);
115 120
116 // Create a GL surface that renders directly to a view. 121 // Create a GL surface that renders directly to a view.
117 static scoped_refptr<GLSurface> CreateViewGLSurface( 122 static scoped_refptr<GLSurface> CreateViewGLSurface(
118 bool software, 123 bool software,
119 gfx::AcceleratedWidget window); 124 gfx::AcceleratedWidget window);
120 125
121 // Create a GL surface used for offscreen rendering. 126 // Create a GL surface used for offscreen rendering.
122 static scoped_refptr<GLSurface> CreateOffscreenGLSurface( 127 static scoped_refptr<GLSurface> CreateOffscreenGLSurface(
123 bool software, 128 bool software,
124 const gfx::Size& size); 129 const gfx::Size& size);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 virtual gfx::Size GetSize() OVERRIDE; 162 virtual gfx::Size GetSize() OVERRIDE;
158 virtual void* GetHandle() OVERRIDE; 163 virtual void* GetHandle() OVERRIDE;
159 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 164 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
160 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; 165 virtual bool OnMakeCurrent(GLContext* context) OVERRIDE;
161 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; 166 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE;
162 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; 167 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
163 virtual void* GetShareHandle() OVERRIDE; 168 virtual void* GetShareHandle() OVERRIDE;
164 virtual void* GetDisplay() OVERRIDE; 169 virtual void* GetDisplay() OVERRIDE;
165 virtual void* GetConfig() OVERRIDE; 170 virtual void* GetConfig() OVERRIDE;
166 virtual unsigned GetFormat() OVERRIDE; 171 virtual unsigned GetFormat() OVERRIDE;
167 virtual bool GetVSyncParameters(base::TimeTicks* timebase, 172 virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) OVERRIDE;
168 base::TimeDelta* interval) OVERRIDE;
169 173
170 GLSurface* surface() const { return surface_.get(); } 174 GLSurface* surface() const { return surface_.get(); }
171 175
172 protected: 176 protected:
173 virtual ~GLSurfaceAdapter(); 177 virtual ~GLSurfaceAdapter();
174 178
175 private: 179 private:
176 scoped_refptr<GLSurface> surface_; 180 scoped_refptr<GLSurface> surface_;
177 181
178 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter); 182 DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter);
179 }; 183 };
180 184
181 } // namespace gfx 185 } // namespace gfx
182 186
183 #endif // UI_GL_GL_SURFACE_H_ 187 #endif // UI_GL_GL_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698