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 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 // static | 42 // static |
43 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplIOSurface::CreateFromHandle( | 43 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplIOSurface::CreateFromHandle( |
44 const gfx::GpuMemoryBufferHandle& handle, | 44 const gfx::GpuMemoryBufferHandle& handle, |
45 const gfx::Size& size, | 45 const gfx::Size& size, |
46 gfx::BufferFormat format, | 46 gfx::BufferFormat format, |
47 gfx::BufferUsage usage, | 47 gfx::BufferUsage usage, |
48 const DestructionCallback& callback) { | 48 const DestructionCallback& callback) { |
49 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( | 49 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( |
50 IOSurfaceManager::GetInstance()->AcquireIOSurface(handle.id)); | 50 IOSurfaceManager::GetInstance()->AcquireIOSurface(handle.id.id)); |
51 if (!io_surface) | 51 if (!io_surface) |
52 return nullptr; | 52 return nullptr; |
53 | 53 |
54 return make_scoped_ptr<GpuMemoryBufferImpl>( | 54 return make_scoped_ptr<GpuMemoryBufferImpl>( |
55 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback, | 55 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback, |
56 io_surface.release(), LockFlags(usage))); | 56 io_surface.release(), LockFlags(usage))); |
57 } | 57 } |
58 | 58 |
59 bool GpuMemoryBufferImplIOSurface::Map(void** data) { | 59 bool GpuMemoryBufferImplIOSurface::Map(void** data) { |
60 DCHECK(!mapped_); | 60 DCHECK(!mapped_); |
(...skipping 15 matching lines...) Expand all Loading... |
76 } | 76 } |
77 | 77 |
78 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { | 78 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { |
79 gfx::GpuMemoryBufferHandle handle; | 79 gfx::GpuMemoryBufferHandle handle; |
80 handle.type = gfx::IO_SURFACE_BUFFER; | 80 handle.type = gfx::IO_SURFACE_BUFFER; |
81 handle.id = id_; | 81 handle.id = id_; |
82 return handle; | 82 return handle; |
83 } | 83 } |
84 | 84 |
85 } // namespace content | 85 } // namespace content |
OLD | NEW |