Index: gpu/command_buffer/client/mapped_memory.h |
diff --git a/gpu/command_buffer/client/mapped_memory.h b/gpu/command_buffer/client/mapped_memory.h |
index b8f3129eb4a3cddf452e9fabe30ec62a1af12eda..a0f810c6c8c245c820e3019230254356f83da8bd 100644 |
--- a/gpu/command_buffer/client/mapped_memory.h |
+++ b/gpu/command_buffer/client/mapped_memory.h |
@@ -18,7 +18,10 @@ class CommandBufferHelper; |
// Manages a shared memory segment. |
class GPU_EXPORT MemoryChunk { |
public: |
- MemoryChunk(int32 shm_id, gpu::Buffer shm, CommandBufferHelper* helper); |
+ MemoryChunk(int32 shm_id, |
+ gpu::Buffer shm, |
+ bool aggressive_reuse, |
+ CommandBufferHelper* helper); |
// Gets the size of the largest free block that is available without waiting. |
unsigned int GetLargestFreeSizeWithoutWaiting() { |
@@ -107,6 +110,19 @@ class GPU_EXPORT MemoryChunk { |
DISALLOW_COPY_AND_ASSIGN(MemoryChunk); |
}; |
+// Configure MappedMemoryManager |
+struct GPU_EXPORT MappedMemoryManagerSettings { |
+ // |unused_memory_reclaim_limit|: When exceeded this causes pending memory |
+ // to be reclaimed before allocating more memory. |
+ size_t unused_memory_reclaim_limit; |
+ |
+ // |aggressive_reuse|: When set to true, the memory manager will reuse a |
+ // block marked either as FREE or FREE_PENDING_TOKEN. This setting is only |
+ // allowed if the user can guarantee that all parts are done using a block |
+ // that was free:ed by the client. |
+ bool aggressive_reuse; |
+}; |
+ |
// Manages MemoryChunks. |
class GPU_EXPORT MappedMemoryManager { |
public: |
@@ -114,10 +130,8 @@ class GPU_EXPORT MappedMemoryManager { |
kNoLimit = 0, |
}; |
- // |unused_memory_reclaim_limit|: When exceeded this causes pending memory |
- // to be reclaimed before allocating more memory. |
MappedMemoryManager(CommandBufferHelper* helper, |
- size_t unused_memory_reclaim_limit); |
+ MappedMemoryManagerSettings settings); |
~MappedMemoryManager(); |
@@ -175,6 +189,7 @@ class GPU_EXPORT MappedMemoryManager { |
MemoryChunkVector chunks_; |
size_t allocated_memory_; |
size_t max_free_bytes_; |
+ bool aggressive_reuse_; |
DISALLOW_COPY_AND_ASSIGN(MappedMemoryManager); |
}; |