| 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 "cc/test/test_gpu_memory_buffer_manager.h" | 5 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 last_gpu_memory_buffer_id_ += 1; | 166 last_gpu_memory_buffer_id_ += 1; |
| 167 std::unique_ptr<gfx::GpuMemoryBuffer> result(new GpuMemoryBufferImpl( | 167 std::unique_ptr<gfx::GpuMemoryBuffer> result(new GpuMemoryBufferImpl( |
| 168 this, last_gpu_memory_buffer_id_, size, format, std::move(shared_memory), | 168 this, last_gpu_memory_buffer_id_, size, format, std::move(shared_memory), |
| 169 0, base::checked_cast<int>( | 169 0, base::checked_cast<int>( |
| 170 gfx::RowSizeForBufferFormat(size.width(), format, 0)))); | 170 gfx::RowSizeForBufferFormat(size.width(), format, 0)))); |
| 171 buffers_[last_gpu_memory_buffer_id_] = result.get(); | 171 buffers_[last_gpu_memory_buffer_id_] = result.get(); |
| 172 return result; | 172 return result; |
| 173 } | 173 } |
| 174 | 174 |
| 175 std::unique_ptr<gfx::GpuMemoryBuffer> | |
| 176 TestGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle( | |
| 177 const gfx::GpuMemoryBufferHandle& handle, | |
| 178 const gfx::Size& size, | |
| 179 gfx::BufferFormat format) { | |
| 180 if (handle.type != gfx::SHARED_MEMORY_BUFFER) | |
| 181 return nullptr; | |
| 182 | |
| 183 last_gpu_memory_buffer_id_ += 1; | |
| 184 std::unique_ptr<gfx::GpuMemoryBuffer> result(new GpuMemoryBufferImpl( | |
| 185 this, last_gpu_memory_buffer_id_, size, format, | |
| 186 base::MakeUnique<base::SharedMemory>(handle.handle, false), handle.offset, | |
| 187 handle.stride)); | |
| 188 buffers_[last_gpu_memory_buffer_id_] = result.get(); | |
| 189 return result; | |
| 190 } | |
| 191 | |
| 192 void TestGpuMemoryBufferManager::SetDestructionSyncToken( | 175 void TestGpuMemoryBufferManager::SetDestructionSyncToken( |
| 193 gfx::GpuMemoryBuffer* buffer, | 176 gfx::GpuMemoryBuffer* buffer, |
| 194 const gpu::SyncToken& sync_token) {} | 177 const gpu::SyncToken& sync_token) {} |
| 195 | 178 |
| 196 } // namespace cc | 179 } // namespace cc |
| OLD | NEW |