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

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

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_io_surface.h" 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h"
8 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 9 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
9 #include "ui/gfx/buffer_format_util.h" 10 #include "ui/gfx/buffer_format_util.h"
10 #include "ui/gfx/mac/io_surface.h" 11 #include "ui/gfx/mac/io_surface.h"
11 12
12 namespace gpu { 13 namespace gpu {
13 namespace { 14 namespace {
14 15
15 uint32_t LockFlags(gfx::BufferUsage usage) { 16 uint32_t LockFlags(gfx::BufferUsage usage) {
16 switch (usage) { 17 switch (usage) {
17 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 18 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
(...skipping 18 matching lines...) Expand all
36 const DestructionCallback& callback, 37 const DestructionCallback& callback,
37 IOSurfaceRef io_surface, 38 IOSurfaceRef io_surface,
38 uint32_t lock_flags) 39 uint32_t lock_flags)
39 : GpuMemoryBufferImpl(id, size, format, callback), 40 : GpuMemoryBufferImpl(id, size, format, callback),
40 io_surface_(io_surface), 41 io_surface_(io_surface),
41 lock_flags_(lock_flags) {} 42 lock_flags_(lock_flags) {}
42 43
43 GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() {} 44 GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() {}
44 45
45 // static 46 // static
46 scoped_ptr<GpuMemoryBufferImplIOSurface> 47 std::unique_ptr<GpuMemoryBufferImplIOSurface>
47 GpuMemoryBufferImplIOSurface::CreateFromHandle( 48 GpuMemoryBufferImplIOSurface::CreateFromHandle(
48 const gfx::GpuMemoryBufferHandle& handle, 49 const gfx::GpuMemoryBufferHandle& handle,
49 const gfx::Size& size, 50 const gfx::Size& size,
50 gfx::BufferFormat format, 51 gfx::BufferFormat format,
51 gfx::BufferUsage usage, 52 gfx::BufferUsage usage,
52 const DestructionCallback& callback) { 53 const DestructionCallback& callback) {
53 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( 54 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(
54 IOSurfaceLookupFromMachPort(handle.mach_port.get())); 55 IOSurfaceLookupFromMachPort(handle.mach_port.get()));
55 if (!io_surface) 56 if (!io_surface)
56 return nullptr; 57 return nullptr;
57 58
58 return make_scoped_ptr( 59 return base::WrapUnique(
59 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback, 60 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback,
60 io_surface.release(), LockFlags(usage))); 61 io_surface.release(), LockFlags(usage)));
61 } 62 }
62 63
63 // static 64 // static
64 bool GpuMemoryBufferImplIOSurface::IsConfigurationSupported( 65 bool GpuMemoryBufferImplIOSurface::IsConfigurationSupported(
65 gfx::BufferFormat format, 66 gfx::BufferFormat format,
66 gfx::BufferUsage usage) { 67 gfx::BufferUsage usage) {
67 return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage); 68 return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage);
68 } 69 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 114 }
114 115
115 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { 116 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const {
116 gfx::GpuMemoryBufferHandle handle; 117 gfx::GpuMemoryBufferHandle handle;
117 handle.type = gfx::IO_SURFACE_BUFFER; 118 handle.type = gfx::IO_SURFACE_BUFFER;
118 handle.id = id_; 119 handle.id = id_;
119 return handle; 120 return handle;
120 } 121 }
121 122
122 } // namespace gpu 123 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h ('k') | gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698