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 CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "ui/gfx/geometry/size.h" |
| 10 #include "ui/gfx/gpu_memory_buffer.h" |
| 11 |
| 12 namespace gfx { |
| 13 class GLImage; |
| 14 } |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class GpuMemoryBufferFactory { |
| 19 public: |
| 20 GpuMemoryBufferFactory() {} |
| 21 virtual ~GpuMemoryBufferFactory() {} |
| 22 |
| 23 // Creates a new platform specific factory instance. |
| 24 static scoped_ptr<GpuMemoryBufferFactory> Create(); |
| 25 |
| 26 // Creates a GPU memory buffer instance from |handle|. Whether the storage for |
| 27 // the buffer is passed with the handle or allocated as part of buffer |
| 28 // creation depends on the type. A valid handle is returned on success. |
| 29 virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| 30 const gfx::GpuMemoryBufferHandle& handle, |
| 31 const gfx::Size& size, |
| 32 unsigned internalformat, |
| 33 unsigned usage) = 0; |
| 34 |
| 35 // Destroys GPU memory buffer identified by |handle|. |
| 36 virtual void DestroyGpuMemoryBuffer( |
| 37 const gfx::GpuMemoryBufferHandle& handle) = 0; |
| 38 |
| 39 // Creates a GLImage instance for GPU memory buffer identified by |handle|. |
| 40 // |client_id| should be set to the client requesting the creation of instance |
| 41 // and can be used by factory implementation to verify access rights. |
| 42 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( |
| 43 const gfx::GpuMemoryBufferHandle& handle, |
| 44 const gfx::Size& size, |
| 45 unsigned internalformat, |
| 46 int client_id) = 0; |
| 47 |
| 48 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactory); |
| 50 }; |
| 51 |
| 52 } // namespace content |
| 53 |
| 54 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_H_ |
OLD | NEW |