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

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

Issue 2859963002: Revert of Add more strict DCHECKs around context state. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | 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 #include "ui/gl/gl_context.h" 5 #include "ui/gl/gl_context.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (switched_real_contexts || !current_surface || 259 if (switched_real_contexts || !current_surface ||
260 !virtual_context->IsCurrent(surface)) { 260 !virtual_context->IsCurrent(surface)) {
261 if (!MakeCurrent(surface)) { 261 if (!MakeCurrent(surface)) {
262 return false; 262 return false;
263 } 263 }
264 } 264 }
265 } 265 }
266 266
267 DCHECK_EQ(this, GLContext::GetRealCurrent()); 267 DCHECK_EQ(this, GLContext::GetRealCurrent());
268 DCHECK(IsCurrent(NULL)); 268 DCHECK(IsCurrent(NULL));
269 DCHECK(virtual_context->IsCurrent(surface));
269 270
270 if (switched_real_contexts || virtual_context != current_virtual_context_) { 271 if (switched_real_contexts || virtual_context != current_virtual_context_) {
271 #if DCHECK_IS_ON() 272 #if DCHECK_IS_ON()
272 GLenum error = glGetError(); 273 GLenum error = glGetError();
273 // Accepting a context loss error here enables using debug mode to work on 274 // Accepting a context loss error here enables using debug mode to work on
274 // context loss handling in virtual context mode. 275 // context loss handling in virtual context mode.
275 // There should be no other errors from the previous context leaking into 276 // There should be no other errors from the previous context leaking into
276 // the new context. 277 // the new context.
277 DCHECK(error == GL_NO_ERROR || error == GL_CONTEXT_LOST_KHR) << 278 DCHECK(error == GL_NO_ERROR || error == GL_CONTEXT_LOST_KHR) <<
278 "GL error was: " << error; 279 "GL error was: " << error;
(...skipping 14 matching lines...) Expand all
293 (current_state && !switched_real_contexts) ? current_state : NULL); 294 (current_state && !switched_real_contexts) ? current_state : NULL);
294 } 295 }
295 current_virtual_context_ = virtual_context; 296 current_virtual_context_ = virtual_context;
296 } 297 }
297 298
298 virtual_context->SetCurrent(surface); 299 virtual_context->SetCurrent(surface);
299 if (!surface->OnMakeCurrent(virtual_context)) { 300 if (!surface->OnMakeCurrent(virtual_context)) {
300 LOG(ERROR) << "Could not make GLSurface current."; 301 LOG(ERROR) << "Could not make GLSurface current.";
301 return false; 302 return false;
302 } 303 }
303 DCHECK(virtual_context->IsCurrent(surface));
304 return true; 304 return true;
305 } 305 }
306 306
307 void GLContext::OnReleaseVirtuallyCurrent(GLContext* virtual_context) { 307 void GLContext::OnReleaseVirtuallyCurrent(GLContext* virtual_context) {
308 if (current_virtual_context_ == virtual_context) 308 if (current_virtual_context_ == virtual_context)
309 current_virtual_context_ = nullptr; 309 current_virtual_context_ = nullptr;
310 } 310 }
311 311
312 void GLContext::BindGLApi() { 312 void GLContext::BindGLApi() {
313 SetCurrentGL(GetCurrentGL()); 313 SetCurrentGL(GetCurrentGL());
(...skipping 21 matching lines...) Expand all
335 335
336 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context, 336 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context,
337 GLSurface* compatible_surface, 337 GLSurface* compatible_surface,
338 const GLContextAttribs& attribs) { 338 const GLContextAttribs& attribs) {
339 if (!context->Initialize(compatible_surface, attribs)) 339 if (!context->Initialize(compatible_surface, attribs))
340 return nullptr; 340 return nullptr;
341 return context; 341 return context;
342 } 342 }
343 343
344 } // namespace gl 344 } // namespace gl
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698