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

Side by Side Diff: ui/gl/gl_context_cgl.cc

Issue 15928002: GPU: Keep track of the last real context and real surface made current. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make GetRealCurrent protected. Created 7 years, 6 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 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 #include "ui/gl/gl_context_cgl.h" 5 #include "ui/gl/gl_context_cgl.h"
6 6
7 #include <OpenGL/CGLRenderers.h> 7 #include <OpenGL/CGLRenderers.h>
8 #include <OpenGL/CGLTypes.h> 8 #include <OpenGL/CGLTypes.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 SetCurrent(NULL, NULL); 208 SetCurrent(NULL, NULL);
209 CGLSetCurrentContext(NULL); 209 CGLSetCurrentContext(NULL);
210 } 210 }
211 211
212 bool GLContextCGL::IsCurrent(GLSurface* surface) { 212 bool GLContextCGL::IsCurrent(GLSurface* surface) {
213 bool native_context_is_current = CGLGetCurrentContext() == context_; 213 bool native_context_is_current = CGLGetCurrentContext() == context_;
214 214
215 // If our context is current then our notion of which GLContext is 215 // If our context is current then our notion of which GLContext is
216 // current must be correct. On the other hand, third-party code 216 // current must be correct. On the other hand, third-party code
217 // using OpenGL might change the current context. 217 // using OpenGL might change the current context.
218 DCHECK(!native_context_is_current || (GetCurrent() == this)); 218 DCHECK(!native_context_is_current || (GetRealCurrent() == this));
219 219
220 if (!native_context_is_current) 220 if (!native_context_is_current)
221 return false; 221 return false;
222 222
223 return true; 223 return true;
224 } 224 }
225 225
226 void* GLContextCGL::GetHandle() { 226 void* GLContextCGL::GetHandle() {
227 return context_; 227 return context_;
228 } 228 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 GLContextCGL::~GLContextCGL() { 294 GLContextCGL::~GLContextCGL() {
295 Destroy(); 295 Destroy();
296 } 296 }
297 297
298 GpuPreference GLContextCGL::GetGpuPreference() { 298 GpuPreference GLContextCGL::GetGpuPreference() {
299 return gpu_preference_; 299 return gpu_preference_;
300 } 300 }
301 301
302 } // namespace gfx 302 } // namespace gfx
OLDNEW
« ui/gl/gl_context.cc ('K') | « ui/gl/gl_context.cc ('k') | ui/gl/gl_context_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698