| OLD | NEW |
| 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 "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" | 5 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/gfx/buffer_format_util.h" | 10 #include "ui/gfx/buffer_format_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 io_surfaces_[key] = io_surface; | 40 io_surfaces_[key] = io_surface; |
| 41 } | 41 } |
| 42 | 42 |
| 43 gfx::GpuMemoryBufferHandle handle; | 43 gfx::GpuMemoryBufferHandle handle; |
| 44 handle.type = gfx::IO_SURFACE_BUFFER; | 44 handle.type = gfx::IO_SURFACE_BUFFER; |
| 45 handle.id = id; | 45 handle.id = id; |
| 46 handle.mach_port.reset(IOSurfaceCreateMachPort(io_surface)); | 46 handle.mach_port.reset(IOSurfaceCreateMachPort(io_surface)); |
| 47 return handle; | 47 return handle; |
| 48 } | 48 } |
| 49 | 49 |
| 50 gfx::GpuMemoryBufferHandle | |
| 51 GpuMemoryBufferFactoryIOSurface::CreateGpuMemoryBufferFromHandle( | |
| 52 const gfx::GpuMemoryBufferHandle& handle, | |
| 53 gfx::GpuMemoryBufferId id, | |
| 54 const gfx::Size& size, | |
| 55 gfx::BufferFormat format, | |
| 56 int client_id) { | |
| 57 NOTIMPLEMENTED(); | |
| 58 return gfx::GpuMemoryBufferHandle(); | |
| 59 } | |
| 60 | |
| 61 void GpuMemoryBufferFactoryIOSurface::DestroyGpuMemoryBuffer( | 50 void GpuMemoryBufferFactoryIOSurface::DestroyGpuMemoryBuffer( |
| 62 gfx::GpuMemoryBufferId id, | 51 gfx::GpuMemoryBufferId id, |
| 63 int client_id) { | 52 int client_id) { |
| 64 { | 53 { |
| 65 base::AutoLock lock(io_surfaces_lock_); | 54 base::AutoLock lock(io_surfaces_lock_); |
| 66 | 55 |
| 67 IOSurfaceMapKey key(id, client_id); | 56 IOSurfaceMapKey key(id, client_id); |
| 68 DCHECK(io_surfaces_.find(key) != io_surfaces_.end()); | 57 DCHECK(io_surfaces_.find(key) != io_surfaces_.end()); |
| 69 io_surfaces_.erase(key); | 58 io_surfaces_.erase(key); |
| 70 } | 59 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 91 | 80 |
| 92 scoped_refptr<gl::GLImageIOSurface> image( | 81 scoped_refptr<gl::GLImageIOSurface> image( |
| 93 new gl::GLImageIOSurface(size, internalformat)); | 82 new gl::GLImageIOSurface(size, internalformat)); |
| 94 if (!image->Initialize(it->second.get(), handle.id, format)) | 83 if (!image->Initialize(it->second.get(), handle.id, format)) |
| 95 return scoped_refptr<gl::GLImage>(); | 84 return scoped_refptr<gl::GLImage>(); |
| 96 | 85 |
| 97 return image; | 86 return image; |
| 98 } | 87 } |
| 99 | 88 |
| 100 } // namespace content | 89 } // namespace content |
| OLD | NEW |