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

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

Issue 789823004: Added ability to force a GLContext SwapInterval to zero. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « gpu/command_buffer/service/gl_context_virtual.cc ('k') | ui/gl/gl_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CONTEXT_H_ 5 #ifndef UI_GL_GL_CONTEXT_H_
6 #define UI_GL_GL_CONTEXT_H_ 6 #define UI_GL_GL_CONTEXT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Get the underlying platform specific GL context "handle". 69 // Get the underlying platform specific GL context "handle".
70 virtual void* GetHandle() = 0; 70 virtual void* GetHandle() = 0;
71 71
72 // Gets the GLStateRestorer for the context. 72 // Gets the GLStateRestorer for the context.
73 GLStateRestorer* GetGLStateRestorer(); 73 GLStateRestorer* GetGLStateRestorer();
74 74
75 // Sets the GLStateRestorer for the context (takes ownership). 75 // Sets the GLStateRestorer for the context (takes ownership).
76 void SetGLStateRestorer(GLStateRestorer* state_restorer); 76 void SetGLStateRestorer(GLStateRestorer* state_restorer);
77 77
78 // Set swap interval. This context must be current. 78 // Set swap interval. This context must be current.
79 virtual void SetSwapInterval(int interval) = 0; 79 void SetSwapInterval(int interval);
80 void ForceSwapIntervalZero(bool force);
Ken Russell (switch to Gerrit) 2014/12/10 19:52:53 Please add a one-line comment about what the new f
80 81
81 // Returns space separated list of extensions. The context must be current. 82 // Returns space separated list of extensions. The context must be current.
82 virtual std::string GetExtensions(); 83 virtual std::string GetExtensions();
83 84
84 // Returns in bytes the total amount of GPU memory for the GPU which this 85 // Returns in bytes the total amount of GPU memory for the GPU which this
85 // context is currently rendering on. Returns false if no extension exists 86 // context is currently rendering on. Returns false if no extension exists
86 // to get the exact amount of GPU memory. 87 // to get the exact amount of GPU memory.
87 virtual bool GetTotalGpuMemory(size_t* bytes); 88 virtual bool GetTotalGpuMemory(size_t* bytes);
88 89
89 // Indicate that it is safe to force this context to switch GPUs, since 90 // Indicate that it is safe to force this context to switch GPUs, since
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 virtual void SetCurrent(GLSurface* surface); 163 virtual void SetCurrent(GLSurface* surface);
163 164
164 // Initialize function pointers to functions where the bound version depends 165 // Initialize function pointers to functions where the bound version depends
165 // on GL version or supported extensions. Should be called immediately after 166 // on GL version or supported extensions. Should be called immediately after
166 // this context is made current. 167 // this context is made current.
167 bool InitializeDynamicBindings(); 168 bool InitializeDynamicBindings();
168 169
169 // Returns the last real (non-virtual) GLContext made current. 170 // Returns the last real (non-virtual) GLContext made current.
170 static GLContext* GetRealCurrent(); 171 static GLContext* GetRealCurrent();
171 172
173 virtual void OnSetSwapInterval(int interval) = 0;
174
172 private: 175 private:
173 friend class base::RefCounted<GLContext>; 176 friend class base::RefCounted<GLContext>;
174 177
175 // For GetRealCurrent. 178 // For GetRealCurrent.
176 friend class VirtualGLApi; 179 friend class VirtualGLApi;
177 180
178 scoped_refptr<GLShareGroup> share_group_; 181 scoped_refptr<GLShareGroup> share_group_;
179 scoped_ptr<VirtualGLApi> virtual_gl_api_; 182 scoped_ptr<VirtualGLApi> virtual_gl_api_;
180 scoped_ptr<GLStateRestorer> state_restorer_; 183 scoped_ptr<GLStateRestorer> state_restorer_;
181 scoped_ptr<GLVersionInfo> version_info_; 184 scoped_ptr<GLVersionInfo> version_info_;
182 185
183 std::vector<scoped_refptr<FlushEvent> > flush_events_; 186 std::vector<scoped_refptr<FlushEvent> > flush_events_;
184 187
188 int swap_interval;
Zhenyao Mo 2014/12/10 01:02:00 end with a "_".
189 bool force_swap_interval_zero;
Zhenyao Mo 2014/12/10 01:02:00 end with a "_".
190
185 DISALLOW_COPY_AND_ASSIGN(GLContext); 191 DISALLOW_COPY_AND_ASSIGN(GLContext);
186 }; 192 };
187 193
188 class GL_EXPORT GLContextReal : public GLContext { 194 class GL_EXPORT GLContextReal : public GLContext {
189 public: 195 public:
190 explicit GLContextReal(GLShareGroup* share_group); 196 explicit GLContextReal(GLShareGroup* share_group);
191 197
192 protected: 198 protected:
193 ~GLContextReal() override; 199 ~GLContextReal() override;
194 200
195 void SetCurrent(GLSurface* surface) override; 201 void SetCurrent(GLSurface* surface) override;
196 202
197 private: 203 private:
198 DISALLOW_COPY_AND_ASSIGN(GLContextReal); 204 DISALLOW_COPY_AND_ASSIGN(GLContextReal);
199 }; 205 };
200 206
201 } // namespace gfx 207 } // namespace gfx
202 208
203 #endif // UI_GL_GL_CONTEXT_H_ 209 #endif // UI_GL_GL_CONTEXT_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gl_context_virtual.cc ('k') | ui/gl/gl_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698