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

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: Move ImageManager destroy to GPUChannel + review comments 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
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
« ui/gl/gl_image_glx.cc ('K') | « ui/gl/gl_image_shm.h ('k') | ui/gl/gl_image_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698