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

Unified Diff: gpu/command_buffer/service/command_buffer_service.cc

Issue 211703003: GPU: 'Pass' SharedMemory when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@GPU_ref_count_buffer
Patch Set: Rebase. 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 ec538c974d90368724577264cda0bdd552aa32f4..58b96ac21d648ebca4fc8173db38a35548d4d203 100644
--- a/gpu/command_buffer/service/command_buffer_service.cc
+++ b/gpu/command_buffer/service/command_buffer_service.cc
@@ -123,14 +123,14 @@ scoped_refptr<Buffer> CommandBufferService::CreateTransferBuffer(size_t size,
int32* id) {
*id = -1;
- SharedMemory buffer;
- if (!buffer.CreateAnonymous(size))
+ scoped_ptr<SharedMemory> shared_memory(new SharedMemory());
+ if (!shared_memory->CreateAndMapAnonymous(size))
return NULL;
static int32 next_id = 1;
*id = next_id++;
- if (!RegisterTransferBuffer(*id, &buffer, size)) {
+ if (!RegisterTransferBuffer(*id, shared_memory.Pass(), size)) {
*id = -1;
return NULL;
}
@@ -155,11 +155,10 @@ scoped_refptr<Buffer> CommandBufferService::GetTransferBuffer(int32 id) {
bool CommandBufferService::RegisterTransferBuffer(
int32 id,
- base::SharedMemory* shared_memory,
+ scoped_ptr<base::SharedMemory> shared_memory,
size_t size) {
- return transfer_buffer_manager_->RegisterTransferBuffer(id,
- shared_memory,
- size);
+ return transfer_buffer_manager_->RegisterTransferBuffer(
+ id, shared_memory.Pass(), size);
}
void CommandBufferService::SetToken(int32 token) {
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/command_buffer/service/transfer_buffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698