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

Side by Side Diff: ui/gl/gl_context_glx.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 extern "C" { 5 extern "C" {
6 #include <X11/Xlib.h> 6 #include <X11/Xlib.h>
7 } 7 }
8 8
9 #include "ui/gl/gl_context_glx.h" 9 #include "ui/gl/gl_context_glx.h"
10 10
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 LOG(ERROR) << "glXMakeCurrent failed in ReleaseCurrent"; 150 LOG(ERROR) << "glXMakeCurrent failed in ReleaseCurrent";
151 } 151 }
152 152
153 bool GLContextGLX::IsCurrent(GLSurface* surface) { 153 bool GLContextGLX::IsCurrent(GLSurface* surface) {
154 bool native_context_is_current = 154 bool native_context_is_current =
155 glXGetCurrentContext() == static_cast<GLXContext>(context_); 155 glXGetCurrentContext() == static_cast<GLXContext>(context_);
156 156
157 // If our context is current then our notion of which GLContext is 157 // If our context is current then our notion of which GLContext is
158 // current must be correct. On the other hand, third-party code 158 // current must be correct. On the other hand, third-party code
159 // using OpenGL might change the current context. 159 // using OpenGL might change the current context.
160 DCHECK(!native_context_is_current || (GetCurrent() == this)); 160 DCHECK(!native_context_is_current || (GetRealCurrent() == this));
161 161
162 if (!native_context_is_current) 162 if (!native_context_is_current)
163 return false; 163 return false;
164 164
165 if (surface) { 165 if (surface) {
166 if (glXGetCurrentDrawable() != 166 if (glXGetCurrentDrawable() !=
167 reinterpret_cast<GLXDrawable>(surface->GetHandle())) { 167 reinterpret_cast<GLXDrawable>(surface->GetHandle())) {
168 return false; 168 return false;
169 } 169 }
170 } 170 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { 220 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() {
221 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); 221 return GLSurfaceGLX::IsCreateContextRobustnessSupported();
222 } 222 }
223 223
224 GLContextGLX::~GLContextGLX() { 224 GLContextGLX::~GLContextGLX() {
225 Destroy(); 225 Destroy();
226 } 226 }
227 227
228 } // namespace gfx 228 } // namespace gfx
OLDNEW
« ui/gl/gl_context.cc ('K') | « ui/gl/gl_context_egl.cc ('k') | ui/gl/gl_context_osmesa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698