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

Side by Side Diff: gpu/command_buffer/client/mapped_memory.cc

Issue 500243002: Remove implicit conversions from scoped_refptr to T* in gpu/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert silliness Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/client/mapped_memory.h" 5 #include "gpu/command_buffer/client/mapped_memory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Make a new chunk to satisfy the request. 84 // Make a new chunk to satisfy the request.
85 CommandBuffer* cmd_buf = helper_->command_buffer(); 85 CommandBuffer* cmd_buf = helper_->command_buffer();
86 unsigned int chunk_size = 86 unsigned int chunk_size =
87 ((size + chunk_size_multiple_ - 1) / chunk_size_multiple_) * 87 ((size + chunk_size_multiple_ - 1) / chunk_size_multiple_) *
88 chunk_size_multiple_; 88 chunk_size_multiple_;
89 int32 id = -1; 89 int32 id = -1;
90 scoped_refptr<gpu::Buffer> shm = 90 scoped_refptr<gpu::Buffer> shm =
91 cmd_buf->CreateTransferBuffer(chunk_size, &id); 91 cmd_buf->CreateTransferBuffer(chunk_size, &id);
92 if (id < 0) 92 if (id < 0)
93 return NULL; 93 return NULL;
94 DCHECK(shm); 94 DCHECK(shm.get());
95 MemoryChunk* mc = new MemoryChunk(id, shm, helper_, poll_callback_); 95 MemoryChunk* mc = new MemoryChunk(id, shm, helper_, poll_callback_);
96 allocated_memory_ += mc->GetSize(); 96 allocated_memory_ += mc->GetSize();
97 chunks_.push_back(mc); 97 chunks_.push_back(mc);
98 void* mem = mc->Alloc(size); 98 void* mem = mc->Alloc(size);
99 DCHECK(mem); 99 DCHECK(mem);
100 *shm_id = mc->shm_id(); 100 *shm_id = mc->shm_id();
101 *shm_offset = mc->GetOffset(mem); 101 *shm_offset = mc->GetOffset(mem);
102 return mem; 102 return mem;
103 } 103 }
104 104
(...skipping 29 matching lines...) Expand all
134 cmd_buf->DestroyTransferBuffer(chunk->shm_id()); 134 cmd_buf->DestroyTransferBuffer(chunk->shm_id());
135 allocated_memory_ -= chunk->GetSize(); 135 allocated_memory_ -= chunk->GetSize();
136 iter = chunks_.erase(iter); 136 iter = chunks_.erase(iter);
137 } else { 137 } else {
138 ++iter; 138 ++iter;
139 } 139 }
140 } 140 }
141 } 141 }
142 142
143 } // namespace gpu 143 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.cc ('k') | gpu/command_buffer/client/transfer_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698