| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.h" | 5 #include "services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 void ClientGpuMemoryBufferManager::TearDownThread() { | 60 void ClientGpuMemoryBufferManager::TearDownThread() { |
| 61 weak_ptr_factory_.InvalidateWeakPtrs(); | 61 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 62 DisconnectGpuOnThread(); | 62 DisconnectGpuOnThread(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void ClientGpuMemoryBufferManager::DisconnectGpuOnThread() { | 65 void ClientGpuMemoryBufferManager::DisconnectGpuOnThread() { |
| 66 if (!gpu_.is_bound()) | 66 if (!gpu_.is_bound()) |
| 67 return; | 67 return; |
| 68 gpu_.reset(); | 68 gpu_.reset(); |
| 69 for (auto& waiter : pending_allocation_waiters_) | 69 for (auto* waiter : pending_allocation_waiters_) |
| 70 waiter->Signal(); | 70 waiter->Signal(); |
| 71 pending_allocation_waiters_.clear(); | 71 pending_allocation_waiters_.clear(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void ClientGpuMemoryBufferManager::AllocateGpuMemoryBufferOnThread( | 74 void ClientGpuMemoryBufferManager::AllocateGpuMemoryBufferOnThread( |
| 75 const gfx::Size& size, | 75 const gfx::Size& size, |
| 76 gfx::BufferFormat format, | 76 gfx::BufferFormat format, |
| 77 gfx::BufferUsage usage, | 77 gfx::BufferUsage usage, |
| 78 gfx::GpuMemoryBufferHandle* handle, | 78 gfx::GpuMemoryBufferHandle* handle, |
| 79 base::WaitableEvent* wait) { | 79 base::WaitableEvent* wait) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 void ClientGpuMemoryBufferManager::SetDestructionSyncToken( | 164 void ClientGpuMemoryBufferManager::SetDestructionSyncToken( |
| 165 gfx::GpuMemoryBuffer* buffer, | 165 gfx::GpuMemoryBuffer* buffer, |
| 166 const gpu::SyncToken& sync_token) { | 166 const gpu::SyncToken& sync_token) { |
| 167 static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token( | 167 static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token( |
| 168 sync_token); | 168 sync_token); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace ui | 171 } // namespace ui |
| OLD | NEW |