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

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: Destroy GLImage during ContextGroup destroy 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..68cd82c131d1ba748228060b1dc0277fb66b0de8 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"
reveman 2014/05/29 16:30:34 do we need this?
#include "ui/gl/scoped_binders.h"
#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
@@ -79,7 +80,8 @@ GLImageShm::GLImageShm(gfx::Size size, unsigned internalformat)
{
}
-GLImageShm::~GLImageShm() { Destroy(); }
+GLImageShm::~GLImageShm() {
reveman 2014/05/29 16:30:34 Verify that Destroy has been called.
+}
bool GLImageShm::Initialize(gfx::GpuMemoryBufferHandle buffer) {
if (!ValidFormat(internalformat_)) {
@@ -105,7 +107,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) {
@@ -113,7 +115,7 @@ void GLImageShm::Destroy() {
egl_image_ = EGL_NO_IMAGE_KHR;
}
- if (egl_texture_id_) {
+ if (egl_texture_id_ && have_context) {
reveman 2014/05/29 16:30:34 I think you should set egl_texture_id_ to 0 even i
glDeleteTextures(1, &egl_texture_id_);
egl_texture_id_ = 0u;
}

Powered by Google App Engine
This is Rietveld 408576698