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

Unified Diff: gpu/command_buffer/common/buffer.cc

Issue 213353005: Refactor gpu::Buffer to allow different types of backing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix pointer alignment in tests Created 6 years, 9 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
« no previous file with comments | « gpu/command_buffer/common/buffer.h ('k') | gpu/command_buffer/service/command_buffer_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/common/buffer.cc
diff --git a/gpu/command_buffer/common/buffer.cc b/gpu/command_buffer/common/buffer.cc
index bbf40a1c7e8ed3020154e960f04b116b455e6a27..3b3da4345d766cc484f5a5c53419db61e0538839 100644
--- a/gpu/command_buffer/common/buffer.cc
+++ b/gpu/command_buffer/common/buffer.cc
@@ -9,11 +9,23 @@
#include "base/numerics/safe_math.h"
namespace gpu {
+SharedMemoryBufferBacking::SharedMemoryBufferBacking(
+ scoped_ptr<base::SharedMemory> shared_memory,
+ size_t size)
+ : shared_memory_(shared_memory.Pass()), size_(size) {}
-Buffer::Buffer(scoped_ptr<base::SharedMemory> shared_memory, size_t size)
- : shared_memory_(shared_memory.Pass()),
- memory_(shared_memory_->memory()),
- size_(size) {
+SharedMemoryBufferBacking::~SharedMemoryBufferBacking() {}
+
+void* SharedMemoryBufferBacking::GetMemory() const {
+ return shared_memory_->memory();
+}
+
+size_t SharedMemoryBufferBacking::GetSize() const { return size_; }
+
+Buffer::Buffer(scoped_ptr<BufferBacking> backing)
+ : backing_(backing.Pass()),
+ memory_(backing_->GetMemory()),
+ size_(backing_->GetSize()) {
DCHECK(memory_) << "The memory must be mapped to create a Buffer";
}
« no previous file with comments | « gpu/command_buffer/common/buffer.h ('k') | gpu/command_buffer/service/command_buffer_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698