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

Unified Diff: android_webview/browser/scoped_app_gl_state_restore.cc

Issue 266353003: aw: Ubercomp mega patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/scoped_app_gl_state_restore.cc
diff --git a/android_webview/browser/scoped_app_gl_state_restore.cc b/android_webview/browser/scoped_app_gl_state_restore.cc
index 71a5711a26f7967fdbef4830738e810a673b98c3..1f948d254cd38f668e50d89cda89c3a598789c6d 100644
--- a/android_webview/browser/scoped_app_gl_state_restore.cc
+++ b/android_webview/browser/scoped_app_gl_state_restore.cc
@@ -148,6 +148,11 @@ ScopedAppGLStateRestoreImpl::ScopedAppGLStateRestoreImpl(
TRACE_EVENT0("android_webview", "AppGLStateSave");
MakeAppContextCurrent();
+ // Ignore incoming GL errors.
+ GLenum error = glGetError();
+ DLOG_IF(WARNING, error != static_cast<GLenum>(GL_NO_ERROR))
+ << "Incoming GLError " << error;
+
if (!g_globals_initialized) {
g_globals_initialized = true;
@@ -251,12 +256,15 @@ ScopedAppGLStateRestoreImpl::ScopedAppGLStateRestoreImpl(
glGetVertexAttribfv(
i, GL_CURRENT_VERTEX_ATTRIB, vertex_attrib_[i].current_vertex_attrib);
}
+ DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR));
}
ScopedAppGLStateRestoreImpl::~ScopedAppGLStateRestoreImpl() {
TRACE_EVENT0("android_webview", "AppGLStateRestore");
MakeAppContextCurrent();
+ DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR));
+
glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_binding_ext_);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_array_buffer_binding_);
@@ -347,6 +355,11 @@ ScopedAppGLStateRestoreImpl::~ScopedAppGLStateRestoreImpl() {
GLEnableDisable(GL_STENCIL_TEST, stencil_test_);
glStencilFunc(stencil_func_, stencil_mask_, stencil_ref_);
+
+ // Do not leak GLError out of chromium.
+ GLenum error = glGetError();
+ DLOG_IF(WARNING, error != static_cast<GLenum>(GL_NO_ERROR))
+ << "Chromium produced GLError " << error;
}
} // namespace internal

Powered by Google App Engine
This is Rietveld 408576698