Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Side by Side Diff: gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc

Issue 2257713003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 GpuMemoryBufferImplSharedMemory::CreateFromHandle( 87 GpuMemoryBufferImplSharedMemory::CreateFromHandle(
88 const gfx::GpuMemoryBufferHandle& handle, 88 const gfx::GpuMemoryBufferHandle& handle,
89 const gfx::Size& size, 89 const gfx::Size& size,
90 gfx::BufferFormat format, 90 gfx::BufferFormat format,
91 gfx::BufferUsage usage, 91 gfx::BufferUsage usage,
92 const DestructionCallback& callback) { 92 const DestructionCallback& callback) {
93 DCHECK(base::SharedMemory::IsHandleValid(handle.handle)); 93 DCHECK(base::SharedMemory::IsHandleValid(handle.handle));
94 94
95 return base::WrapUnique(new GpuMemoryBufferImplSharedMemory( 95 return base::WrapUnique(new GpuMemoryBufferImplSharedMemory(
96 handle.id, size, format, callback, 96 handle.id, size, format, callback,
97 base::WrapUnique(new base::SharedMemory(handle.handle, false)), 97 base::MakeUnique<base::SharedMemory>(handle.handle, false), handle.offset,
98 handle.offset, handle.stride)); 98 handle.stride));
99 } 99 }
100 100
101 // static 101 // static
102 bool GpuMemoryBufferImplSharedMemory::IsUsageSupported(gfx::BufferUsage usage) { 102 bool GpuMemoryBufferImplSharedMemory::IsUsageSupported(gfx::BufferUsage usage) {
103 switch (usage) { 103 switch (usage) {
104 case gfx::BufferUsage::GPU_READ: 104 case gfx::BufferUsage::GPU_READ:
105 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 105 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
106 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: 106 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
107 return true; 107 return true;
108 case gfx::BufferUsage::SCANOUT: 108 case gfx::BufferUsage::SCANOUT:
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 gfx::GpuMemoryBufferHandle handle; 216 gfx::GpuMemoryBufferHandle handle;
217 handle.type = gfx::SHARED_MEMORY_BUFFER; 217 handle.type = gfx::SHARED_MEMORY_BUFFER;
218 handle.id = id_; 218 handle.id = id_;
219 handle.offset = offset_; 219 handle.offset = offset_;
220 handle.stride = stride_; 220 handle.stride = stride_;
221 handle.handle = shared_memory_->handle(); 221 handle.handle = shared_memory_->handle();
222 return handle; 222 return handle;
223 } 223 }
224 224
225 } // namespace gpu 225 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/android/in_process_surface_texture_manager.cc ('k') | gpu/ipc/service/gpu_channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698