Chromium Code Reviews| Index: ui/gl/gl_image_memory.cc |
| diff --git a/ui/gl/gl_image_memory.cc b/ui/gl/gl_image_memory.cc |
| index 5d0f901c812fde7d71819ac47306cbbb75994256..5747ccfb57b91d91be8491357220c72eb3d039c3 100644 |
| --- a/ui/gl/gl_image_memory.cc |
| +++ b/ui/gl/gl_image_memory.cc |
| @@ -81,6 +81,11 @@ GLImageMemory::GLImageMemory(const gfx::Size& size, unsigned internalformat) |
| } |
| GLImageMemory::~GLImageMemory() { |
| +#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 GLImageMemory::Initialize(const unsigned char* memory) { |
| @@ -95,7 +100,7 @@ bool GLImageMemory::Initialize(const unsigned char* memory) { |
| return true; |
| } |
| -void GLImageMemory::Destroy() { |
| +void GLImageMemory::Destroy(bool have_context) { |
| #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| defined(USE_OZONE) |
| if (egl_image_ != EGL_NO_IMAGE_KHR) { |
| @@ -104,7 +109,8 @@ void GLImageMemory::Destroy() { |
| } |
| if (egl_texture_id_) { |
| - glDeleteTextures(1, &egl_texture_id_); |
| + if (have_context) |
| + glDeleteTextures(1, &egl_texture_id_); |
| egl_texture_id_ = 0u; |
| } |
| #endif |
| @@ -118,7 +124,10 @@ gfx::Size GLImageMemory::GetSize() { |
| bool GLImageMemory::BindTexImage(unsigned target) { |
| TRACE_EVENT0("gpu", "GLImageMemory::BindTexImage"); |
| - DCHECK(memory_); |
| + if (!memory_) { |
| + LOG(ERROR) << "Uninitialized image cannot be bound to texture"; |
| + return false; |
| + } |
|
reveman
2014/07/25 19:00:23
Let's keep this as before. Sorry.
sohanjg
2014/07/26 10:42:23
Done.
|
| #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| defined(USE_OZONE) |
| if (target == GL_TEXTURE_EXTERNAL_OES) { |