Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / common / gpu / client / gpu_memory_buffer_impl_ozone_native_buffer.h
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_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_H_
7
8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
9
10 namespace content {
11
12 // Implementation of GPU memory buffer based on Ozone native buffers.
13 class GpuMemoryBufferImplOzoneNativeBuffer : public GpuMemoryBufferImpl {
14  public:
15   static void Create(gfx::GpuMemoryBufferId id,
16                      const gfx::Size& size,
17                      Format format,
18                      int client_id,
19                      const CreationCallback& callback);
20
21   static void AllocateForChildProcess(gfx::GpuMemoryBufferId id,
22                                       const gfx::Size& size,
23                                       Format format,
24                                       int child_client_id,
25                                       const AllocationCallback& callback);
26
27   static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
28       const gfx::GpuMemoryBufferHandle& handle,
29       const gfx::Size& size,
30       Format format,
31       const DestructionCallback& callback);
32
33   static void DeletedByChildProcess(gfx::GpuMemoryBufferId id,
34                                     int child_client_id,
35                                     uint32_t sync_point);
36
37   static bool IsFormatSupported(Format format);
38   static bool IsUsageSupported(Usage usage);
39   static bool IsConfigurationSupported(Format format, Usage usage);
40
41   // Overridden from gfx::GpuMemoryBuffer:
42   void* Map() override;
43   void Unmap() override;
44   uint32 GetStride() const override;
45   gfx::GpuMemoryBufferHandle GetHandle() const override;
46
47  private:
48   GpuMemoryBufferImplOzoneNativeBuffer(gfx::GpuMemoryBufferId id,
49                                        const gfx::Size& size,
50                                        Format format,
51                                        const DestructionCallback& callback);
52   ~GpuMemoryBufferImplOzoneNativeBuffer() override;
53
54   DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplOzoneNativeBuffer);
55 };
56
57 }  // namespace content
58
59 #endif  // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_H_