| 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/mojo_gpu_memory_buffer_manager.h" | 5 #include "services/ui/public/cpp/gpu/mojo_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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 thread_.task_runner()->PostTask( | 90 thread_.task_runner()->PostTask( |
| 91 FROM_HERE, | 91 FROM_HERE, |
| 92 base::Bind(&MojoGpuMemoryBufferManager::DeletedGpuMemoryBuffer, | 92 base::Bind(&MojoGpuMemoryBufferManager::DeletedGpuMemoryBuffer, |
| 93 base::Unretained(this), id, sync_token)); | 93 base::Unretained(this), id, sync_token)); |
| 94 return; | 94 return; |
| 95 } | 95 } |
| 96 gpu_service_->DestroyGpuMemoryBuffer(id, sync_token); | 96 gpu_service_->DestroyGpuMemoryBuffer(id, sync_token); |
| 97 } | 97 } |
| 98 | 98 |
| 99 std::unique_ptr<gfx::GpuMemoryBuffer> | 99 std::unique_ptr<gfx::GpuMemoryBuffer> |
| 100 MojoGpuMemoryBufferManager::AllocateGpuMemoryBuffer( | 100 MojoGpuMemoryBufferManager::CreateGpuMemoryBuffer( |
| 101 const gfx::Size& size, | 101 const gfx::Size& size, |
| 102 gfx::BufferFormat format, | 102 gfx::BufferFormat format, |
| 103 gfx::BufferUsage usage, | 103 gfx::BufferUsage usage, |
| 104 gpu::SurfaceHandle surface_handle) { | 104 gpu::SurfaceHandle surface_handle) { |
| 105 // Note: this can be called from multiple threads at the same time. Some of | 105 // Note: this can be called from multiple threads at the same time. Some of |
| 106 // those threads may not have a TaskRunner set. | 106 // those threads may not have a TaskRunner set. |
| 107 DCHECK_EQ(gpu::kNullSurfaceHandle, surface_handle); | 107 DCHECK_EQ(gpu::kNullSurfaceHandle, surface_handle); |
| 108 CHECK(!thread_.task_runner()->BelongsToCurrentThread()); | 108 CHECK(!thread_.task_runner()->BelongsToCurrentThread()); |
| 109 gfx::GpuMemoryBufferHandle gmb_handle; | 109 gfx::GpuMemoryBufferHandle gmb_handle; |
| 110 base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 110 base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 void MojoGpuMemoryBufferManager::SetDestructionSyncToken( | 145 void MojoGpuMemoryBufferManager::SetDestructionSyncToken( |
| 146 gfx::GpuMemoryBuffer* buffer, | 146 gfx::GpuMemoryBuffer* buffer, |
| 147 const gpu::SyncToken& sync_token) { | 147 const gpu::SyncToken& sync_token) { |
| 148 static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token( | 148 static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token( |
| 149 sync_token); | 149 sync_token); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace ui | 152 } // namespace ui |
| OLD | NEW |