Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / browser / gpu / gpu_memory_buffer_factory_host_impl.h
1 // Copyright (c) 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_BROWSER_GPU_GPU_MEMORY_BUFFER_FACTORY_HOST_IMPL_H_
6 #define CONTENT_BROWSER_GPU_GPU_MEMORY_BUFFER_FACTORY_HOST_IMPL_H_
7
8 #include <map>
9
10 #include "content/common/gpu/client/gpu_memory_buffer_factory_host.h"
11
12 namespace content {
13
14 class CONTENT_EXPORT GpuMemoryBufferFactoryHostImpl
15     : public GpuMemoryBufferFactoryHost {
16  public:
17   GpuMemoryBufferFactoryHostImpl();
18   ~GpuMemoryBufferFactoryHostImpl() override;
19
20   // Overridden from GpuMemoryBufferFactoryHost:
21   void CreateGpuMemoryBuffer(
22       gfx::GpuMemoryBufferType type,
23       gfx::GpuMemoryBufferId id,
24       const gfx::Size& size,
25       gfx::GpuMemoryBuffer::Format format,
26       gfx::GpuMemoryBuffer::Usage usage,
27       int client_id,
28       const CreateGpuMemoryBufferCallback& callback) override;
29   void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferType type,
30                               gfx::GpuMemoryBufferId id,
31                               int client_id,
32                               int32 sync_point) override;
33
34   void set_gpu_host_id(int gpu_host_id) { gpu_host_id_ = gpu_host_id; }
35
36  private:
37   void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferType type,
38                                   gfx::GpuMemoryBufferId id,
39                                   int client_id,
40                                   int32 sync_point);
41   void OnGpuMemoryBufferCreated(uint32 request_id,
42                                 const gfx::GpuMemoryBufferHandle& handle);
43
44   int gpu_host_id_;
45   uint32 next_create_gpu_memory_buffer_request_id_;
46   typedef std::map<uint32, CreateGpuMemoryBufferCallback>
47       CreateGpuMemoryBufferCallbackMap;
48   CreateGpuMemoryBufferCallbackMap create_gpu_memory_buffer_requests_;
49
50   DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryHostImpl);
51 };
52
53 }  // namespace content
54
55 #endif  // CONTENT_BROWSER_GPU_GPU_MEMORY_BUFFER_FACTORY_HOST_IMPL_H_