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..10c84568f4899eb78ee0585be2a1532135935a05 100644 |
| --- a/ui/gl/gl_image_shm.cc |
| +++ b/ui/gl/gl_image_shm.cc |
| @@ -79,7 +79,10 @@ GLImageShm::GLImageShm(gfx::Size size, unsigned internalformat) |
| { |
| } |
| -GLImageShm::~GLImageShm() { Destroy(); } |
| +GLImageShm::~GLImageShm() { |
|
reveman
2014/06/02 14:34:47
Please add a DCHECK(!shared_memory_) here too.
sohanjg
2014/06/02 15:39:10
Done.
|
| + DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_); |
| + DCHECK_EQ(0u, egl_texture_id_); |
|
reveman
2014/06/02 14:34:47
These DCHECKs need to be ifdef-ed.
sohanjg
2014/06/02 15:39:10
Done.
|
| +} |
| bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) { |
| if (!ValidFormat(internalformat_)) { |
| @@ -105,7 +108,7 @@ bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) { |
| return true; |
| } |
| -void GLImageShm::Destroy() { |
| +void GLImageShm::Destroy(bool have_context) { |
| #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| defined(USE_OZONE) |
| if (egl_image_ != EGL_NO_IMAGE_KHR) { |
| @@ -114,10 +117,12 @@ 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 |
| + shared_memory_.reset(); |
|
reveman
2014/06/02 14:34:47
nit: move this above the ifdef
sohanjg
2014/06/02 15:39:10
Done.
|
| } |
| gfx::Size GLImageShm::GetSize() { return size_; } |