| 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 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_H_ | 5 #ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_H_ | 6 #define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "content/common/content_export.h" | 13 #include "gpu/gpu_export.h" |
| 14 #include "gpu/ipc/common/surface_handle.h" | 14 #include "gpu/ipc/common/surface_handle.h" |
| 15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
| 16 #include "ui/gfx/gpu_memory_buffer.h" | 16 #include "ui/gfx/gpu_memory_buffer.h" |
| 17 | 17 |
| 18 namespace gpu { | 18 namespace gpu { |
| 19 |
| 19 class ImageFactory; | 20 class ImageFactory; |
| 20 } | |
| 21 | 21 |
| 22 namespace content { | 22 class GPU_EXPORT GpuMemoryBufferFactory { |
| 23 | |
| 24 class CONTENT_EXPORT GpuMemoryBufferFactory { | |
| 25 public: | 23 public: |
| 26 virtual ~GpuMemoryBufferFactory() {} | 24 virtual ~GpuMemoryBufferFactory() {} |
| 27 | 25 |
| 28 // Creates a new factory instance for native GPU memory buffers. | 26 // Creates a new factory instance for native GPU memory buffers. |
| 29 static scoped_ptr<GpuMemoryBufferFactory> CreateNativeType(); | 27 static scoped_ptr<GpuMemoryBufferFactory> CreateNativeType(); |
| 30 | 28 |
| 31 // Creates a new GPU memory buffer instance. A valid handle is returned on | 29 // Creates a new GPU memory buffer instance. A valid handle is returned on |
| 32 // success. It can be called on any thread. | 30 // success. It can be called on any thread. |
| 33 virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 31 virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| 34 gfx::GpuMemoryBufferId id, | 32 gfx::GpuMemoryBufferId id, |
| 35 const gfx::Size& size, | 33 const gfx::Size& size, |
| 36 gfx::BufferFormat format, | 34 gfx::BufferFormat format, |
| 37 gfx::BufferUsage usage, | 35 gfx::BufferUsage usage, |
| 38 int client_id, | 36 int client_id, |
| 39 gpu::SurfaceHandle surface_handle) = 0; | 37 SurfaceHandle surface_handle) = 0; |
| 40 | 38 |
| 41 // Creates a new GPU memory buffer instance from an existing handle. A valid | 39 // Creates a new GPU memory buffer instance from an existing handle. A valid |
| 42 // handle is returned on success. It can be called on any thread. | 40 // handle is returned on success. It can be called on any thread. |
| 43 virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromHandle( | 41 virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromHandle( |
| 44 const gfx::GpuMemoryBufferHandle& handle, | 42 const gfx::GpuMemoryBufferHandle& handle, |
| 45 gfx::GpuMemoryBufferId id, | 43 gfx::GpuMemoryBufferId id, |
| 46 const gfx::Size& size, | 44 const gfx::Size& size, |
| 47 gfx::BufferFormat format, | 45 gfx::BufferFormat format, |
| 48 int client_id) = 0; | 46 int client_id) = 0; |
| 49 | 47 |
| 50 // Destroys GPU memory buffer identified by |id|. | 48 // Destroys GPU memory buffer identified by |id|. |
| 51 // It can be called on any thread. | 49 // It can be called on any thread. |
| 52 virtual void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 50 virtual void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 53 int client_id) = 0; | 51 int client_id) = 0; |
| 54 | 52 |
| 55 // Type-checking downcast routine. | 53 // Type-checking downcast routine. |
| 56 virtual gpu::ImageFactory* AsImageFactory() = 0; | 54 virtual ImageFactory* AsImageFactory() = 0; |
| 57 | 55 |
| 58 protected: | 56 protected: |
| 59 GpuMemoryBufferFactory() {} | 57 GpuMemoryBufferFactory() {} |
| 60 | 58 |
| 61 private: | 59 private: |
| 62 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactory); | 60 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactory); |
| 63 }; | 61 }; |
| 64 | 62 |
| 65 } // namespace content | 63 } // namespace gpu |
| 66 | 64 |
| 67 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_H_ | 65 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_H_ |
| OLD | NEW |