| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_client.h" | 5 #include "content/browser/gpu/gpu_client.h" |
| 6 | 6 |
| 7 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 7 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 8 #include "content/browser/gpu/gpu_process_host.h" | 8 #include "content/browser/gpu/gpu_process_host.h" |
| 9 #include "content/common/child_process_host_impl.h" | 9 #include "content/common/child_process_host_impl.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 return; | 34 return; |
| 35 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager = | 35 BrowserGpuMemoryBufferManager* gpu_memory_buffer_manager = |
| 36 BrowserGpuMemoryBufferManager::current(); | 36 BrowserGpuMemoryBufferManager::current(); |
| 37 if (gpu_memory_buffer_manager) | 37 if (gpu_memory_buffer_manager) |
| 38 gpu_memory_buffer_manager->ProcessRemoved(render_process_id_); | 38 gpu_memory_buffer_manager->ProcessRemoved(render_process_id_); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void GpuClient::OnEstablishGpuChannel( | 41 void GpuClient::OnEstablishGpuChannel( |
| 42 const EstablishGpuChannelCallback& callback, | 42 const EstablishGpuChannelCallback& callback, |
| 43 const IPC::ChannelHandle& channel, | 43 const IPC::ChannelHandle& channel, |
| 44 const gpu::GPUInfo& gpu_info) { | 44 const gpu::GPUInfo& gpu_info, |
| 45 GpuProcessHost::EstablishChannelStatus status) { |
| 45 mojo::ScopedMessagePipeHandle channel_handle; | 46 mojo::ScopedMessagePipeHandle channel_handle; |
| 46 channel_handle.reset(channel.mojo_handle); | 47 channel_handle.reset(channel.mojo_handle); |
| 47 callback.Run(render_process_id_, std::move(channel_handle), gpu_info); | 48 callback.Run(render_process_id_, std::move(channel_handle), gpu_info); |
| 48 } | 49 } |
| 49 | 50 |
| 50 void GpuClient::OnCreateGpuMemoryBuffer( | 51 void GpuClient::OnCreateGpuMemoryBuffer( |
| 51 const CreateGpuMemoryBufferCallback& callback, | 52 const CreateGpuMemoryBufferCallback& callback, |
| 52 const gfx::GpuMemoryBufferHandle& handle) { | 53 const gfx::GpuMemoryBufferHandle& handle) { |
| 53 callback.Run(handle); | 54 callback.Run(handle); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void GpuClient::EstablishGpuChannel( | 57 void GpuClient::EstablishGpuChannel( |
| 57 const EstablishGpuChannelCallback& callback) { | 58 const EstablishGpuChannelCallback& callback) { |
| 58 GpuProcessHost* host = | 59 GpuProcessHost* host = |
| 59 GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED); | 60 GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED); |
| 60 if (!host) { | 61 if (!host) { |
| 61 OnEstablishGpuChannel(callback, IPC::ChannelHandle(), gpu::GPUInfo()); | 62 OnEstablishGpuChannel( |
| 63 callback, IPC::ChannelHandle(), gpu::GPUInfo(), |
| 64 GpuProcessHost::EstablishChannelStatus::GPU_ACCESS_DENIED); |
| 62 return; | 65 return; |
| 63 } | 66 } |
| 64 | 67 |
| 65 bool preempts = false; | 68 bool preempts = false; |
| 66 bool allow_view_command_buffers = false; | 69 bool allow_view_command_buffers = false; |
| 67 bool allow_real_time_streams = false; | 70 bool allow_real_time_streams = false; |
| 68 host->EstablishGpuChannel( | 71 host->EstablishGpuChannel( |
| 69 render_process_id_, | 72 render_process_id_, |
| 70 ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( | 73 ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( |
| 71 render_process_id_), | 74 render_process_id_), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 98 | 101 |
| 99 void GpuClient::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 102 void GpuClient::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 100 const gpu::SyncToken& sync_token) { | 103 const gpu::SyncToken& sync_token) { |
| 101 DCHECK(BrowserGpuMemoryBufferManager::current()); | 104 DCHECK(BrowserGpuMemoryBufferManager::current()); |
| 102 | 105 |
| 103 BrowserGpuMemoryBufferManager::current()->ChildProcessDeletedGpuMemoryBuffer( | 106 BrowserGpuMemoryBufferManager::current()->ChildProcessDeletedGpuMemoryBuffer( |
| 104 id, render_process_id_, sync_token); | 107 id, render_process_id_, sync_token); |
| 105 } | 108 } |
| 106 | 109 |
| 107 } // namespace content | 110 } // namespace content |
| OLD | NEW |