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

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: change destroy flow for all GLImage types. 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..20001f268dfbb00f5226fa66cc139d514d52be22 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() {
+ DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_);
+ DCHECK_EQ(0u, egl_texture_id_);
+}
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_);
egl_texture_id_ = 0u;
+ if (have_context)
+ glDeleteTextures(1, &egl_texture_id_);
reveman 2014/05/31 05:05:06 this doesn't do the right thing as you set it to 0
sohanjg 2014/06/02 13:59:42 Done.
}
#endif
+ shared_memory_.reset();
}
gfx::Size GLImageShm::GetSize() { return size_; }

Powered by Google App Engine
This is Rietveld 408576698