| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 // Allocate shared memory buffer. | 539 // Allocate shared memory buffer. |
| 540 auto insert_result = buffers.insert(std::make_pair( | 540 auto insert_result = buffers.insert(std::make_pair( |
| 541 new_id, BufferInfo(request->size, gfx::SHARED_MEMORY_BUFFER, | 541 new_id, BufferInfo(request->size, gfx::SHARED_MEMORY_BUFFER, |
| 542 request->format, request->usage, 0))); | 542 request->format, request->usage, 0))); |
| 543 DCHECK(insert_result.second); | 543 DCHECK(insert_result.second); |
| 544 | 544 |
| 545 gfx::GpuMemoryBufferHandle handle; | 545 gfx::GpuMemoryBufferHandle handle; |
| 546 handle.id = new_id; | 546 handle.id = new_id; |
| 547 handle.handle = request->handle.handle; | 547 handle.handle = request->handle.handle; |
| 548 handle.offset = request->handle.offset; | 548 handle.offset = request->handle.offset; |
| 549 handle.stride = request->handle.stride; |
| 549 | 550 |
| 550 // Note: Unretained is safe as IO thread is stopped before manager is | 551 // Note: Unretained is safe as IO thread is stopped before manager is |
| 551 // destroyed. | 552 // destroyed. |
| 552 request->result = GpuMemoryBufferImplSharedMemory::CreateFromHandle( | 553 request->result = GpuMemoryBufferImplSharedMemory::CreateFromHandle( |
| 553 handle, request->size, request->format, request->usage, | 554 handle, request->size, request->format, request->usage, |
| 554 base::Bind( | 555 base::Bind( |
| 555 &GpuMemoryBufferDeleted, | 556 &GpuMemoryBufferDeleted, |
| 556 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 557 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 557 base::Bind(&BrowserGpuMemoryBufferManager::DestroyGpuMemoryBufferOnIO, | 558 base::Bind(&BrowserGpuMemoryBufferManager::DestroyGpuMemoryBufferOnIO, |
| 558 base::Unretained(this), new_id, request->client_id))); | 559 base::Unretained(this), new_id, request->client_id))); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 return gpu_client_tracing_id_; | 743 return gpu_client_tracing_id_; |
| 743 } | 744 } |
| 744 | 745 |
| 745 // In normal cases, |client_id| is a child process id, so we can perform | 746 // In normal cases, |client_id| is a child process id, so we can perform |
| 746 // the standard conversion. | 747 // the standard conversion. |
| 747 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( | 748 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( |
| 748 client_id); | 749 client_id); |
| 749 } | 750 } |
| 750 | 751 |
| 751 } // namespace content | 752 } // namespace content |
| OLD | NEW |