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

Unified Diff: src/core/SkPixelRef.cpp

Issue 825263005: notify resource caches when pixelref genID goes stale (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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/core/SkPixelRef.cpp
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index a2c37c6e72f92de7ce16d301632dacdb6dbb1fbf..9c7507a4efc639a60b8e5a15c4621e9f5ec9bfe4 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkBitmapCache.h"
#include "SkPixelRef.h"
#include "SkThread.h"
@@ -223,6 +224,7 @@ void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) {
*fGenIDChangeListeners.append() = listener;
}
+// we need to be called *before* the genID gets changed or zerod
void SkPixelRef::callGenIDChangeListeners() {
// We don't invalidate ourselves if we think another SkPixelRef is sharing our genID.
if (fUniqueGenerationID) {
@@ -232,6 +234,12 @@ void SkPixelRef::callGenIDChangeListeners() {
}
// Listeners get at most one shot, so whether these triggered or not, blow them away.
fGenIDChangeListeners.deleteAll();
+
+ // if fGenerationID is 0, then perhaps we never had one, and we are in the destructor
+ if (fGenerationID) {
+ SkBitmapCache::NotifyGenIDStale(fGenerationID);
mtklein 2015/01/07 21:52:43 Feels weird knowing both these calls really grab a
reed1 2015/01/07 22:20:41 Agree on both counts. *if* we (later) standardize
reed1 2015/02/18 17:30:32 Captured this comment in a comment.
+ SkMipMapCache::NotifyGenIDStale(fGenerationID);
+ }
}
void SkPixelRef::notifyPixelsChanged() {

Powered by Google App Engine
This is Rietveld 408576698