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

Unified Diff: ui/gl/gl_image_shm.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: Created 6 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..148d16405c8d1faceea93fffce9fc22f3a2ed271 100644
--- a/ui/gl/gl_image_shm.cc
+++ b/ui/gl/gl_image_shm.cc
@@ -6,6 +6,7 @@
#include "base/debug/trace_event.h"
#include "base/process/process_handle.h"
+#include "ui/gl/gl_context.h"
#include "ui/gl/scoped_binders.h"
#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
@@ -112,8 +113,9 @@ void GLImageShm::Destroy() {
eglDestroyImageKHR(GLSurfaceEGL::GetHardwareDisplay(), egl_image_);
egl_image_ = EGL_NO_IMAGE_KHR;
}
-
- if (egl_texture_id_) {
+ GLContext* current_context = GLContext::GetCurrent();
+ if (egl_texture_id_ &&
+ (current_context && current_context->IsCurrent(NULL))) {
glDeleteTextures(1, &egl_texture_id_);
egl_texture_id_ = 0u;
}
sohanjg 2014/05/28 10:16:00 Wouldnt we end up leaking the texture if current_c
no sievers 2014/05/28 18:55:32 I think we should rather pass through the flag fro
reveman 2014/05/28 20:23:33 I think the problem is that GLImages are ref count
no sievers 2014/05/28 21:02:39 Should a gpu::gles2::Texture also call ReleaseTexI
reveman 2014/05/28 21:14:56 I don't think it does but it seems like a good ide
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698