| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); | 783 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); |
| 784 | 784 |
| 785 DCHECK(CalledOnValidThread()); | 785 DCHECK(CalledOnValidThread()); |
| 786 | 786 |
| 787 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token)); | 787 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token)); |
| 788 } | 788 } |
| 789 | 789 |
| 790 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { | 790 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { |
| 791 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); | 791 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); |
| 792 initialized_ = result; | 792 initialized_ = result; |
| 793 gpu_info_ = gpu_info; |
| 793 | 794 |
| 794 if (!initialized_) | 795 if (!initialized_) |
| 795 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); | 796 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); |
| 796 else if (!in_process_) | 797 else if (!in_process_) |
| 797 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | 798 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); |
| 798 } | 799 } |
| 799 | 800 |
| 800 void GpuProcessHost::OnChannelEstablished( | 801 void GpuProcessHost::OnChannelEstablished( |
| 801 const IPC::ChannelHandle& channel_handle) { | 802 const IPC::ChannelHandle& channel_handle) { |
| 802 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); | 803 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 818 !GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) { | 819 !GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) { |
| 819 Send(new GpuMsg_CloseChannel(channel_handle)); | 820 Send(new GpuMsg_CloseChannel(channel_handle)); |
| 820 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); | 821 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); |
| 821 RouteOnUIThread(GpuHostMsg_OnLogMessage( | 822 RouteOnUIThread(GpuHostMsg_OnLogMessage( |
| 822 logging::LOG_WARNING, | 823 logging::LOG_WARNING, |
| 823 "WARNING", | 824 "WARNING", |
| 824 "Hardware acceleration is unavailable.")); | 825 "Hardware acceleration is unavailable.")); |
| 825 return; | 826 return; |
| 826 } | 827 } |
| 827 | 828 |
| 828 callback.Run(channel_handle, | 829 callback.Run(channel_handle, gpu_info_); |
| 829 GpuDataManagerImpl::GetInstance()->GetGPUInfo()); | |
| 830 } | 830 } |
| 831 | 831 |
| 832 void GpuProcessHost::OnCommandBufferCreated(CreateCommandBufferResult result) { | 832 void GpuProcessHost::OnCommandBufferCreated(CreateCommandBufferResult result) { |
| 833 TRACE_EVENT0("gpu", "GpuProcessHost::OnCommandBufferCreated"); | 833 TRACE_EVENT0("gpu", "GpuProcessHost::OnCommandBufferCreated"); |
| 834 | 834 |
| 835 if (create_command_buffer_requests_.empty()) | 835 if (create_command_buffer_requests_.empty()) |
| 836 return; | 836 return; |
| 837 | 837 |
| 838 CreateCommandBufferCallback callback = | 838 CreateCommandBufferCallback callback = |
| 839 create_command_buffer_requests_.front(); | 839 create_command_buffer_requests_.front(); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1179 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1180 ClientIdToShaderCacheMap::iterator iter = | 1180 ClientIdToShaderCacheMap::iterator iter = |
| 1181 client_id_to_shader_cache_.find(client_id); | 1181 client_id_to_shader_cache_.find(client_id); |
| 1182 // If the cache doesn't exist then this is an off the record profile. | 1182 // If the cache doesn't exist then this is an off the record profile. |
| 1183 if (iter == client_id_to_shader_cache_.end()) | 1183 if (iter == client_id_to_shader_cache_.end()) |
| 1184 return; | 1184 return; |
| 1185 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1185 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 } // namespace content | 1188 } // namespace content |
| OLD | NEW |