Chromium Code Reviews| 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..3cffcc4a4e0cd8cab12627ffb13708735d65c670 100644 |
| --- a/ui/gl/gl_image_android_native_buffer.cc |
| +++ b/ui/gl/gl_image_android_native_buffer.cc |
| @@ -17,7 +17,10 @@ GLImageAndroidNativeBuffer::GLImageAndroidNativeBuffer(gfx::Size size) |
| egl_image_for_unbind_(EGL_NO_IMAGE_KHR), |
| texture_id_for_unbind_(0) {} |
| -GLImageAndroidNativeBuffer::~GLImageAndroidNativeBuffer() { Destroy(); } |
| +GLImageAndroidNativeBuffer::~GLImageAndroidNativeBuffer() { |
| + DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_); |
| + DCHECK_EQ(0u, texture_id_for_unbind_); |
| +} |
| bool GLImageAndroidNativeBuffer::Initialize(gfx::GpuMemoryBufferHandle buffer) { |
| DCHECK(buffer.native_buffer); |
| @@ -27,18 +30,20 @@ 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_); |
| egl_image_for_unbind_ = EGL_NO_IMAGE_KHR; |
| } |
| + |
| if (texture_id_for_unbind_) { |
| - glDeleteTextures(1, &texture_id_for_unbind_); |
| - texture_id_for_unbind_ = 0; |
| + texture_id_for_unbind_ = 0u; |
| + if (have_context) |
| + glDeleteTextures(1, &texture_id_for_unbind_); |
|
reveman
2014/05/31 05:05:06
doesn't work as you set texture_id_for_unbind_ to
sohanjg
2014/06/02 13:59:42
Done.
|
| } |
| - GLImageEGL::Destroy(); |
| + GLImageEGL::Destroy(have_context); |
| } |
| bool GLImageAndroidNativeBuffer::BindTexImage(unsigned target) { |