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