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

Side by Side 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: rebased to ToT 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/image_manager.h" 5 #include "gpu/command_buffer/service/image_manager.h"
6 6
7 #include "ui/gl/gl_image.h" 7 #include "ui/gl/gl_image.h"
8 8
9 namespace gpu { 9 namespace gpu {
10 namespace gles2 { 10 namespace gles2 {
11 11
12 ImageManager::ImageManager() { 12 ImageManager::ImageManager() {
13 } 13 }
14 14
15 ImageManager::~ImageManager() { 15 ImageManager::~ImageManager() {
16 } 16 }
17 17
18 void ImageManager::Destroy(bool have_context) {
19 for (GLImageMap::const_iterator iter = images_.begin(); iter != images_.end();
20 ++iter)
21 iter->second.get()->Destroy(have_context);
22 images_.clear();
23 }
24
18 void ImageManager::AddImage(gfx::GLImage* image, int32 service_id) { 25 void ImageManager::AddImage(gfx::GLImage* image, int32 service_id) {
19 images_[service_id] = image; 26 images_[service_id] = image;
20 } 27 }
21 28
22 void ImageManager::RemoveImage(int32 service_id) { 29 void ImageManager::RemoveImage(int32 service_id) {
23 images_.erase(service_id); 30 images_.erase(service_id);
reveman 2014/07/21 15:12:24 when is GLImage::Destroy called for an image that
sohanjg 2014/07/21 15:39:51 hmm..GLImage::Destroy, will be invoked when cmd bu
reveman 2014/07/21 15:59:10 It's not going to destroy this image as you're rem
24 } 31 }
25 32
26 gfx::GLImage* ImageManager::LookupImage(int32 service_id) { 33 gfx::GLImage* ImageManager::LookupImage(int32 service_id) {
27 GLImageMap::const_iterator iter = images_.find(service_id); 34 GLImageMap::const_iterator iter = images_.find(service_id);
28 if (iter != images_.end()) 35 if (iter != images_.end())
29 return iter->second.get(); 36 return iter->second.get();
30 37
31 return NULL; 38 return NULL;
32 } 39 }
33 40
34 } // namespace gles2 41 } // namespace gles2
35 } // namespace gpu 42 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698