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

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

Issue 2465153002: gpu: Remove some GpuProcessHost dependency from shader cache. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | content/browser/gpu/shader_disk_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 286 }
287 287
288 private: 288 private:
289 #if defined(OS_WIN) 289 #if defined(OS_WIN)
290 base::CommandLine* cmd_line_; 290 base::CommandLine* cmd_line_;
291 #elif defined(OS_POSIX) 291 #elif defined(OS_POSIX)
292 base::ScopedFD ipc_fd_; 292 base::ScopedFD ipc_fd_;
293 #endif // OS_WIN 293 #endif // OS_WIN
294 }; 294 };
295 295
296 void HostLoadedShader(int host_id,
297 const std::string& key,
298 const std::string& data) {
299 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
300 if (host)
301 host->LoadedShader(key, data);
302 }
303
296 } // anonymous namespace 304 } // anonymous namespace
297 305
298 class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { 306 class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter {
299 public: 307 public:
300 ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {} 308 ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {}
301 309
302 private: 310 private:
303 // ConnectionFilter: 311 // ConnectionFilter:
304 bool OnConnect(const service_manager::Identity& remote_identity, 312 bool OnConnect(const service_manager::Identity& remote_identity,
305 service_manager::InterfaceRegistry* registry, 313 service_manager::InterfaceRegistry* registry,
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 } 1151 }
1144 1152
1145 void GpuProcessHost::CreateChannelCache(int32_t client_id) { 1153 void GpuProcessHost::CreateChannelCache(int32_t client_id) {
1146 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); 1154 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache");
1147 1155
1148 scoped_refptr<ShaderDiskCache> cache = 1156 scoped_refptr<ShaderDiskCache> cache =
1149 ShaderCacheFactory::GetInstance()->Get(client_id); 1157 ShaderCacheFactory::GetInstance()->Get(client_id);
1150 if (!cache.get()) 1158 if (!cache.get())
1151 return; 1159 return;
1152 1160
1153 cache->set_host_id(host_id_); 1161 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_));
1154 1162
1155 client_id_to_shader_cache_[client_id] = cache; 1163 client_id_to_shader_cache_[client_id] = cache;
1156 } 1164 }
1157 1165
1158 void GpuProcessHost::OnDestroyChannel(int32_t client_id) { 1166 void GpuProcessHost::OnDestroyChannel(int32_t client_id) {
1159 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyChannel"); 1167 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyChannel");
1160 client_id_to_shader_cache_.erase(client_id); 1168 client_id_to_shader_cache_.erase(client_id);
1161 } 1169 }
1162 1170
1163 void GpuProcessHost::OnCacheShader(int32_t client_id, 1171 void GpuProcessHost::OnCacheShader(int32_t client_id,
1164 const std::string& key, 1172 const std::string& key,
1165 const std::string& shader) { 1173 const std::string& shader) {
1166 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1174 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1167 ClientIdToShaderCacheMap::iterator iter = 1175 ClientIdToShaderCacheMap::iterator iter =
1168 client_id_to_shader_cache_.find(client_id); 1176 client_id_to_shader_cache_.find(client_id);
1169 // If the cache doesn't exist then this is an off the record profile. 1177 // If the cache doesn't exist then this is an off the record profile.
1170 if (iter == client_id_to_shader_cache_.end()) 1178 if (iter == client_id_to_shader_cache_.end())
1171 return; 1179 return;
1172 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1180 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1173 } 1181 }
1174 1182
1175 } // namespace content 1183 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/shader_disk_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698