Index: ui/gl/gl_gl_api_implementation.cc |
diff --git a/ui/gl/gl_gl_api_implementation.cc b/ui/gl/gl_gl_api_implementation.cc |
index f4dca224e2f884b91ddaed513c6f02542e951839..017e123eb1ff5f566031b9018a6cc2dff715090d 100644 |
--- a/ui/gl/gl_gl_api_implementation.cc |
+++ b/ui/gl/gl_gl_api_implementation.cc |
@@ -442,9 +442,14 @@ bool VirtualGLApi::MakeCurrent(GLContext* virtual_context, GLSurface* surface) { |
DCHECK(virtual_context->IsCurrent(surface)); |
if (switched_contexts || virtual_context != current_context_) { |
- // There should be no errors from the previous context leaking into the |
- // new context. |
- DCHECK_EQ(glGetErrorFn(), static_cast<GLenum>(GL_NO_ERROR)); |
+#if DCHECK_IS_ON |
+ GLenum error = glGetErrorFn(); |
+ // Accepting a context loss error here enables using debug mode to work on |
+ // context loss handling in virtual context mode. |
+ // There should be no other errors from the previous context leaking into |
+ // the new context. |
+ DCHECK(error == GL_NO_ERROR || error == GL_CONTEXT_LOST_KHR); |
+#endif |
// Set all state that is different from the real state |
GLApi* temp = GetCurrentGLApi(); |