| 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 surface_id | 750 surface_id |
| 751 ? GpuSurfaceTracker::GetInstance()->GetSurfaceHandle(surface_id) | 751 ? GpuSurfaceTracker::GetInstance()->GetSurfaceHandle(surface_id) |
| 752 : gpu::kNullSurfaceHandle; | 752 : gpu::kNullSurfaceHandle; |
| 753 if (Send(new GpuMsg_CreateGpuMemoryBuffer(params))) { | 753 if (Send(new GpuMsg_CreateGpuMemoryBuffer(params))) { |
| 754 create_gpu_memory_buffer_requests_.push(callback); | 754 create_gpu_memory_buffer_requests_.push(callback); |
| 755 } else { | 755 } else { |
| 756 callback.Run(gfx::GpuMemoryBufferHandle()); | 756 callback.Run(gfx::GpuMemoryBufferHandle()); |
| 757 } | 757 } |
| 758 } | 758 } |
| 759 | 759 |
| 760 void GpuProcessHost::CreateGpuMemoryBufferFromHandle( | |
| 761 const gfx::GpuMemoryBufferHandle& handle, | |
| 762 gfx::GpuMemoryBufferId id, | |
| 763 const gfx::Size& size, | |
| 764 gfx::BufferFormat format, | |
| 765 int client_id, | |
| 766 const CreateGpuMemoryBufferCallback& callback) { | |
| 767 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBufferFromHandle"); | |
| 768 | |
| 769 DCHECK(CalledOnValidThread()); | |
| 770 | |
| 771 GpuMsg_CreateGpuMemoryBufferFromHandle_Params params; | |
| 772 params.handle = handle; | |
| 773 params.id = id; | |
| 774 params.size = size; | |
| 775 params.format = format; | |
| 776 params.client_id = client_id; | |
| 777 if (Send(new GpuMsg_CreateGpuMemoryBufferFromHandle(params))) { | |
| 778 create_gpu_memory_buffer_requests_.push(callback); | |
| 779 } else { | |
| 780 callback.Run(gfx::GpuMemoryBufferHandle()); | |
| 781 } | |
| 782 } | |
| 783 | |
| 784 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 760 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 785 int client_id, | 761 int client_id, |
| 786 const gpu::SyncToken& sync_token) { | 762 const gpu::SyncToken& sync_token) { |
| 787 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); | 763 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); |
| 788 | 764 |
| 789 DCHECK(CalledOnValidThread()); | 765 DCHECK(CalledOnValidThread()); |
| 790 | 766 |
| 791 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token)); | 767 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token)); |
| 792 } | 768 } |
| 793 | 769 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1143 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1168 ClientIdToShaderCacheMap::iterator iter = | 1144 ClientIdToShaderCacheMap::iterator iter = |
| 1169 client_id_to_shader_cache_.find(client_id); | 1145 client_id_to_shader_cache_.find(client_id); |
| 1170 // If the cache doesn't exist then this is an off the record profile. | 1146 // If the cache doesn't exist then this is an off the record profile. |
| 1171 if (iter == client_id_to_shader_cache_.end()) | 1147 if (iter == client_id_to_shader_cache_.end()) |
| 1172 return; | 1148 return; |
| 1173 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1149 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1174 } | 1150 } |
| 1175 | 1151 |
| 1176 } // namespace content | 1152 } // namespace content |
| OLD | NEW |