Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / common / gpu / client / gpu_memory_buffer_impl_io_surface.h
blobc5dc048dde1f4d7c4ef0f586d2cdf7933f608a22
1 // Copyright 2013 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_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_
8 #include <IOSurface/IOSurface.h>
10 #include "base/mac/scoped_cftyperef.h"
11 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
13 namespace content {
15 // Implementation of GPU memory buffer based on IO surfaces.
16 class GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl {
17 public:
18 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
19 const gfx::GpuMemoryBufferHandle& handle,
20 const gfx::Size& size,
21 Format format,
22 Usage usage,
23 const DestructionCallback& callback);
25 // Overridden from gfx::GpuMemoryBuffer:
26 bool Map(void** data) override;
27 void Unmap() override;
28 void GetStride(int* stride) const override;
29 gfx::GpuMemoryBufferHandle GetHandle() const override;
31 private:
32 GpuMemoryBufferImplIOSurface(gfx::GpuMemoryBufferId id,
33 const gfx::Size& size,
34 Format format,
35 const DestructionCallback& callback,
36 IOSurfaceRef io_surface,
37 uint32_t lock_flags);
38 ~GpuMemoryBufferImplIOSurface() override;
40 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_;
41 uint32_t lock_flags_;
43 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface);
46 } // namespace content
48 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_