diff options
author | etienneb@chromium.org <etienneb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-02 19:37:43 +0000 |
---|---|---|
committer | etienneb@chromium.org <etienneb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-02 19:37:43 +0000 |
commit | d7b8c1136f4c894ccbcb731144d199a7cf1af15a (patch) | |
tree | 6e2cffbe680f67c7a9cd3741f3d9c9bb29c860c9 /gpu/command_buffer | |
parent | ccd4266ec63500dd161a7e37d0fe825fd0f1ac68 (diff) | |
download | chromium_src-d7b8c1136f4c894ccbcb731144d199a7cf1af15a.zip chromium_src-d7b8c1136f4c894ccbcb731144d199a7cf1af15a.tar.gz chromium_src-d7b8c1136f4c894ccbcb731144d199a7cf1af15a.tar.bz2 |
Fix an useless DCHECK with an invalid unsigned comparison.
This issue was found by a Linter.
This check is always true, because address_space_consumed_ is unsigned:
DCHECK(address_space_consumed_ >= 0);
I also fixed others DCHECK, the 'improbable' MIN_INT case is handled properly.
R=erikwright@chromium.org,epenner@chromium.org
BUG=
Review URL: https://chromiumcodereview.appspot.com/21102003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215347 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r-- | gpu/command_buffer/service/safe_shared_memory_pool.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gpu/command_buffer/service/safe_shared_memory_pool.cc b/gpu/command_buffer/service/safe_shared_memory_pool.cc index 1489d5f..9ba5390 100644 --- a/gpu/command_buffer/service/safe_shared_memory_pool.cc +++ b/gpu/command_buffer/service/safe_shared_memory_pool.cc @@ -36,7 +36,6 @@ base::SharedMemory* ScopedSafeSharedMemory::shared_memory() { return safe_shared_memory_; } - SafeSharedMemoryPool::SafeSharedMemoryPool() : handles_acquired_(0), handles_consumed_(0), @@ -94,8 +93,8 @@ void SafeSharedMemoryPool:: base::AutoLock scoped_lock(lock_); // Adjust stats. + DCHECK_GT(handles_acquired_, 0); handles_acquired_--; - DCHECK(handles_acquired_ >= 0); MemoryMap::iterator it = memory_.find(handle); CHECK(it != memory_.end()); @@ -103,10 +102,10 @@ void SafeSharedMemoryPool:: CHECK(it->second.safe_shared_memory); if (--it->second.reference_count == 0) { // Adjust stats. + DCHECK_GT(handles_consumed_, 0); handles_consumed_--; + DCHECK_LE(it->second.shm_size, address_space_consumed_); address_space_consumed_ -= it->second.shm_size; - DCHECK(handles_consumed_ >= 0); - DCHECK(address_space_consumed_ >= 0); // Delete the safe memory and remove it. delete it->second.safe_shared_memory; memory_.erase(it); @@ -147,4 +146,4 @@ SharedMemory* SafeSharedMemoryPool::DuplicateSharedMemory( return duped_shared_memory.release(); } -} // namespace gfx +} // namespace gpu |