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

Unified Diff: src/effects/gradients/SkGradientShader.cpp

Issue 1894893002: Modernize and trim down SkOnce. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: might as well class Created 4 years, 8 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
Index: src/effects/gradients/SkGradientShader.cpp
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 6c141dcf80924ce4d2297947d33d9b8d1390ce29..779756f3ba9673fffa1f22e02988c0c2777ce31d 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -322,8 +322,6 @@ SkGradientShaderBase::GradientShaderCache::GradientShaderCache(
: fCacheAlpha(alpha)
, fCacheDither(dither)
, fShader(shader)
- , fCache16Inited(false)
- , fCache32Inited(false)
{
// Only initialize the cache in getCache16/32.
fCache16 = nullptr;
@@ -545,8 +543,7 @@ static inline int SkFixedToFFFF(SkFixed x) {
}
const uint16_t* SkGradientShaderBase::GradientShaderCache::getCache16() {
- SkOnce(&fCache16Inited, &fCache16Mutex, SkGradientShaderBase::GradientShaderCache::initCache16,
- this);
+ fCache16InitOnce(SkGradientShaderBase::GradientShaderCache::initCache16, this);
SkASSERT(fCache16);
return fCache16;
}
@@ -579,8 +576,7 @@ void SkGradientShaderBase::GradientShaderCache::initCache16(GradientShaderCache*
}
const SkPMColor* SkGradientShaderBase::GradientShaderCache::getCache32() {
- SkOnce(&fCache32Inited, &fCache32Mutex, SkGradientShaderBase::GradientShaderCache::initCache32,
- this);
+ fCache32InitOnce(SkGradientShaderBase::GradientShaderCache::initCache32, this);
SkASSERT(fCache32);
return fCache32;
}

Powered by Google App Engine
This is Rietveld 408576698