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

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

Issue 23130004: Enforce a memory limit on MappedMemoryManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fixes Created 7 years, 4 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.h
diff --git a/gpu/command_buffer/client/mapped_memory.h b/gpu/command_buffer/client/mapped_memory.h
index ec70c430de5969f66e652242b8554254e6c932b0..abd8fa92001b1100d06a4901786ecd374a12d856 100644
--- a/gpu/command_buffer/client/mapped_memory.h
+++ b/gpu/command_buffer/client/mapped_memory.h
@@ -79,7 +79,7 @@ class GPU_EXPORT MemoryChunk {
allocator_.FreePendingToken(pointer, token);
}
- // Frees any blocks who's tokens have passed.
+ // Frees any blocks whose tokens have passed.
void FreeUnused() {
allocator_.FreeUnused();
}
@@ -90,7 +90,7 @@ class GPU_EXPORT MemoryChunk {
pointer < reinterpret_cast<const int8*>(shm_.ptr) + shm_.size;
}
- // Returns true of any memory in this chuck is in use.
+ // Returns true of any memory in this chunk is in use.
bool InUse() {
return allocator_.InUse();
}
@@ -103,7 +103,7 @@ class GPU_EXPORT MemoryChunk {
DISALLOW_COPY_AND_ASSIGN(MemoryChunk);
};
-// Manages MemoryChucks.
+// Manages MemoryChunks.
class GPU_EXPORT MappedMemoryManager {
public:
explicit MappedMemoryManager(CommandBufferHelper* helper);
@@ -151,12 +151,18 @@ class GPU_EXPORT MappedMemoryManager {
}
private:
+ enum MemoryLimit {
+ kNoLimit = 0,
+ kAndroidLowEndLimit = 8 * 1024 * 1024,
+ };
typedef ScopedVector<MemoryChunk> MemoryChunkVector;
// size a chunk is rounded up to.
unsigned int chunk_size_multiple_;
CommandBufferHelper* helper_;
MemoryChunkVector chunks_;
+ size_t allocated_memory_;
+ size_t memory_limit_;
DISALLOW_COPY_AND_ASSIGN(MappedMemoryManager);
};
« no previous file with comments | « no previous file | gpu/command_buffer/client/mapped_memory.cc » ('j') | gpu/command_buffer/client/mapped_memory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698