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

Unified Diff: src/core/SkImageFilter.cpp

Issue 380703002: Revert of Remove ability for Release code to call getRefCnt() or getWeakRefCnt(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « include/core/SkWeakRefCnt.h ('k') | tests/ClipCacheTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index b67fbe01e7b926fbedc5e1a52c5b2b21fbd8eaff..4c4b56beace2f60b9ff858e70c76cd6c1f3b2cd7 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -379,10 +379,7 @@
class CacheImpl : public SkImageFilter::Cache {
public:
- explicit CacheImpl(int minChildren) : fMinChildren(minChildren) {
- SkASSERT(fMinChildren <= 2);
- }
-
+ explicit CacheImpl(int minChildren) : fMinChildren(minChildren) {}
virtual ~CacheImpl();
bool get(const SkImageFilter* key, SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
void set(const SkImageFilter* key, const SkBitmap& result, const SkIPoint& offset) SK_OVERRIDE;
@@ -425,10 +422,7 @@
}
void CacheImpl::set(const SkImageFilter* key, const SkBitmap& result, const SkIPoint& offset) {
- if (fMinChildren < 2 || !key->unique()) {
- // We take !key->unique() as a signal that there are probably at least 2 refs on the key,
- // meaning this filter probably has at least two children and is worth caching when
- // fMinChildren is 2. If fMinChildren is less than two, we'll just always cache.
+ if (key->getRefCnt() >= fMinChildren) {
fData.add(new Value(key, result, offset));
}
}
« no previous file with comments | « include/core/SkWeakRefCnt.h ('k') | tests/ClipCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698