Chromium Code Reviews| Index: ui/gl/gl_image_shm.cc |
| diff --git a/ui/gl/gl_image_shm.cc b/ui/gl/gl_image_shm.cc |
| index 75ef453eade794fe846ed1548dbe90d7e56f6f3f..5ad3e83da69eb1d912b568d1b6bb54ef56853374 100644 |
| --- a/ui/gl/gl_image_shm.cc |
| +++ b/ui/gl/gl_image_shm.cc |
| @@ -79,7 +79,14 @@ GLImageShm::GLImageShm(gfx::Size size, unsigned internalformat) |
| { |
| } |
| -GLImageShm::~GLImageShm() { Destroy(); } |
| +GLImageShm::~GLImageShm() { |
| + DCHECK(!shared_memory_); |
| +#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| + defined(USE_OZONE) |
| + DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_); |
| + DCHECK_EQ(0u, egl_texture_id_); |
| +#endif |
| +} |
| bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) { |
| if (!ValidFormat(internalformat_)) { |
| @@ -105,7 +112,9 @@ bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) { |
| return true; |
| } |
| -void GLImageShm::Destroy() { |
| +void GLImageShm::Destroy(bool have_context) { |
| + shared_memory_.reset(); |
|
reveman
2014/06/02 16:45:29
nit: please be consistent with blank lines around
sohanjg
2014/06/03 05:48:33
Done.
|
| + |
| #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| defined(USE_OZONE) |
| if (egl_image_ != EGL_NO_IMAGE_KHR) { |
| @@ -114,7 +123,8 @@ void GLImageShm::Destroy() { |
| } |
| if (egl_texture_id_) { |
| - glDeleteTextures(1, &egl_texture_id_); |
| + if (have_context) |
| + glDeleteTextures(1, &egl_texture_id_); |
| egl_texture_id_ = 0u; |
| } |
| #endif |