diff options
author | mtklein <mtklein@chromium.org> | 2015-02-25 08:11:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-25 08:11:18 -0800 |
commit | fbe0edfec4fed2a09e12b049d527d280f16e75b3 (patch) | |
tree | f9e3b35c9b7d8a518c002507f013f665de9cda91 | |
parent | 88ec329b580a081d9d56cbcaad0ee46cb941c849 (diff) |
fAddedToCache doesn't need to be atomic.
It's only ever read or set from non-threadsafe methods.
BUG=skia:
Review URL: https://codereview.chromium.org/960573002
-rw-r--r-- | include/core/SkPixelRef.h | 4 | ||||
-rw-r--r-- | src/core/SkPixelRef.cpp | 9 |
2 files changed, 6 insertions, 7 deletions
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h index 01303e5be5..daf6af1438 100644 --- a/include/core/SkPixelRef.h +++ b/include/core/SkPixelRef.h @@ -248,7 +248,7 @@ public: // Call when this pixelref is part of the key to a resourcecache entry. This allows the cache // to know automatically those entries can be purged when this pixelref is changed or deleted. void notifyAddedToCache() { - fAddedToCache.store(true); + fAddedToCache = true; } protected: @@ -321,7 +321,7 @@ private: mutable SkAtomic<uint32_t> fGenerationID; mutable SkAtomic<bool> fUniqueGenerationID; - SkAtomic<bool> fAddedToCache; + bool fAddedToCache; #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK const uint32_t fStableID; #endif diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp index 560748c463..24ee4733cb 100644 --- a/src/core/SkPixelRef.cpp +++ b/src/core/SkPixelRef.cpp @@ -100,7 +100,7 @@ SkPixelRef::SkPixelRef(const SkImageInfo& info) this->needsNewGenID(); fIsImmutable = false; fPreLocked = false; - fAddedToCache.store(false); + fAddedToCache = false; } @@ -116,7 +116,7 @@ SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) this->needsNewGenID(); fIsImmutable = false; fPreLocked = false; - fAddedToCache.store(false); + fAddedToCache = false; } SkPixelRef::~SkPixelRef() { @@ -227,10 +227,9 @@ void SkPixelRef::callGenIDChangeListeners() { fGenIDChangeListeners[i]->onChange(); } - // TODO: SkAtomic could add "old_value = atomic.xchg(new_value)" to make this clearer. - if (fAddedToCache.load()) { + if (fAddedToCache) { SkNotifyBitmapGenIDIsStale(this->getGenerationID()); - fAddedToCache.store(false); + fAddedToCache = false; } } // Listeners get at most one shot, so whether these triggered or not, blow them away. |