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

Side by Side Diff: gpu/command_buffer/service/image_manager.cc

Issue 2449993005: Remove GLImage::Destroy(). (Closed)
Patch Set: One more Destroy() call on Mac. Created 4 years, 1 month 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/gl/gl_image.h" 10 #include "ui/gl/gl_image.h"
11 11
12 namespace gpu { 12 namespace gpu {
13 namespace gles2 { 13 namespace gles2 {
14 14
15 ImageManager::ImageManager() { 15 ImageManager::ImageManager() {
16 } 16 }
17 17
18 ImageManager::~ImageManager() { 18 ImageManager::~ImageManager() {
19 } 19 }
20 20
21 void ImageManager::Destroy(bool have_context) {
22 for (GLImageMap::const_iterator iter = images_.begin(); iter != images_.end();
23 ++iter)
24 iter->second.get()->Destroy(have_context);
25 images_.clear();
26 }
27
28 void ImageManager::AddImage(gl::GLImage* image, int32_t service_id) { 21 void ImageManager::AddImage(gl::GLImage* image, int32_t service_id) {
29 DCHECK(images_.find(service_id) == images_.end()); 22 DCHECK(images_.find(service_id) == images_.end());
30 images_[service_id] = image; 23 images_[service_id] = image;
31 } 24 }
32 25
33 void ImageManager::RemoveImage(int32_t service_id) { 26 void ImageManager::RemoveImage(int32_t service_id) {
34 GLImageMap::iterator iter = images_.find(service_id); 27 DCHECK(images_.find(service_id) != images_.end());
35 DCHECK(iter != images_.end()); 28 images_.erase(service_id);
36 iter->second.get()->Destroy(true);
37 images_.erase(iter);
38 } 29 }
39 30
40 gl::GLImage* ImageManager::LookupImage(int32_t service_id) { 31 gl::GLImage* ImageManager::LookupImage(int32_t service_id) {
41 GLImageMap::const_iterator iter = images_.find(service_id); 32 GLImageMap::const_iterator iter = images_.find(service_id);
42 if (iter != images_.end()) 33 if (iter != images_.end())
43 return iter->second.get(); 34 return iter->second.get();
44 35
45 return NULL; 36 return NULL;
46 } 37 }
47 38
48 } // namespace gles2 39 } // namespace gles2
49 } // namespace gpu 40 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/image_manager.h ('k') | gpu/command_buffer/service/texture_definition.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698