Remove incorrect GrAssert calls in GrResourceCache::removeAll
authortwiz@google.com <twiz@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 21 Feb 2012 19:15:53 +0000 (19:15 +0000)
committertwiz@google.com <twiz@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 21 Feb 2012 19:15:53 +0000 (19:15 +0000)
The asserts in GrResourceCache are too aggressive, and assume that all resources are always purged.  Locked resources will not be purged.

BUG=114861
Review URL: https://codereview.appspot.com/5674096

git-svn-id: http://skia.googlecode.com/svn/trunk@3226 2bbb7eff-a529-9590-31e7-b0007b416f81

src/gpu/GrResourceCache.cpp

index afbe9b3..ba6452d 100644 (file)
@@ -304,14 +304,18 @@ void GrResourceCache::removeAll() {
     fMaxCount = 0;
     this->purgeAsNeeded();
 
-    GrAssert(!fCache.count());
+#if GR_DEBUG
     GrAssert(!fUnlockedEntryCount);
-    // Items may have been detached from the cache (such as the backing texture
-    // for an SkGpuDevice). The above purge would not have removed them.
-    GrAssert(fEntryCount == fClientDetachedCount);
-    GrAssert(fEntryBytes == fClientDetachedBytes);
-    GrAssert(NULL == fHead);
-    GrAssert(NULL == fTail);
+    if (!fCache.count()) {
+        // Items may have been detached from the cache (such as the backing
+        // texture for an SkGpuDevice). The above purge would not have removed
+        // them.
+        GrAssert(fEntryCount == fClientDetachedCount);
+        GrAssert(fEntryBytes == fClientDetachedBytes);
+        GrAssert(NULL == fHead);
+        GrAssert(NULL == fTail);
+    }
+#endif
 
     fMaxBytes = savedMaxBytes;
     fMaxCount = savedMaxCount;