Update V8 to version 4.7.42.
[chromium-blink-merge.git] / content / common / gpu / gpu_memory_buffer_factory.h
blob1269c960f203f0cd3c69896eb9c282c274b0f7f5
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 <vector>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/common/content_export.h"
13 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/gpu_memory_buffer.h"
15 #include "ui/gfx/native_widget_types.h"
17 namespace gfx {
18 class GLImage;
21 namespace gpu {
22 class ImageFactory;
25 namespace content {
27 class CONTENT_EXPORT GpuMemoryBufferFactory {
28 public:
29 struct Configuration {
30 gfx::BufferFormat format;
31 gfx::BufferUsage usage;
34 virtual ~GpuMemoryBufferFactory() {}
36 // Gets system supported GPU memory buffer factory types. Preferred type at
37 // the front of vector.
38 static void GetSupportedTypes(std::vector<gfx::GpuMemoryBufferType>* types);
40 // Creates a new factory instance for |type|.
41 static scoped_ptr<GpuMemoryBufferFactory> Create(
42 gfx::GpuMemoryBufferType type);
44 // Gets supported format/usage configurations.
45 virtual void GetSupportedGpuMemoryBufferConfigurations(
46 std::vector<Configuration>* configurations) = 0;
48 // Creates a new GPU memory buffer instance. A valid handle is returned on
49 // success. It can be called on any thread.
50 virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
51 gfx::GpuMemoryBufferId id,
52 const gfx::Size& size,
53 gfx::BufferFormat format,
54 gfx::BufferUsage usage,
55 int client_id,
56 gfx::PluginWindowHandle surface_handle) = 0;
58 // Destroys GPU memory buffer identified by |id|.
59 // It can be called on any thread.
60 virtual void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
61 int client_id) = 0;
63 // Type-checking downcast routine.
64 virtual gpu::ImageFactory* AsImageFactory() = 0;
66 protected:
67 GpuMemoryBufferFactory() {}
69 private:
70 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactory);
73 } // namespace content
75 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_H_