summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorhusky@google.com <husky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-06 16:15:45 +0000
committerhusky@google.com <husky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-06 16:15:45 +0000
commitd3388bf4d86a1bc04d62bab777161db5ce51b101 (patch)
treed544e7c06681e68e21c3493b982285a0bd84e3d7 /gpu
parentf680b99364f7e7e733c938f3fb7c6325bf116eb6 (diff)
downloadchromium_src-d3388bf4d86a1bc04d62bab777161db5ce51b101.zip
chromium_src-d3388bf4d86a1bc04d62bab777161db5ce51b101.tar.gz
chromium_src-d3388bf4d86a1bc04d62bab777161db5ce51b101.tar.bz2
Remove debug assertions for redundant FreeID calls.
The GLES conformance tests use double frees. Checking the specs, redundant free calls should be silently ignored. Review URL: http://codereview.chromium.org/7056067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87995 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/common/id_allocator.cc8
-rw-r--r--gpu/command_buffer/common/id_allocator_test.cc15
2 files changed, 19 insertions, 4 deletions
diff --git a/gpu/command_buffer/common/id_allocator.cc b/gpu/command_buffer/common/id_allocator.cc
index e859282..eb450f3 100644
--- a/gpu/command_buffer/common/id_allocator.cc
+++ b/gpu/command_buffer/common/id_allocator.cc
@@ -55,10 +55,10 @@ bool IdAllocator::MarkAsUsed(ResourceId id) {
}
void IdAllocator::FreeID(ResourceId id) {
- GPU_DCHECK(id);
- used_ids_.erase(id);
- std::pair<ResourceIdSet::iterator, bool> result = free_ids_.insert(id);
- GPU_DCHECK(result.second);
+ if (id) {
+ used_ids_.erase(id);
+ free_ids_.insert(id);
+ }
}
bool IdAllocator::InUse(ResourceId id) const {
diff --git a/gpu/command_buffer/common/id_allocator_test.cc b/gpu/command_buffer/common/id_allocator_test.cc
index 69be2f0..624f959 100644
--- a/gpu/command_buffer/common/id_allocator_test.cc
+++ b/gpu/command_buffer/common/id_allocator_test.cc
@@ -110,4 +110,19 @@ TEST_F(IdAllocatorTest, AllocateIdAtOrAboveWrapsAround) {
EXPECT_EQ(2u, id3);
}
+TEST_F(IdAllocatorTest, RedundantFreeIsIgnored) {
+ IdAllocator* allocator = id_allocator();
+ ResourceId id1 = allocator->AllocateID();
+ allocator->FreeID(0);
+ allocator->FreeID(id1);
+ allocator->FreeID(id1);
+ allocator->FreeID(id1 + 1);
+
+ ResourceId id2 = allocator->AllocateID();
+ ResourceId id3 = allocator->AllocateID();
+ EXPECT_NE(id2, id3);
+ EXPECT_NE(kInvalidResource, id2);
+ EXPECT_NE(kInvalidResource, id3);
+}
+
} // namespace gpu