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); |
} |