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

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

Issue 2880013: Free the resources used by a context group. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/shader_manager.h" 5 #include "gpu/command_buffer/service/shader_manager.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 7
8 namespace gpu { 8 namespace gpu {
9 namespace gles2 { 9 namespace gles2 {
10 10
11 ShaderManager::~ShaderManager() {
12 DCHECK(shader_infos_.empty());
13 }
14
15 void ShaderManager::Destroy(bool have_context) {
16 while (!shader_infos_.empty()) {
17 if (have_context) {
18 ShaderInfo* info = shader_infos_.begin()->second;
19 if (!info->IsDeleted()) {
20 glDeleteShader(info->service_id());
21 info->MarkAsDeleted();
22 }
23 }
24 shader_infos_.erase(shader_infos_.begin());
25 }
26 }
27
11 void ShaderManager::CreateShaderInfo(GLuint client_id, 28 void ShaderManager::CreateShaderInfo(GLuint client_id,
12 GLuint service_id, 29 GLuint service_id,
13 GLenum shader_type) { 30 GLenum shader_type) {
14 std::pair<ShaderInfoMap::iterator, bool> result = 31 std::pair<ShaderInfoMap::iterator, bool> result =
15 shader_infos_.insert(std::make_pair( 32 shader_infos_.insert(std::make_pair(
16 client_id, ShaderInfo::Ref(new ShaderInfo(service_id, shader_type)))); 33 client_id, ShaderInfo::Ref(new ShaderInfo(service_id, shader_type))));
17 DCHECK(result.second); 34 DCHECK(result.second);
18 } 35 }
19 36
20 ShaderManager::ShaderInfo* ShaderManager::GetShaderInfo(GLuint client_id) { 37 ShaderManager::ShaderInfo* ShaderManager::GetShaderInfo(GLuint client_id) {
(...skipping 18 matching lines...) Expand all
39 return true; 56 return true;
40 } 57 }
41 } 58 }
42 return false; 59 return false;
43 } 60 }
44 61
45 } // namespace gles2 62 } // namespace gles2
46 } // namespace gpu 63 } // namespace gpu
47 64
48 65
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/shader_manager.h ('k') | gpu/command_buffer/service/shader_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698