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

Unified Diff: src/gpu/GrResourceCache.cpp

Issue 22850006: Replace uses of GrAssert by SkASSERT. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 4 months 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 | « src/gpu/GrResource.cpp ('k') | src/gpu/GrStencil.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache.cpp
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 96b11aaafe5b047cf4cc46e83e3f6594157e21ad..480e0966d05d5fc2b04ec26639ca53a6f0576696 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -28,7 +28,7 @@ GrResourceKey::ResourceType GrResourceKey::GenerateResourceType() {
GrResourceEntry::GrResourceEntry(const GrResourceKey& key, GrResource* resource)
: fKey(key), fResource(resource) {
// we assume ownership of the resource, and will unref it when we die
- GrAssert(resource);
+ SkASSERT(resource);
resource->ref();
}
@@ -39,8 +39,8 @@ GrResourceEntry::~GrResourceEntry() {
#if GR_DEBUG
void GrResourceEntry::validate() const {
- GrAssert(fResource);
- GrAssert(fResource->getCacheEntry() == this);
+ SkASSERT(fResource);
+ SkASSERT(fResource->getCacheEntry() == this);
fResource->validate();
}
#endif
@@ -126,7 +126,7 @@ void GrResourceCache::internalDetach(GrResourceEntry* entry,
#endif
} else {
- GrAssert(kAccountFor_BudgetBehavior == behavior);
+ SkASSERT(kAccountFor_BudgetBehavior == behavior);
fEntryCount -= 1;
fEntryBytes -= entry->resource()->sizeInBytes();
@@ -142,7 +142,7 @@ void GrResourceCache::attachToHead(GrResourceEntry* entry,
fClientDetachedCount -= 1;
fClientDetachedBytes -= entry->resource()->sizeInBytes();
} else {
- GrAssert(kAccountFor_BudgetBehavior == behavior);
+ SkASSERT(kAccountFor_BudgetBehavior == behavior);
fEntryCount += 1;
fEntryBytes += entry->resource()->sizeInBytes();
@@ -199,12 +199,12 @@ GrResource* GrResourceCache::find(const GrResourceKey& key, uint32_t ownershipFl
void GrResourceCache::addResource(const GrResourceKey& key,
GrResource* resource,
uint32_t ownershipFlags) {
- GrAssert(NULL == resource->getCacheEntry());
+ SkASSERT(NULL == resource->getCacheEntry());
// we don't expect to create new resources during a purge. In theory
// this could cause purgeAsNeeded() into an infinite loop (e.g.
// each resource destroyed creates and locks 2 resources and
// unlocks 1 thereby causing a new purge).
- GrAssert(!fPurging);
+ SkASSERT(!fPurging);
GrAutoResourceCacheValidate atcv(this);
GrResourceEntry* entry = SkNEW_ARGS(GrResourceEntry, (key, resource));
@@ -299,7 +299,7 @@ void GrResourceCache::purgeAsNeeded(int extraCount, size_t extraBytes) {
}
void GrResourceCache::deleteResource(GrResourceEntry* entry) {
- GrAssert(1 == entry->fResource->getRefCnt());
+ SkASSERT(1 == entry->fResource->getRefCnt());
// remove from our cache
fCache.remove(entry->key(), entry);
@@ -361,15 +361,15 @@ void GrResourceCache::purgeAllUnlocked() {
this->purgeAsNeeded();
#if GR_DEBUG
- GrAssert(fExclusiveList.countEntries() == fClientDetachedCount);
- GrAssert(countBytes(fExclusiveList) == fClientDetachedBytes);
+ SkASSERT(fExclusiveList.countEntries() == fClientDetachedCount);
+ SkASSERT(countBytes(fExclusiveList) == fClientDetachedBytes);
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(fList.isEmpty());
+ SkASSERT(fEntryCount == fClientDetachedCount);
+ SkASSERT(fEntryBytes == fClientDetachedBytes);
+ SkASSERT(fList.isEmpty());
}
#endif
@@ -401,11 +401,11 @@ static bool both_zero_or_nonzero(int count, size_t bytes) {
void GrResourceCache::validate() const {
fList.validate();
fExclusiveList.validate();
- GrAssert(both_zero_or_nonzero(fEntryCount, fEntryBytes));
- GrAssert(both_zero_or_nonzero(fClientDetachedCount, fClientDetachedBytes));
- GrAssert(fClientDetachedBytes <= fEntryBytes);
- GrAssert(fClientDetachedCount <= fEntryCount);
- GrAssert((fEntryCount - fClientDetachedCount) == fCache.count());
+ SkASSERT(both_zero_or_nonzero(fEntryCount, fEntryBytes));
+ SkASSERT(both_zero_or_nonzero(fClientDetachedCount, fClientDetachedBytes));
+ SkASSERT(fClientDetachedBytes <= fEntryBytes);
+ SkASSERT(fClientDetachedCount <= fEntryCount);
+ SkASSERT((fEntryCount - fClientDetachedCount) == fCache.count());
fCache.validate();
@@ -426,20 +426,20 @@ void GrResourceCache::validate() const {
int count = 0;
for ( ; NULL != entry; entry = iter.next()) {
entry->validate();
- GrAssert(fCache.find(entry->key()));
+ SkASSERT(fCache.find(entry->key()));
count += 1;
}
- GrAssert(count == fEntryCount - fClientDetachedCount);
+ SkASSERT(count == fEntryCount - fClientDetachedCount);
size_t bytes = countBytes(fList);
- GrAssert(bytes == fEntryBytes - fClientDetachedBytes);
+ SkASSERT(bytes == fEntryBytes - fClientDetachedBytes);
bytes = countBytes(fExclusiveList);
- GrAssert(bytes == fClientDetachedBytes);
+ SkASSERT(bytes == fClientDetachedBytes);
- GrAssert(fList.countEntries() == fEntryCount - fClientDetachedCount);
+ SkASSERT(fList.countEntries() == fEntryCount - fClientDetachedCount);
- GrAssert(fExclusiveList.countEntries() == fClientDetachedCount);
+ SkASSERT(fExclusiveList.countEntries() == fClientDetachedCount);
}
#endif // GR_DEBUG
« no previous file with comments | « src/gpu/GrResource.cpp ('k') | src/gpu/GrStencil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698