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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 2565223003: content: Move shader cache factory singleton into a separate file. (Closed)
Patch Set: Created 4 years 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 "content/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 13 matching lines...) Expand all
24 #include "base/sha1.h" 24 #include "base/sha1.h"
25 #include "base/threading/thread.h" 25 #include "base/threading/thread.h"
26 #include "base/threading/thread_task_runner_handle.h" 26 #include "base/threading/thread_task_runner_handle.h"
27 #include "base/trace_event/trace_event.h" 27 #include "base/trace_event/trace_event.h"
28 #include "build/build_config.h" 28 #include "build/build_config.h"
29 #include "components/tracing/common/tracing_switches.h" 29 #include "components/tracing/common/tracing_switches.h"
30 #include "content/browser/browser_child_process_host_impl.h" 30 #include "content/browser/browser_child_process_host_impl.h"
31 #include "content/browser/gpu/compositor_util.h" 31 #include "content/browser/gpu/compositor_util.h"
32 #include "content/browser/gpu/gpu_data_manager_impl.h" 32 #include "content/browser/gpu/gpu_data_manager_impl.h"
33 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 33 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
34 #include "content/browser/gpu/shader_disk_cache.h" 34 #include "content/browser/gpu/shader_cache_factory.h"
35 #include "content/browser/renderer_host/render_widget_host_impl.h" 35 #include "content/browser/renderer_host/render_widget_host_impl.h"
36 #include "content/browser/service_manager/service_manager_context.h" 36 #include "content/browser/service_manager/service_manager_context.h"
37 #include "content/common/child_process_host_impl.h" 37 #include "content/common/child_process_host_impl.h"
38 #include "content/common/establish_channel_params.h" 38 #include "content/common/establish_channel_params.h"
39 #include "content/common/gpu_host_messages.h" 39 #include "content/common/gpu_host_messages.h"
40 #include "content/common/in_process_child_thread_params.h" 40 #include "content/common/in_process_child_thread_params.h"
41 #include "content/common/service_manager/child_connection.h" 41 #include "content/common/service_manager/child_connection.h"
42 #include "content/common/view_messages.h" 42 #include "content/common/view_messages.h"
43 #include "content/public/browser/browser_thread.h" 43 #include "content/public/browser/browser_thread.h"
44 #include "content/public/browser/content_browser_client.h" 44 #include "content/public/browser/content_browser_client.h"
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 const std::string& data) { 1165 const std::string& data) {
1166 std::string prefix = GetShaderPrefixKey(); 1166 std::string prefix = GetShaderPrefixKey();
1167 if (!key.compare(0, prefix.length(), prefix)) 1167 if (!key.compare(0, prefix.length(), prefix))
1168 Send(new GpuMsg_LoadedShader(data)); 1168 Send(new GpuMsg_LoadedShader(data));
1169 } 1169 }
1170 1170
1171 void GpuProcessHost::CreateChannelCache(int32_t client_id) { 1171 void GpuProcessHost::CreateChannelCache(int32_t client_id) {
1172 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); 1172 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache");
1173 1173
1174 scoped_refptr<ShaderDiskCache> cache = 1174 scoped_refptr<ShaderDiskCache> cache =
1175 ShaderCacheFactory::GetInstance()->Get(client_id); 1175 GetShaderCacheFactorySingleton()->Get(client_id);
1176 if (!cache.get()) 1176 if (!cache.get())
1177 return; 1177 return;
1178 1178
1179 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); 1179 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_));
1180 1180
1181 client_id_to_shader_cache_[client_id] = cache; 1181 client_id_to_shader_cache_[client_id] = cache;
1182 } 1182 }
1183 1183
1184 void GpuProcessHost::OnDestroyChannel(int32_t client_id) { 1184 void GpuProcessHost::OnDestroyChannel(int32_t client_id) {
1185 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyChannel"); 1185 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyChannel");
1186 client_id_to_shader_cache_.erase(client_id); 1186 client_id_to_shader_cache_.erase(client_id);
1187 } 1187 }
1188 1188
1189 void GpuProcessHost::OnCacheShader(int32_t client_id, 1189 void GpuProcessHost::OnCacheShader(int32_t client_id,
1190 const std::string& key, 1190 const std::string& key,
1191 const std::string& shader) { 1191 const std::string& shader) {
1192 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1192 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1193 ClientIdToShaderCacheMap::iterator iter = 1193 ClientIdToShaderCacheMap::iterator iter =
1194 client_id_to_shader_cache_.find(client_id); 1194 client_id_to_shader_cache_.find(client_id);
1195 // If the cache doesn't exist then this is an off the record profile. 1195 // If the cache doesn't exist then this is an off the record profile.
1196 if (iter == client_id_to_shader_cache_.end()) 1196 if (iter == client_id_to_shader_cache_.end())
1197 return; 1197 return;
1198 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1198 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1199 } 1199 }
1200 1200
1201 } // namespace content 1201 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.cc ('k') | content/browser/gpu/shader_cache_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698