Remove unneeded abandon/release check in GrGpuResource message processing.
Change-Id: Ib11405be82e8ff7fd1edcaca2f19c44cce2abbd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257889
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 6d9a961..5b0fafc 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -645,15 +645,13 @@
SkASSERT(msgs[i].fOwningUniqueID == fContextUniqueID);
uint32_t id = msgs[i].fTexture->uniqueID().asUInt();
TextureAwaitingUnref* info = fTexturesAwaitingUnref.find(id);
- // If we called release or abandon on the GrContext we will have already released our ref on
- // the GrGpuResource. If then the message arrives before the actual GrContext gets destroyed
- // we will try to process the message when we destroy the GrContext. This protects us from
- // trying to unref the resource twice.
- if (info) {
- info->unref();
- if (info->finished()) {
- fTexturesAwaitingUnref.remove(id);
- }
+ // If the GrContext was released or abandoned then fTexturesAwaitingUnref should have been
+ // empty and we would have returned early above. Thus, any texture from a message should be
+ // in the list of fTexturesAwaitingUnref.
+ SkASSERT(info);
+ info->unref();
+ if (info->finished()) {
+ fTexturesAwaitingUnref.remove(id);
}
}
}