OLD | NEW |
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/shader_manager.h" | 5 #include "gpu/command_buffer/service/shader_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 std::pair<ShaderMap::iterator, bool> result = | 110 std::pair<ShaderMap::iterator, bool> result = |
111 shaders_.insert(std::make_pair( | 111 shaders_.insert(std::make_pair( |
112 client_id, scoped_refptr<Shader>( | 112 client_id, scoped_refptr<Shader>( |
113 new Shader(service_id, shader_type)))); | 113 new Shader(service_id, shader_type)))); |
114 DCHECK(result.second); | 114 DCHECK(result.second); |
115 return result.first->second.get(); | 115 return result.first->second.get(); |
116 } | 116 } |
117 | 117 |
118 Shader* ShaderManager::GetShader(GLuint client_id) { | 118 Shader* ShaderManager::GetShader(GLuint client_id) { |
119 ShaderMap::iterator it = shaders_.find(client_id); | 119 ShaderMap::iterator it = shaders_.find(client_id); |
120 return it != shaders_.end() ? it->second : NULL; | 120 return it != shaders_.end() ? it->second.get() : NULL; |
121 } | 121 } |
122 | 122 |
123 bool ShaderManager::GetClientId(GLuint service_id, GLuint* client_id) const { | 123 bool ShaderManager::GetClientId(GLuint service_id, GLuint* client_id) const { |
124 // This doesn't need to be fast. It's only used during slow queries. | 124 // This doesn't need to be fast. It's only used during slow queries. |
125 for (ShaderMap::const_iterator it = shaders_.begin(); | 125 for (ShaderMap::const_iterator it = shaders_.begin(); |
126 it != shaders_.end(); ++it) { | 126 it != shaders_.end(); ++it) { |
127 if (it->second->service_id() == service_id) { | 127 if (it->second->service_id() == service_id) { |
128 *client_id = it->first; | 128 *client_id = it->first; |
129 return true; | 129 return true; |
130 } | 130 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 DCHECK(shader); | 174 DCHECK(shader); |
175 DCHECK(IsOwned(shader)); | 175 DCHECK(IsOwned(shader)); |
176 shader->DecUseCount(); | 176 shader->DecUseCount(); |
177 RemoveShader(shader); | 177 RemoveShader(shader); |
178 } | 178 } |
179 | 179 |
180 } // namespace gles2 | 180 } // namespace gles2 |
181 } // namespace gpu | 181 } // namespace gpu |
182 | 182 |
183 | 183 |
OLD | NEW |