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

Unified Diff: gpu/command_buffer/client/mapped_memory.cc

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Async upload token part of existing Async command; use separate shared memory to sync async upload … Created 6 years, 10 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/client/mapped_memory.cc
diff --git a/gpu/command_buffer/client/mapped_memory.cc b/gpu/command_buffer/client/mapped_memory.cc
index 15584aaaf07daebf1bf20ba5225e086bfc1da4db..56f155e35ced9846d43034dd53e5d8bef8af048f 100644
--- a/gpu/command_buffer/client/mapped_memory.cc
+++ b/gpu/command_buffer/client/mapped_memory.cc
@@ -13,17 +13,21 @@
namespace gpu {
-MemoryChunk::MemoryChunk(
- int32 shm_id, gpu::Buffer shm, CommandBufferHelper* helper)
+MemoryChunk::MemoryChunk(int32 shm_id,
+ gpu::Buffer shm,
+ CommandBufferHelper* helper,
+ const base::Closure& poll_callback)
: shm_id_(shm_id),
shm_(shm),
- allocator_(shm.size, helper, shm.ptr) {
+ allocator_(shm.size, helper, poll_callback, shm.ptr) {
}
MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper,
+ const base::Closure& poll_callback,
size_t unused_memory_reclaim_limit)
: chunk_size_multiple_(1),
helper_(helper),
+ poll_callback_(poll_callback),
allocated_memory_(0),
max_free_bytes_(unused_memory_reclaim_limit) {
}
@@ -85,7 +89,7 @@ void* MappedMemoryManager::Alloc(
gpu::Buffer shm = cmd_buf->CreateTransferBuffer(chunk_size, &id);
if (id < 0)
return NULL;
- MemoryChunk* mc = new MemoryChunk(id, shm, helper_);
+ MemoryChunk* mc = new MemoryChunk(id, shm, helper_, poll_callback_);
allocated_memory_ += mc->GetSize();
chunks_.push_back(mc);
void* mem = mc->Alloc(size);

Powered by Google App Engine
This is Rietveld 408576698