summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client/mapped_memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/command_buffer/client/mapped_memory.h')
-rw-r--r--gpu/command_buffer/client/mapped_memory.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/gpu/command_buffer/client/mapped_memory.h b/gpu/command_buffer/client/mapped_memory.h
index f5f3e37..ed66664 100644
--- a/gpu/command_buffer/client/mapped_memory.h
+++ b/gpu/command_buffer/client/mapped_memory.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -90,6 +90,11 @@ class MemoryChunk {
pointer < reinterpret_cast<const int8*>(shm_.ptr) + shm_.size;
}
+ // Returns true of any memory in this chuck is in use.
+ bool InUse() {
+ return allocator_.InUse();
+ }
+
private:
int32 shm_id_;
gpu::Buffer shm_;
@@ -129,6 +134,14 @@ class MappedMemoryManager {
// token: the token value to wait for before re-using the memory.
void FreePendingToken(void* pointer, int32 token);
+ // Free Any Shared memory that is not in use.
+ void FreeUnused();
+
+ // Used for testing
+ size_t num_chunks() {
+ return chunks_.size();
+ }
+
private:
typedef std::vector<MemoryChunk*> MemoryChunkVector;