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

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

Issue 16293004: Update gpu/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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) 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/memory_program_cache.h" 5 #include "gpu/command_buffer/service/memory_program_cache.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 b_sha, 195 b_sha,
196 bind_attrib_location_map, 196 bind_attrib_location_map,
197 sha); 197 sha);
198 const std::string sha_string(sha, sizeof(sha)); 198 const std::string sha_string(sha, sizeof(sha));
199 199
200 UMA_HISTOGRAM_COUNTS("GPU.ProgramCache.MemorySizeBeforeKb", 200 UMA_HISTOGRAM_COUNTS("GPU.ProgramCache.MemorySizeBeforeKb",
201 curr_size_bytes_ / 1024); 201 curr_size_bytes_ / 1024);
202 202
203 if (store_.find(sha_string) != store_.end()) { 203 if (store_.find(sha_string) != store_.end()) {
204 const StoreMap::iterator found = store_.find(sha_string); 204 const StoreMap::iterator found = store_.find(sha_string);
205 const ProgramCacheValue* evicting = found->second; 205 const ProgramCacheValue* evicting = found->second.get();
206 curr_size_bytes_ -= evicting->length; 206 curr_size_bytes_ -= evicting->length;
207 Evict(sha_string, evicting->shader_0_hash, evicting->shader_1_hash); 207 Evict(sha_string, evicting->shader_0_hash, evicting->shader_1_hash);
208 store_.erase(found); 208 store_.erase(found);
209 } 209 }
210 210
211 while (curr_size_bytes_ + length > max_size_bytes_) { 211 while (curr_size_bytes_ + length > max_size_bytes_) {
212 DCHECK(!eviction_helper_.IsEmpty()); 212 DCHECK(!eviction_helper_.IsEmpty());
213 const std::string* program = eviction_helper_.PeekKey(); 213 const std::string* program = eviction_helper_.PeekKey();
214 const StoreMap::iterator found = store_.find(*program); 214 const StoreMap::iterator found = store_.find(*program);
215 const ProgramCacheValue* evicting = found->second.get(); 215 const ProgramCacheValue* evicting = found->second.get();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 attrib_map_0(_attrib_map_0), 323 attrib_map_0(_attrib_map_0),
324 uniform_map_0(_uniform_map_0), 324 uniform_map_0(_uniform_map_0),
325 shader_1_hash(_shader_1_hash, kHashLength), 325 shader_1_hash(_shader_1_hash, kHashLength),
326 attrib_map_1(_attrib_map_1), 326 attrib_map_1(_attrib_map_1),
327 uniform_map_1(_uniform_map_1) {} 327 uniform_map_1(_uniform_map_1) {}
328 328
329 MemoryProgramCache::ProgramCacheValue::~ProgramCacheValue() {} 329 MemoryProgramCache::ProgramCacheValue::~ProgramCacheValue() {}
330 330
331 } // namespace gles2 331 } // namespace gles2
332 } // namespace gpu 332 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/image_manager.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698