| 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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 DCHECK(!channel_requests_.empty()); | 824 DCHECK(!channel_requests_.empty()); |
| 825 DCHECK(channel_requests_.front().Equals(callback)); | 825 DCHECK(channel_requests_.front().Equals(callback)); |
| 826 channel_requests_.pop(); | 826 channel_requests_.pop(); |
| 827 | 827 |
| 828 // Currently if any of the GPU features are blacklisted, we don't establish a | 828 // Currently if any of the GPU features are blacklisted, we don't establish a |
| 829 // GPU channel. | 829 // GPU channel. |
| 830 if (channel_handle.is_valid() && | 830 if (channel_handle.is_valid() && |
| 831 !GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(nullptr)) { | 831 !GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(nullptr)) { |
| 832 gpu_service_ptr_->CloseChannel(client_id); | 832 gpu_service_ptr_->CloseChannel(client_id); |
| 833 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); | 833 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); |
| 834 RouteOnUIThread( | 834 RecordLogMessage(logging::LOG_WARNING, "WARNING", |
| 835 GpuHostMsg_OnLogMessage(logging::LOG_WARNING, "WARNING", | 835 "Hardware acceleration is unavailable."); |
| 836 "Hardware acceleration is unavailable.")); | |
| 837 return; | 836 return; |
| 838 } | 837 } |
| 839 | 838 |
| 840 callback.Run(IPC::ChannelHandle(channel_handle.release()), gpu_info_); | 839 callback.Run(IPC::ChannelHandle(channel_handle.release()), gpu_info_); |
| 841 } | 840 } |
| 842 | 841 |
| 843 void GpuProcessHost::OnGpuMemoryBufferCreated( | 842 void GpuProcessHost::OnGpuMemoryBufferCreated( |
| 844 const gfx::GpuMemoryBufferHandle& handle) { | 843 const gfx::GpuMemoryBufferHandle& handle) { |
| 845 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); | 844 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); |
| 846 | 845 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 const std::string& shader) { | 995 const std::string& shader) { |
| 997 TRACE_EVENT0("gpu", "GpuProcessHost::StoreShaderToDisk"); | 996 TRACE_EVENT0("gpu", "GpuProcessHost::StoreShaderToDisk"); |
| 998 ClientIdToShaderCacheMap::iterator iter = | 997 ClientIdToShaderCacheMap::iterator iter = |
| 999 client_id_to_shader_cache_.find(client_id); | 998 client_id_to_shader_cache_.find(client_id); |
| 1000 // If the cache doesn't exist then this is an off the record profile. | 999 // If the cache doesn't exist then this is an off the record profile. |
| 1001 if (iter == client_id_to_shader_cache_.end()) | 1000 if (iter == client_id_to_shader_cache_.end()) |
| 1002 return; | 1001 return; |
| 1003 iter->second->Cache(GetShaderPrefixKey(shader) + ":" + key, shader); | 1002 iter->second->Cache(GetShaderPrefixKey(shader) + ":" + key, shader); |
| 1004 } | 1003 } |
| 1005 | 1004 |
| 1005 void GpuProcessHost::RecordLogMessage(int32_t severity, |
| 1006 const std::string& header, |
| 1007 const std::string& message) { |
| 1008 GpuDataManagerImpl::GetInstance()->AddLogMessage(severity, header, message); |
| 1009 } |
| 1010 |
| 1006 GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { | 1011 GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { |
| 1007 return kind_; | 1012 return kind_; |
| 1008 } | 1013 } |
| 1009 | 1014 |
| 1010 void GpuProcessHost::ForceShutdown() { | 1015 void GpuProcessHost::ForceShutdown() { |
| 1011 // This is only called on the IO thread so no race against the constructor | 1016 // This is only called on the IO thread so no race against the constructor |
| 1012 // for another GpuProcessHost. | 1017 // for another GpuProcessHost. |
| 1013 if (g_gpu_process_hosts[kind_] == this) | 1018 if (g_gpu_process_hosts[kind_] == this) |
| 1014 g_gpu_process_hosts[kind_] = NULL; | 1019 g_gpu_process_hosts[kind_] = NULL; |
| 1015 | 1020 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 GetShaderCacheFactorySingleton()->Get(client_id); | 1244 GetShaderCacheFactorySingleton()->Get(client_id); |
| 1240 if (!cache.get()) | 1245 if (!cache.get()) |
| 1241 return; | 1246 return; |
| 1242 | 1247 |
| 1243 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); | 1248 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); |
| 1244 | 1249 |
| 1245 client_id_to_shader_cache_[client_id] = cache; | 1250 client_id_to_shader_cache_[client_id] = cache; |
| 1246 } | 1251 } |
| 1247 | 1252 |
| 1248 } // namespace content | 1253 } // namespace content |
| OLD | NEW |