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

Unified Diff: gpu/command_buffer/service/command_buffer_service.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
Index: gpu/command_buffer/service/command_buffer_service.cc
diff --git a/gpu/command_buffer/service/command_buffer_service.cc b/gpu/command_buffer/service/command_buffer_service.cc
index df2bd074273b45c6685bdc15b861bc77d5c462ae..30617c8ffa53754fea204e00d485ec1d2aca3fc5 100644
--- a/gpu/command_buffer/service/command_buffer_service.cc
+++ b/gpu/command_buffer/service/command_buffer_service.cc
@@ -103,17 +103,15 @@ void CommandBufferService::SetGetBuffer(int32 transfer_buffer_id) {
UpdateState();
}
-bool CommandBufferService::SetSharedStateBuffer(
- scoped_ptr<base::SharedMemory> shared_state_shm) {
- shared_state_shm_.reset(shared_state_shm.release());
- if (!shared_state_shm_->Map(sizeof(*shared_state_)))
- return false;
+void CommandBufferService::SetSharedStateBuffer(
+ scoped_ptr<BufferBacking> shared_state_buffer) {
+ shared_state_buffer_ = shared_state_buffer.Pass();
+ DCHECK(shared_state_buffer_->GetSize() >= sizeof(*shared_state_));
shared_state_ =
- static_cast<CommandBufferSharedState*>(shared_state_shm_->memory());
+ static_cast<CommandBufferSharedState*>(shared_state_buffer_->GetMemory());
UpdateState();
- return true;
}
void CommandBufferService::SetGetOffset(int32 get_offset) {
@@ -132,7 +130,8 @@ scoped_refptr<Buffer> CommandBufferService::CreateTransferBuffer(size_t size,
static int32 next_id = 1;
*id = next_id++;
- if (!RegisterTransferBuffer(*id, shared_memory.Pass(), size)) {
+ if (!RegisterTransferBuffer(
+ *id, MakeBackingFromSharedMemory(shared_memory.Pass(), size))) {
*id = -1;
return NULL;
}
@@ -157,10 +156,8 @@ scoped_refptr<Buffer> CommandBufferService::GetTransferBuffer(int32 id) {
bool CommandBufferService::RegisterTransferBuffer(
int32 id,
- scoped_ptr<base::SharedMemory> shared_memory,
- size_t size) {
- return transfer_buffer_manager_->RegisterTransferBuffer(
- id, shared_memory.Pass(), size);
+ scoped_ptr<BufferBacking> buffer) {
+ return transfer_buffer_manager_->RegisterTransferBuffer(id, buffer.Pass());
}
void CommandBufferService::SetToken(int32 token) {
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/command_buffer/service/common_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698