| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser_gpu_memory_buffer_manager.h" | 5 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 const gfx::Size& size, | 593 const gfx::Size& size, |
| 594 gfx::BufferFormat format, | 594 gfx::BufferFormat format, |
| 595 gfx::BufferUsage usage, | 595 gfx::BufferUsage usage, |
| 596 int client_id, | 596 int client_id, |
| 597 bool reused_gpu_process, | 597 bool reused_gpu_process, |
| 598 const CreateCallback& callback) { | 598 const CreateCallback& callback) { |
| 599 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 599 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 600 | 600 |
| 601 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); | 601 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); |
| 602 if (!host) { | 602 if (!host) { |
| 603 host = GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 603 host = GpuProcessHost::Get( |
| 604 CAUSE_FOR_GPU_LAUNCH_GPU_MEMORY_BUFFER_ALLOCATE); | 604 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 605 gpu::CAUSE_FOR_GPU_LAUNCH_GPU_MEMORY_BUFFER_ALLOCATE); |
| 605 if (!host) { | 606 if (!host) { |
| 606 LOG(ERROR) << "Failed to launch GPU process."; | 607 LOG(ERROR) << "Failed to launch GPU process."; |
| 607 callback.Run(gfx::GpuMemoryBufferHandle()); | 608 callback.Run(gfx::GpuMemoryBufferHandle()); |
| 608 return; | 609 return; |
| 609 } | 610 } |
| 610 gpu_host_id_ = host->host_id(); | 611 gpu_host_id_ = host->host_id(); |
| 611 reused_gpu_process = false; | 612 reused_gpu_process = false; |
| 612 } else { | 613 } else { |
| 613 if (reused_gpu_process) { | 614 if (reused_gpu_process) { |
| 614 // We come here if we retried to create the buffer because of a failure | 615 // We come here if we retried to create the buffer because of a failure |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 return gpu_client_tracing_id_; | 748 return gpu_client_tracing_id_; |
| 748 } | 749 } |
| 749 | 750 |
| 750 // In normal cases, |client_id| is a child process id, so we can perform | 751 // In normal cases, |client_id| is a child process id, so we can perform |
| 751 // the standard conversion. | 752 // the standard conversion. |
| 752 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( | 753 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( |
| 753 client_id); | 754 client_id); |
| 754 } | 755 } |
| 755 | 756 |
| 756 } // namespace content | 757 } // namespace content |
| OLD | NEW |