OLD | NEW |
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 "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/mac/io_surface_manager.h" | 8 #include "content/common/mac/io_surface_manager.h" |
9 #include "ui/gfx/buffer_format_util.h" | 9 #include "ui/gfx/buffer_format_util.h" |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 // static | 43 // static |
44 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplIOSurface::CreateFromHandle( | 44 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplIOSurface::CreateFromHandle( |
45 const gfx::GpuMemoryBufferHandle& handle, | 45 const gfx::GpuMemoryBufferHandle& handle, |
46 const gfx::Size& size, | 46 const gfx::Size& size, |
47 gfx::BufferFormat format, | 47 gfx::BufferFormat format, |
48 gfx::BufferUsage usage, | 48 gfx::BufferUsage usage, |
49 const DestructionCallback& callback) { | 49 const DestructionCallback& callback) { |
50 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( | 50 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( |
51 IOSurfaceManager::GetInstance()->AcquireIOSurface(handle.id)); | 51 IOSurfaceManager::GetInstance()->AcquireIOSurface(handle.id.id)); |
52 if (!io_surface) | 52 if (!io_surface) |
53 return nullptr; | 53 return nullptr; |
54 | 54 |
55 return make_scoped_ptr<GpuMemoryBufferImpl>( | 55 return make_scoped_ptr<GpuMemoryBufferImpl>( |
56 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback, | 56 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback, |
57 io_surface.release(), LockFlags(usage))); | 57 io_surface.release(), LockFlags(usage))); |
58 } | 58 } |
59 | 59 |
60 bool GpuMemoryBufferImplIOSurface::Map(void** data) { | 60 bool GpuMemoryBufferImplIOSurface::Map(void** data) { |
61 DCHECK(!mapped_); | 61 DCHECK(!mapped_); |
(...skipping 19 matching lines...) Expand all Loading... |
81 } | 81 } |
82 | 82 |
83 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { | 83 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { |
84 gfx::GpuMemoryBufferHandle handle; | 84 gfx::GpuMemoryBufferHandle handle; |
85 handle.type = gfx::IO_SURFACE_BUFFER; | 85 handle.type = gfx::IO_SURFACE_BUFFER; |
86 handle.id = id_; | 86 handle.id = id_; |
87 return handle; | 87 return handle; |
88 } | 88 } |
89 | 89 |
90 } // namespace content | 90 } // namespace content |
OLD | NEW |