X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fcontent%2Fcommon%2Fgpu%2Fclient%2Fgpu_memory_buffer_impl.h;h=af72599c7f2c7b1eb01a23a85db02e00e576ceac;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=ee85f0f7b57ee02d73e5bca5e74ab26cf8cf77c6;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/content/common/gpu/client/gpu_memory_buffer_impl.h b/src/content/common/gpu/client/gpu_memory_buffer_impl.h index ee85f0f..af72599 100644 --- a/src/content/common/gpu/client/gpu_memory_buffer_impl.h +++ b/src/content/common/gpu/client/gpu_memory_buffer_impl.h @@ -14,25 +14,48 @@ namespace content { // Provides common implementation of a GPU memory buffer. class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { public: - static scoped_ptr Create( + virtual ~GpuMemoryBufferImpl(); + + // Creates a GPU memory buffer instance with |size| and |internalformat| for + // |usage|. + static scoped_ptr Create(const gfx::Size& size, + unsigned internalformat, + unsigned usage); + + // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| + // by |child_process|. The |handle| returned can be used by the + // |child_process| to create an instance of this class. + static void AllocateForChildProcess(const gfx::Size& size, + unsigned internalformat, + unsigned usage, + base::ProcessHandle child_process, + gfx::GpuMemoryBufferHandle* handle); + + // Creates an instance from the given |handle|. |size| and |internalformat| + // should match what was used to allocate the |handle|. + static scoped_ptr CreateFromHandle( gfx::GpuMemoryBufferHandle handle, - gfx::Size size, + const gfx::Size& size, unsigned internalformat); - virtual ~GpuMemoryBufferImpl(); - + // Returns true if |internalformat| is a format recognized by this base class. static bool IsFormatValid(unsigned internalformat); + + // Returns true if |usage| is recognized by this base class. + static bool IsUsageValid(unsigned usage); + + // Returns the number of bytes per pixel that must be used by an + // implementation when using |internalformat|. static size_t BytesPerPixel(unsigned internalformat); // Overridden from gfx::GpuMemoryBuffer: virtual bool IsMapped() const OVERRIDE; - virtual uint32 GetStride() const OVERRIDE; protected: - GpuMemoryBufferImpl(gfx::Size size, unsigned internalformat); + GpuMemoryBufferImpl(const gfx::Size& size, unsigned internalformat); const gfx::Size size_; - unsigned internalformat_; + const unsigned internalformat_; bool mapped_; DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);