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

Unified Diff: ui/gl/gl_image_memory.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: resolve android clang dbg build issue. Created 6 years, 5 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
« no previous file with comments | « ui/gl/gl_image_memory.h ('k') | ui/gl/gl_image_ref_counted_memory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5748b89452f1ebbc5f404124349a87e017c5ccde 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
« no previous file with comments | « ui/gl/gl_image_memory.h ('k') | ui/gl/gl_image_ref_counted_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698