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

Unified Diff: src/core/SkPixelRef.cpp

Issue 959763002: Revert of fAddedToCache doesn't need to be atomic. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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/SkPixelRef.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPixelRef.cpp
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 24ee4733cb47d1b4594d8744c4d3550521a75900..560748c463c99dfa84cea4857085c6ff392261b8 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -100,7 +100,7 @@
this->needsNewGenID();
fIsImmutable = false;
fPreLocked = false;
- fAddedToCache = false;
+ fAddedToCache.store(false);
}
@@ -116,7 +116,7 @@
this->needsNewGenID();
fIsImmutable = false;
fPreLocked = false;
- fAddedToCache = false;
+ fAddedToCache.store(false);
}
SkPixelRef::~SkPixelRef() {
@@ -227,9 +227,10 @@
fGenIDChangeListeners[i]->onChange();
}
- if (fAddedToCache) {
+ // TODO: SkAtomic could add "old_value = atomic.xchg(new_value)" to make this clearer.
+ if (fAddedToCache.load()) {
SkNotifyBitmapGenIDIsStale(this->getGenerationID());
- fAddedToCache = false;
+ fAddedToCache.store(false);
}
}
// Listeners get at most one shot, so whether these triggered or not, blow them away.
« no previous file with comments | « include/core/SkPixelRef.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698