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; | |
550 | 549 |
551 // Note: Unretained is safe as IO thread is stopped before manager is | 550 // Note: Unretained is safe as IO thread is stopped before manager is |
552 // destroyed. | 551 // destroyed. |
553 request->result = GpuMemoryBufferImplSharedMemory::CreateFromHandle( | 552 request->result = GpuMemoryBufferImplSharedMemory::CreateFromHandle( |
554 handle, request->size, request->format, request->usage, | 553 handle, request->size, request->format, request->usage, |
555 base::Bind( | 554 base::Bind( |
556 &GpuMemoryBufferDeleted, | 555 &GpuMemoryBufferDeleted, |
557 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 556 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
558 base::Bind(&BrowserGpuMemoryBufferManager::DestroyGpuMemoryBufferOnIO, | 557 base::Bind(&BrowserGpuMemoryBufferManager::DestroyGpuMemoryBufferOnIO, |
559 base::Unretained(this), new_id, request->client_id))); | 558 base::Unretained(this), new_id, request->client_id))); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 return gpu_client_tracing_id_; | 742 return gpu_client_tracing_id_; |
744 } | 743 } |
745 | 744 |
746 // In normal cases, |client_id| is a child process id, so we can perform | 745 // In normal cases, |client_id| is a child process id, so we can perform |
747 // the standard conversion. | 746 // the standard conversion. |
748 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( | 747 return ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( |
749 client_id); | 748 client_id); |
750 } | 749 } |
751 | 750 |
752 } // namespace content | 751 } // namespace content |
OLD | NEW |