Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl.h

Issue 263553009: content: Cleanup GpuMemoryBuffer allocation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac build fix Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/client/gpu_memory_buffer_impl.h
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl.h b/content/common/gpu/client/gpu_memory_buffer_impl.h
index fcab9abbe6018ef838ed6d4cd7e8f326a5278e12..af72599c7f2c7b1eb01a23a85db02e00e576ceac 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl.h
+++ b/content/common/gpu/client/gpu_memory_buffer_impl.h
@@ -14,26 +14,48 @@ namespace content {
// Provides common implementation of a GPU memory buffer.
class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
public:
- static scoped_ptr<GpuMemoryBufferImpl> Create(
+ virtual ~GpuMemoryBufferImpl();
+
+ // Creates a GPU memory buffer instance with |size| and |internalformat| for
+ // |usage|.
+ static scoped_ptr<GpuMemoryBufferImpl> 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<GpuMemoryBufferImpl> 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);
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | content/common/gpu/client/gpu_memory_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698