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