Switch GrTextureFreedMessages over to using DirectContextIDs
Bug: skia:11728
Change-Id: I514f917577a4166c2834f72fc8c64ab85b259938
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382879
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index ac22385..4c5cb85 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -27,7 +27,7 @@
DECLARE_SKMESSAGEBUS_MESSAGE(GrUniqueKeyInvalidatedMessage, uint32_t, true);
-DECLARE_SKMESSAGEBUS_MESSAGE(GrTextureFreedMessage, uint32_t, true);
+DECLARE_SKMESSAGEBUS_MESSAGE(GrTextureFreedMessage, GrDirectContext::DirectContextID, true);
#define ASSERT_SINGLE_OWNER GR_ASSERT_SINGLE_OWNER(fSingleOwner)
@@ -108,12 +108,16 @@
//////////////////////////////////////////////////////////////////////////////
-GrResourceCache::GrResourceCache(GrSingleOwner* singleOwner, uint32_t contextUniqueID)
- : fInvalidUniqueKeyInbox(contextUniqueID)
- , fFreedTextureInbox(contextUniqueID)
- , fContextUniqueID(contextUniqueID)
+GrResourceCache::GrResourceCache(GrSingleOwner* singleOwner,
+ GrDirectContext::DirectContextID owningContextID,
+ uint32_t familyID)
+ : fInvalidUniqueKeyInbox(familyID)
+ , fFreedTextureInbox(owningContextID)
+ , fOwningContextID(owningContextID)
+ , fContextUniqueID(familyID)
, fSingleOwner(singleOwner) {
- SkASSERT(contextUniqueID != SK_InvalidUniqueID);
+ SkASSERT(owningContextID.isValid());
+ SkASSERT(familyID != SK_InvalidUniqueID);
}
GrResourceCache::~GrResourceCache() {
@@ -679,7 +683,7 @@
SkTArray<GrTextureFreedMessage> msgs;
fFreedTextureInbox.poll(&msgs);
for (int i = 0; i < msgs.count(); ++i) {
- SkASSERT(msgs[i].fOwningUniqueID == fContextUniqueID);
+ SkASSERT(msgs[i].fIntendedRecipient == fOwningContextID);
uint32_t id = msgs[i].fTexture->uniqueID().asUInt();
TextureAwaitingUnref* info = fTexturesAwaitingUnref.find(id);
// If the GrContext was released or abandoned then fTexturesAwaitingUnref should have been