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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "content/public/common/content_client.h" | 50 #include "content/public/common/content_client.h" |
51 #include "content/public/common/content_switches.h" | 51 #include "content/public/common/content_switches.h" |
52 #include "content/public/common/mojo_channel_switches.h" | 52 #include "content/public/common/mojo_channel_switches.h" |
53 #include "content/public/common/result_codes.h" | 53 #include "content/public/common/result_codes.h" |
54 #include "content/public/common/sandbox_type.h" | 54 #include "content/public/common/sandbox_type.h" |
55 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 55 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
56 #include "content/public/common/service_manager_connection.h" | 56 #include "content/public/common/service_manager_connection.h" |
57 #include "content/public/common/service_names.mojom.h" | 57 #include "content/public/common/service_names.mojom.h" |
58 #include "gpu/command_buffer/service/gpu_preferences.h" | 58 #include "gpu/command_buffer/service/gpu_preferences.h" |
59 #include "gpu/command_buffer/service/gpu_switches.h" | 59 #include "gpu/command_buffer/service/gpu_switches.h" |
| 60 #include "gpu/ipc/host/shader_disk_cache.h" |
60 #include "gpu/ipc/service/switches.h" | 61 #include "gpu/ipc/service/switches.h" |
61 #include "ipc/ipc_channel_handle.h" | 62 #include "ipc/ipc_channel_handle.h" |
62 #include "ipc/message_filter.h" | 63 #include "ipc/message_filter.h" |
63 #include "media/base/media_switches.h" | 64 #include "media/base/media_switches.h" |
64 #include "media/media_features.h" | 65 #include "media/media_features.h" |
65 #include "mojo/edk/embedder/embedder.h" | 66 #include "mojo/edk/embedder/embedder.h" |
66 #include "services/service_manager/public/cpp/connection.h" | 67 #include "services/service_manager/public/cpp/connection.h" |
67 #include "services/service_manager/public/cpp/interface_provider.h" | 68 #include "services/service_manager/public/cpp/interface_provider.h" |
68 #include "services/service_manager/runner/common/client_util.h" | 69 #include "services/service_manager/runner/common/client_util.h" |
69 #include "ui/base/ui_base_switches.h" | 70 #include "ui/base/ui_base_switches.h" |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 void GpuProcessHost::LoadedShader(const std::string& key, | 1165 void GpuProcessHost::LoadedShader(const std::string& key, |
1165 const std::string& data) { | 1166 const std::string& data) { |
1166 std::string prefix = GetShaderPrefixKey(); | 1167 std::string prefix = GetShaderPrefixKey(); |
1167 if (!key.compare(0, prefix.length(), prefix)) | 1168 if (!key.compare(0, prefix.length(), prefix)) |
1168 Send(new GpuMsg_LoadedShader(data)); | 1169 Send(new GpuMsg_LoadedShader(data)); |
1169 } | 1170 } |
1170 | 1171 |
1171 void GpuProcessHost::CreateChannelCache(int32_t client_id) { | 1172 void GpuProcessHost::CreateChannelCache(int32_t client_id) { |
1172 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); | 1173 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); |
1173 | 1174 |
1174 scoped_refptr<ShaderDiskCache> cache = | 1175 scoped_refptr<gpu::ShaderDiskCache> cache = |
1175 GetShaderCacheFactorySingleton()->Get(client_id); | 1176 GetShaderCacheFactorySingleton()->Get(client_id); |
1176 if (!cache.get()) | 1177 if (!cache.get()) |
1177 return; | 1178 return; |
1178 | 1179 |
1179 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); | 1180 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); |
1180 | 1181 |
1181 client_id_to_shader_cache_[client_id] = cache; | 1182 client_id_to_shader_cache_[client_id] = cache; |
1182 } | 1183 } |
1183 | 1184 |
1184 void GpuProcessHost::OnDestroyChannel(int32_t client_id) { | 1185 void GpuProcessHost::OnDestroyChannel(int32_t client_id) { |
1185 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyChannel"); | 1186 TRACE_EVENT0("gpu", "GpuProcessHost::OnDestroyChannel"); |
1186 client_id_to_shader_cache_.erase(client_id); | 1187 client_id_to_shader_cache_.erase(client_id); |
1187 } | 1188 } |
1188 | 1189 |
1189 void GpuProcessHost::OnCacheShader(int32_t client_id, | 1190 void GpuProcessHost::OnCacheShader(int32_t client_id, |
1190 const std::string& key, | 1191 const std::string& key, |
1191 const std::string& shader) { | 1192 const std::string& shader) { |
1192 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1193 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1193 ClientIdToShaderCacheMap::iterator iter = | 1194 ClientIdToShaderCacheMap::iterator iter = |
1194 client_id_to_shader_cache_.find(client_id); | 1195 client_id_to_shader_cache_.find(client_id); |
1195 // If the cache doesn't exist then this is an off the record profile. | 1196 // If the cache doesn't exist then this is an off the record profile. |
1196 if (iter == client_id_to_shader_cache_.end()) | 1197 if (iter == client_id_to_shader_cache_.end()) |
1197 return; | 1198 return; |
1198 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1199 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1199 } | 1200 } |
1200 | 1201 |
1201 } // namespace content | 1202 } // namespace content |
OLD | NEW |