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

Unified Diff: gpu/command_buffer/service/image_manager.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
Index: gpu/command_buffer/service/image_manager.cc
diff --git a/gpu/command_buffer/service/image_manager.cc b/gpu/command_buffer/service/image_manager.cc
index 953e3bcb5731b3b98bfaeef8d6b7bae11c96d376..46438c7058a6efc48a8ab119c18530ed02f06359 100644
--- a/gpu/command_buffer/service/image_manager.cc
+++ b/gpu/command_buffer/service/image_manager.cc
@@ -4,6 +4,7 @@
#include "gpu/command_buffer/service/image_manager.h"
+#include "base/logging.h"
#include "ui/gl/gl_image.h"
namespace gpu {
@@ -15,12 +16,23 @@ ImageManager::ImageManager() {
ImageManager::~ImageManager() {
}
+void ImageManager::Destroy(bool have_context) {
+ for (GLImageMap::const_iterator iter = images_.begin(); iter != images_.end();
+ ++iter)
+ iter->second.get()->Destroy(have_context);
+ images_.clear();
+}
+
void ImageManager::AddImage(gfx::GLImage* image, int32 service_id) {
+ DCHECK(images_.find(service_id) == images_.end());
images_[service_id] = image;
}
void ImageManager::RemoveImage(int32 service_id) {
- images_.erase(service_id);
+ GLImageMap::iterator iter = images_.find(service_id);
+ DCHECK(iter != images_.end());
+ iter->second.get()->Destroy(true);
+ images_.erase(iter);
}
gfx::GLImage* ImageManager::LookupImage(int32 service_id) {
« no previous file with comments | « gpu/command_buffer/service/image_manager.h ('k') | gpu/command_buffer/service/stream_texture_manager_in_process_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698