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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 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/memory_program_cache.h" 5 #include "gpu/command_buffer/service/memory_program_cache.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/sha1.h" 9 #include "base/sha1.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 b_sha, 112 b_sha,
113 bind_attrib_location_map, 113 bind_attrib_location_map,
114 sha); 114 sha);
115 const std::string sha_string(sha, sizeof(sha)); 115 const std::string sha_string(sha, sizeof(sha));
116 116
117 UMA_HISTOGRAM_COUNTS("GPU.ProgramCache.MemorySizeBeforeKb", 117 UMA_HISTOGRAM_COUNTS("GPU.ProgramCache.MemorySizeBeforeKb",
118 curr_size_bytes_ / 1024); 118 curr_size_bytes_ / 1024);
119 119
120 if (store_.find(sha_string) != store_.end()) { 120 if (store_.find(sha_string) != store_.end()) {
121 const StoreMap::iterator found = store_.find(sha_string); 121 const StoreMap::iterator found = store_.find(sha_string);
122 const ProgramCacheValue* evicting = found->second; 122 const ProgramCacheValue* evicting = found->second.get();
123 curr_size_bytes_ -= evicting->length; 123 curr_size_bytes_ -= evicting->length;
124 Evict(sha_string, evicting->shader_0_hash, evicting->shader_1_hash); 124 Evict(sha_string, evicting->shader_0_hash, evicting->shader_1_hash);
125 store_.erase(found); 125 store_.erase(found);
126 } 126 }
127 127
128 while (curr_size_bytes_ + length > max_size_bytes_) { 128 while (curr_size_bytes_ + length > max_size_bytes_) {
129 DCHECK(!eviction_helper_.IsEmpty()); 129 DCHECK(!eviction_helper_.IsEmpty());
130 const std::string* program = eviction_helper_.PeekKey(); 130 const std::string* program = eviction_helper_.PeekKey();
131 const StoreMap::iterator found = store_.find(*program); 131 const StoreMap::iterator found = store_.find(*program);
132 const ProgramCacheValue* evicting = found->second.get(); 132 const ProgramCacheValue* evicting = found->second.get();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 attrib_map_0(_attrib_map_0), 172 attrib_map_0(_attrib_map_0),
173 uniform_map_0(_uniform_map_0), 173 uniform_map_0(_uniform_map_0),
174 shader_1_hash(_shader_1_hash, kHashLength), 174 shader_1_hash(_shader_1_hash, kHashLength),
175 attrib_map_1(_attrib_map_1), 175 attrib_map_1(_attrib_map_1),
176 uniform_map_1(_uniform_map_1) {} 176 uniform_map_1(_uniform_map_1) {}
177 177
178 MemoryProgramCache::ProgramCacheValue::~ProgramCacheValue() {} 178 MemoryProgramCache::ProgramCacheValue::~ProgramCacheValue() {}
179 179
180 } // namespace gles2 180 } // namespace gles2
181 } // namespace gpu 181 } // 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