diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-24 22:13:02 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-24 22:13:02 +0000 |
commit | d7cf069b24322b95745d75ec6fa3244488900d20 (patch) | |
tree | f2552fe477e99d150614d339354db4f9ac4c5054 /gpu/command_buffer/client/mapped_memory.h | |
parent | 15ec7dc683f017e4312f921f815f5b44a6476de6 (diff) | |
download | chromium_src-d7cf069b24322b95745d75ec6fa3244488900d20.zip chromium_src-d7cf069b24322b95745d75ec6fa3244488900d20.tar.gz chromium_src-d7cf069b24322b95745d75ec6fa3244488900d20.tar.bz2 |
Add GLES2Implemention::FreeUnusedSharedMemory
This is to help get the compositor free memory when appropritate
BUG=none
TEST=unit tests
R=vangelis@chromium.org
Review URL: http://codereview.chromium.org/8369010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106987 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client/mapped_memory.h')
-rw-r--r-- | gpu/command_buffer/client/mapped_memory.h | 15 |
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; |