| 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..7b0d87b5f4a711278a43bfe631b6d874f95be3d7 100644
|
| --- a/gpu/command_buffer/client/mapped_memory.h
|
| +++ b/gpu/command_buffer/client/mapped_memory.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_
|
| #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_
|
|
|
| +#include "base/bind.h"
|
| #include "base/memory/scoped_vector.h"
|
| #include "gpu/command_buffer/client/fenced_allocator.h"
|
| #include "gpu/command_buffer/common/buffer.h"
|
| @@ -18,7 +19,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,
|
| + CommandBufferHelper* helper,
|
| + const base::Closure& poll_callback);
|
|
|
| // Gets the size of the largest free block that is available without waiting.
|
| unsigned int GetLargestFreeSizeWithoutWaiting() {
|
| @@ -117,6 +121,7 @@ class GPU_EXPORT MappedMemoryManager {
|
| // |unused_memory_reclaim_limit|: When exceeded this causes pending memory
|
| // to be reclaimed before allocating more memory.
|
| MappedMemoryManager(CommandBufferHelper* helper,
|
| + const base::Closure& poll_callback,
|
| size_t unused_memory_reclaim_limit);
|
|
|
| ~MappedMemoryManager();
|
| @@ -161,6 +166,15 @@ class GPU_EXPORT MappedMemoryManager {
|
| return chunks_.size();
|
| }
|
|
|
| + size_t bytes_in_use() const {
|
| + size_t bytes_in_use = 0;
|
| + for (size_t ii = 0; ii < chunks_.size(); ++ii) {
|
| + MemoryChunk* chunk = chunks_[ii];
|
| + bytes_in_use += chunk->bytes_in_use();
|
| + }
|
| + return bytes_in_use;
|
| + }
|
| +
|
| // Used for testing
|
| size_t allocated_memory() const {
|
| return allocated_memory_;
|
| @@ -172,6 +186,7 @@ class GPU_EXPORT MappedMemoryManager {
|
| // size a chunk is rounded up to.
|
| unsigned int chunk_size_multiple_;
|
| CommandBufferHelper* helper_;
|
| + base::Closure poll_callback_;
|
| MemoryChunkVector chunks_;
|
| size_t allocated_memory_;
|
| size_t max_free_bytes_;
|
|
|