Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: src/lazy/SkDiscardableMemoryPool.cpp

Issue 114673002: be sure to unlock the discardablememory before deleting it (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkDiscardableMemoryPool.cpp
diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp
index a1b2438a2bcc79a9c80eb3c49c7afc281cda112b..4709709861f59abbfe34cdf4cac281adc496e70a 100644
--- a/src/lazy/SkDiscardableMemoryPool.cpp
+++ b/src/lazy/SkDiscardableMemoryPool.cpp
@@ -47,19 +47,23 @@ SkPoolDiscardableMemory::SkPoolDiscardableMemory(SkDiscardableMemoryPool* pool,
}
SkPoolDiscardableMemory::~SkPoolDiscardableMemory() {
+ SkASSERT(!fLocked); // contract for SkDiscardableMemory
fPool->free(this);
fPool->unref();
}
bool SkPoolDiscardableMemory::lock() {
+ SkASSERT(!fLocked); // contract for SkDiscardableMemory
return fPool->lock(this);
}
void* SkPoolDiscardableMemory::data() {
- return fLocked ? fPointer : NULL;
+ SkASSERT(fLocked); // contract for SkDiscardableMemory
+ return fPointer;
}
void SkPoolDiscardableMemory::unlock() {
+ SkASSERT(fLocked); // contract for SkDiscardableMemory
fPool->unlock(this);
}
« no previous file with comments | « no previous file | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698