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

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: Use ScopedMakeCurrent. 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 SetCurrent(NULL, NULL); 196 SetCurrent(NULL, NULL);
197 CGLSetCurrentContext(NULL); 197 CGLSetCurrentContext(NULL);
198 } 198 }
199 199
200 bool GLContextCGL::IsCurrent(GLSurface* surface) { 200 bool GLContextCGL::IsCurrent(GLSurface* surface) {
201 bool native_context_is_current = CGLGetCurrentContext() == context_; 201 bool native_context_is_current = CGLGetCurrentContext() == context_;
202 202
203 // If our context is current then our notion of which GLContext is 203 // If our context is current then our notion of which GLContext is
204 // current must be correct. On the other hand, third-party code 204 // current must be correct. On the other hand, third-party code
205 // using OpenGL might change the current context. 205 // using OpenGL might change the current context.
206 DCHECK(!native_context_is_current || (GetCurrent() == this)); 206 DCHECK(!native_context_is_current || (GetRealCurrent() == this));
207 207
208 if (!native_context_is_current) 208 if (!native_context_is_current)
209 return false; 209 return false;
210 210
211 return true; 211 return true;
212 } 212 }
213 213
214 void* GLContextCGL::GetHandle() { 214 void* GLContextCGL::GetHandle() {
215 return context_; 215 return context_;
216 } 216 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 GpuPreference GLContextCGL::GetGpuPreference() { 285 GpuPreference GLContextCGL::GetGpuPreference() {
286 return gpu_preference_; 286 return gpu_preference_;
287 } 287 }
288 288
289 void ScopedCGLDestroyRendererInfo::operator()(CGLRendererInfoObj x) const { 289 void ScopedCGLDestroyRendererInfo::operator()(CGLRendererInfoObj x) const {
290 CGLDestroyRendererInfo(x); 290 CGLDestroyRendererInfo(x);
291 } 291 }
292 292
293 } // namespace gfx 293 } // 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