diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-18 03:32:45 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-18 03:32:45 +0000 |
commit | 4b3c88a4b3a871e1b4010002752087bed5e98717 (patch) | |
tree | 6be898fb31c754198ba884596edc9c5b3002764c /android_webview | |
parent | 23330db782cd3bb9fc8dc40894436c39eea8c30f (diff) | |
download | chromium_src-4b3c88a4b3a871e1b4010002752087bed5e98717.zip chromium_src-4b3c88a4b3a871e1b4010002752087bed5e98717.tar.gz chromium_src-4b3c88a4b3a871e1b4010002752087bed5e98717.tar.bz2 |
[AndroidWebView] Add ScopedAppGLStateRestore::CallMode
There are different GL state save/restore expectations between DrawGL
and OnDetachFromWindow, which do cause downstream crashes.
This is one workaround while we are still unconditionally restoring
chromium GL state and issuing GL outside of draw.
BUG=internal b/9788176
NOTRY=true
R=joth@chromium.org
Review URL: https://codereview.chromium.org/19689003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/browser/in_process_view_renderer.cc | 5 | ||||
-rw-r--r-- | android_webview/browser/scoped_app_gl_state_restore.cc | 24 | ||||
-rw-r--r-- | android_webview/browser/scoped_app_gl_state_restore.h | 7 |
3 files changed, 29 insertions, 7 deletions
diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc index ee4c201..55b3aa6 100644 --- a/android_webview/browser/in_process_view_renderer.cc +++ b/android_webview/browser/in_process_view_renderer.cc @@ -224,7 +224,7 @@ void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) { return; } - ScopedAppGLStateRestore state_restore; + ScopedAppGLStateRestore state_restore(ScopedAppGLStateRestore::MODE_DRAW); if (attached_to_window_ && compositor_ && !hardware_initialized_) { TRACE_EVENT0("android_webview", "InitializeHwDraw"); @@ -449,7 +449,8 @@ void InProcessViewRenderer::OnDetachedFromWindow() { if (hardware_initialized_) { DCHECK(compositor_); - ScopedAppGLStateRestore state_restore; + ScopedAppGLStateRestore state_restore( + ScopedAppGLStateRestore::MODE_DETACH_FROM_WINDOW); compositor_->ReleaseHwDraw(); hardware_initialized_ = false; } diff --git a/android_webview/browser/scoped_app_gl_state_restore.cc b/android_webview/browser/scoped_app_gl_state_restore.cc index 87f888e..70e5075 100644 --- a/android_webview/browser/scoped_app_gl_state_restore.cc +++ b/android_webview/browser/scoped_app_gl_state_restore.cc @@ -42,15 +42,31 @@ void MakeAppContextCurrent() { } // namespace -ScopedAppGLStateRestore::ScopedAppGLStateRestore() { +ScopedAppGLStateRestore::ScopedAppGLStateRestore(CallMode mode) { MakeAppContextCurrent(); - // TODO(boliu): These should always be 0 in draw case, but not necessarily in - // OnDetachFromWindow or other cases. When we have guarantee that we are no - // longer making GL calls outside of draw, DCHECK these are 0 in draw case. glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &vertex_array_buffer_binding_); glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &index_array_buffer_binding_); + switch(mode) { + case MODE_DRAW: + // TODO(boliu): These should always be 0 in draw case. When we have + // guarantee that we are no longer making GL calls outside of draw, DCHECK + // these are 0 here. + LOG_IF(ERROR, vertex_array_buffer_binding_) + << "GL_ARRAY_BUFFER_BINDING not zero in draw: " + << vertex_array_buffer_binding_; + LOG_IF(ERROR, index_array_buffer_binding_) + << "GL_ELEMENT_ARRAY_BUFFER_BINDING not zero in draw: " + << index_array_buffer_binding_; + + vertex_array_buffer_binding_ = 0; + index_array_buffer_binding_ = 0; + break; + case MODE_DETACH_FROM_WINDOW: + break; + } + glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_external_oes_binding_); glGetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment_); diff --git a/android_webview/browser/scoped_app_gl_state_restore.h b/android_webview/browser/scoped_app_gl_state_restore.h index a74ffb9..c8eb0ba 100644 --- a/android_webview/browser/scoped_app_gl_state_restore.h +++ b/android_webview/browser/scoped_app_gl_state_restore.h @@ -14,7 +14,12 @@ namespace android_webview { // This class is not thread safe and should only be used on the UI thread. class ScopedAppGLStateRestore { public: - ScopedAppGLStateRestore(); + enum CallMode { + MODE_DRAW, + MODE_DETACH_FROM_WINDOW + }; + + ScopedAppGLStateRestore(CallMode mode); ~ScopedAppGLStateRestore(); private: |