Chromium Code Reviews| 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/gpu/gpu_memory_buffer_factory_io_surface.h" | 8 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" |
| 9 #include "ui/gfx/buffer_format_util.h" | 9 #include "ui/gfx/buffer_format_util.h" |
| 10 #include "ui/gfx/mac/io_surface_manager.h" | 10 #include "ui/gfx/mac/io_surface_manager.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 // static | 48 // static |
| 49 scoped_ptr<GpuMemoryBufferImplIOSurface> | 49 scoped_ptr<GpuMemoryBufferImplIOSurface> |
| 50 GpuMemoryBufferImplIOSurface::CreateFromHandle( | 50 GpuMemoryBufferImplIOSurface::CreateFromHandle( |
| 51 const gfx::GpuMemoryBufferHandle& handle, | 51 const gfx::GpuMemoryBufferHandle& handle, |
| 52 const gfx::Size& size, | 52 const gfx::Size& size, |
| 53 gfx::BufferFormat format, | 53 gfx::BufferFormat format, |
| 54 gfx::BufferUsage usage, | 54 gfx::BufferUsage usage, |
| 55 const DestructionCallback& callback) { | 55 const DestructionCallback& callback) { |
| 56 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( | 56 base::ScopedCFTypeRef<IOSurfaceRef> io_surface( |
| 57 gfx::IOSurfaceManager::GetInstance()->AcquireIOSurface(handle.id)); | 57 gfx::IOSurfaceManager::GetInstance()->AcquireIOSurface(handle.id)); |
| 58 if (!io_surface) | 58 CHECK(io_surface); |
|
reveman
2015/12/01 20:49:04
I think this needs to be able to fail without cras
| |
| 59 return nullptr; | |
| 60 | 59 |
| 61 return make_scoped_ptr( | 60 return make_scoped_ptr( |
| 62 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback, | 61 new GpuMemoryBufferImplIOSurface(handle.id, size, format, callback, |
| 63 io_surface.release(), LockFlags(usage))); | 62 io_surface.release(), LockFlags(usage))); |
| 64 } | 63 } |
| 65 | 64 |
| 66 // static | 65 // static |
| 67 bool GpuMemoryBufferImplIOSurface::IsConfigurationSupported( | 66 bool GpuMemoryBufferImplIOSurface::IsConfigurationSupported( |
| 68 gfx::BufferFormat format, | 67 gfx::BufferFormat format, |
| 69 gfx::BufferUsage usage) { | 68 gfx::BufferUsage usage) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 } | 114 } |
| 116 | 115 |
| 117 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { | 116 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { |
| 118 gfx::GpuMemoryBufferHandle handle; | 117 gfx::GpuMemoryBufferHandle handle; |
| 119 handle.type = gfx::IO_SURFACE_BUFFER; | 118 handle.type = gfx::IO_SURFACE_BUFFER; |
| 120 handle.id = id_; | 119 handle.id = id_; |
| 121 return handle; | 120 return handle; |
| 122 } | 121 } |
| 123 | 122 |
| 124 } // namespace content | 123 } // namespace content |
| OLD | NEW |