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 "content/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 std::string prefix = GetShaderPrefixKey(); | 1247 std::string prefix = GetShaderPrefixKey(); |
1248 if (!key.compare(0, prefix.length(), prefix)) | 1248 if (!key.compare(0, prefix.length(), prefix)) |
1249 Send(new GpuMsg_LoadedShader(data)); | 1249 Send(new GpuMsg_LoadedShader(data)); |
1250 } | 1250 } |
1251 | 1251 |
1252 void GpuProcessHost::CreateChannelCache(int32 client_id, size_t cache_size) { | 1252 void GpuProcessHost::CreateChannelCache(int32 client_id, size_t cache_size) { |
1253 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); | 1253 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); |
1254 | 1254 |
1255 scoped_refptr<ShaderDiskCache> cache = | 1255 scoped_refptr<ShaderDiskCache> cache = |
1256 ShaderCacheFactory::GetInstance()->Get(client_id); | 1256 ShaderCacheFactory::GetInstance()->Get(client_id); |
1257 if (!cache) | 1257 if (!cache.get()) |
1258 return; | 1258 return; |
1259 | 1259 |
1260 cache->set_max_cache_size(cache_size); | 1260 cache->set_max_cache_size(cache_size); |
1261 cache->set_host_id(host_id_); | 1261 cache->set_host_id(host_id_); |
1262 | 1262 |
1263 client_id_to_shader_cache_[client_id] = cache; | 1263 client_id_to_shader_cache_[client_id] = cache; |
1264 } | 1264 } |
1265 | 1265 |
1266 void GpuProcessHost::OnDestroyChannel(int32 client_id) { | 1266 void GpuProcessHost::OnDestroyChannel(int32 client_id) { |
1267 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyChannel"); | 1267 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyChannel"); |
1268 client_id_to_shader_cache_.erase(client_id); | 1268 client_id_to_shader_cache_.erase(client_id); |
1269 } | 1269 } |
1270 | 1270 |
1271 void GpuProcessHost::OnCacheShader(int32 client_id, | 1271 void GpuProcessHost::OnCacheShader(int32 client_id, |
1272 const std::string& key, | 1272 const std::string& key, |
1273 const std::string& shader) { | 1273 const std::string& shader) { |
1274 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1274 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1275 ClientIdToShaderCacheMap::iterator iter = | 1275 ClientIdToShaderCacheMap::iterator iter = |
1276 client_id_to_shader_cache_.find(client_id); | 1276 client_id_to_shader_cache_.find(client_id); |
1277 // If the cache doesn't exist then this is an off the record profile. | 1277 // If the cache doesn't exist then this is an off the record profile. |
1278 if (iter == client_id_to_shader_cache_.end()) | 1278 if (iter == client_id_to_shader_cache_.end()) |
1279 return; | 1279 return; |
1280 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1280 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1281 } | 1281 } |
1282 | 1282 |
1283 } // namespace content | 1283 } // namespace content |
OLD | NEW |