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

Unified Diff: ui/gl/gl_image_android_native_buffer.cc

Issue 301793003: During image destroy, delete textures only if we have a GL context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Destroy GLImage during ContextGroup destroy 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: ui/gl/gl_image_android_native_buffer.cc
diff --git a/ui/gl/gl_image_android_native_buffer.cc b/ui/gl/gl_image_android_native_buffer.cc
index 6d11497b2a31ccd36bef9b7231917b194b89438d..81d7492fe5f0a4db0e2c1ae7e6978c1a36850928 100644
--- a/ui/gl/gl_image_android_native_buffer.cc
+++ b/ui/gl/gl_image_android_native_buffer.cc
@@ -17,7 +17,9 @@ GLImageAndroidNativeBuffer::GLImageAndroidNativeBuffer(gfx::Size size)
egl_image_for_unbind_(EGL_NO_IMAGE_KHR),
texture_id_for_unbind_(0) {}
-GLImageAndroidNativeBuffer::~GLImageAndroidNativeBuffer() { Destroy(); }
+GLImageAndroidNativeBuffer::~GLImageAndroidNativeBuffer() {
+ Destroy(false);
reveman 2014/05/29 16:30:34 I don't think any GLImage dtor should be calling D
+}
bool GLImageAndroidNativeBuffer::Initialize(gfx::GpuMemoryBufferHandle buffer) {
DCHECK(buffer.native_buffer);
@@ -27,7 +29,7 @@ bool GLImageAndroidNativeBuffer::Initialize(gfx::GpuMemoryBufferHandle buffer) {
EGL_NATIVE_BUFFER_ANDROID, buffer.native_buffer, attrs);
}
-void GLImageAndroidNativeBuffer::Destroy() {
+void GLImageAndroidNativeBuffer::Destroy(bool have_context) {
if (egl_image_for_unbind_ != EGL_NO_IMAGE_KHR) {
eglDestroyImageKHR(GLSurfaceEGL::GetHardwareDisplay(),
egl_image_for_unbind_);
@@ -38,7 +40,7 @@ void GLImageAndroidNativeBuffer::Destroy() {
texture_id_for_unbind_ = 0;
}
- GLImageEGL::Destroy();
+ GLImageEGL::Destroy(have_context);
}
bool GLImageAndroidNativeBuffer::BindTexImage(unsigned target) {

Powered by Google App Engine
This is Rietveld 408576698