diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-30 00:17:36 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-30 00:17:36 +0000 |
commit | f5b5f8584c0951c3d26e9cb088792d132b48c203 (patch) | |
tree | 92e37fc94ca9251d21ef707ad32147b70956f962 /gpu/command_buffer/client/ring_buffer.cc | |
parent | 3dc141fb1830a112f50b96411ab6841fc8c0c16c (diff) | |
download | chromium_src-f5b5f8584c0951c3d26e9cb088792d132b48c203.zip chromium_src-f5b5f8584c0951c3d26e9cb088792d132b48c203.tar.gz chromium_src-f5b5f8584c0951c3d26e9cb088792d132b48c203.tar.bz2 |
Fix Bug in RingBuffer
TEST=unit test
BUG=42859
Review URL: http://codereview.chromium.org/1806003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client/ring_buffer.cc')
-rw-r--r-- | gpu/command_buffer/client/ring_buffer.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gpu/command_buffer/client/ring_buffer.cc b/gpu/command_buffer/client/ring_buffer.cc index 678110a..89da7fe 100644 --- a/gpu/command_buffer/client/ring_buffer.cc +++ b/gpu/command_buffer/client/ring_buffer.cc @@ -40,11 +40,13 @@ void RingBuffer::FreeOldestBlock() { in_use_offset_ = 0; free_offset_ = 0; } - blocks_.pop_back(); + blocks_.pop_front(); } RingBuffer::Offset RingBuffer::Alloc(unsigned int size) { DCHECK_LE(size, size_) << "attempt to allocate more than maximum memory"; + DCHECK(blocks_.empty() || blocks_.back().valid) + << "Attempt to alloc another block before freeing the previous."; // Similarly to malloc, an allocation of 0 allocates at least 1 byte, to // return different pointers every time. if (size == 0) size = 1; @@ -82,6 +84,8 @@ void RingBuffer::FreePendingToken(RingBuffer::Offset offset, } unsigned int RingBuffer::GetLargestFreeSizeNoWaiting() { + // TODO(gman): Should check what the current token is and free up to that + // point. if (free_offset_ == in_use_offset_) { if (blocks_.empty()) { // The entire buffer is free. |