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