// Implementation of GPU memory buffer based on SurfaceTextures.
class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl {
public:
- GpuMemoryBufferImplSurfaceTexture(const gfx::Size& size,
- unsigned internalformat);
- virtual ~GpuMemoryBufferImplSurfaceTexture();
+ static void Create(gfx::GpuMemoryBufferId id,
+ const gfx::Size& size,
+ Format format,
+ int client_id,
+ const CreationCallback& callback);
+
+ static void AllocateForChildProcess(gfx::GpuMemoryBufferId id,
+ const gfx::Size& size,
+ Format format,
+ int child_client_id,
+ const AllocationCallback& callback);
+
+ static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
+ const gfx::GpuMemoryBufferHandle& handle,
+ const gfx::Size& size,
+ Format format,
+ const DestructionCallback& callback);
- static bool IsFormatSupported(unsigned internalformat);
- static bool IsUsageSupported(unsigned usage);
- static bool IsConfigurationSupported(unsigned internalformat, unsigned usage);
- static int WindowFormat(unsigned internalformat);
+ static void DeletedByChildProcess(gfx::GpuMemoryBufferId id,
+ int child_client_id,
+ uint32_t sync_point);
- bool InitializeFromHandle(gfx::GpuMemoryBufferHandle handle);
+ static bool IsFormatSupported(Format format);
+ static bool IsUsageSupported(Usage usage);
+ static bool IsConfigurationSupported(Format format, Usage usage);
+ static int WindowFormat(Format format);
// Overridden from gfx::GpuMemoryBuffer:
- virtual void* Map() OVERRIDE;
- virtual void Unmap() OVERRIDE;
- virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE;
- virtual uint32 GetStride() const OVERRIDE;
+ virtual void* Map() override;
+ virtual void Unmap() override;
+ virtual gfx::GpuMemoryBufferHandle GetHandle() const override;
+ virtual uint32 GetStride() const override;
private:
- gfx::SurfaceTextureId surface_texture_id_;
+ GpuMemoryBufferImplSurfaceTexture(gfx::GpuMemoryBufferId id,
+ const gfx::Size& size,
+ Format format,
+ const DestructionCallback& callback,
+ ANativeWindow* native_window);
+ virtual ~GpuMemoryBufferImplSurfaceTexture();
+
ANativeWindow* native_window_;
size_t stride_;