Revert "Reintroduce deinstantiate lazy proxy types and use for promise images."
This reverts commit 8b40ac35b2ec31a61c751e610b891681df272283.
Reason for revert: breaks viz_unittests
Original change's description:
> Reintroduce deinstantiate lazy proxy types and use for promise images.
>
> This reverts a fraction of b2c5dae65df952999f0a12b9df80bc1433ffa19a to
> restore the deinstantiate lazy proxy type, supporting implementation,
> and tests.
>
> Use them for promise images to avoid thread safety issues for promise
> image resources. Makes promise image instantiation callbacks do a thread
> safe unref of their fulfilled GrTexture in GrResourceCache. The
> GrResourceCache mechanism for receiving unref messages is extended to
> allow multiple pending unrefs. All this is new.
>
>
> Bug: skia:8800
> Change-Id: I7b1d4fea13c053b6fbbd39c0c6eaf567b8bf81f1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199002
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: Iba960efba4290a284294c62d0470ad7e932c174a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8800
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200460
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index 84378e6..c948864 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -16,7 +16,6 @@
#include "SkRefCnt.h"
#include "SkTArray.h"
#include "SkTDPQueue.h"
-#include "SkTHash.h"
#include "SkTInternalLList.h"
#include "SkTMultiMap.h"
@@ -196,7 +195,7 @@
bool requestsFlush() const { return this->overBudget() && !fPurgeableQueue.count(); }
/** Maintain a ref to this resource until we receive a GrGpuResourceFreedMessage. */
- void insertDelayedResourceUnref(GrGpuResource* resource);
+ void insertCrossContextGpuResource(GrGpuResource* resource);
#if GR_CACHE_STATS
struct Stats {
@@ -306,25 +305,6 @@
};
typedef SkTDynamicHash<GrGpuResource, GrUniqueKey, UniqueHashTraits> UniqueHash;
- class ResourceAwaitingUnref {
- public:
- ResourceAwaitingUnref();
- ResourceAwaitingUnref(GrGpuResource* resource);
- ResourceAwaitingUnref(const ResourceAwaitingUnref&) = delete;
- ResourceAwaitingUnref& operator=(const ResourceAwaitingUnref&) = delete;
- ResourceAwaitingUnref(ResourceAwaitingUnref&&);
- ResourceAwaitingUnref& operator=(ResourceAwaitingUnref&&);
- ~ResourceAwaitingUnref();
- void addRef();
- void unref();
- bool finished();
-
- private:
- GrGpuResource* fResource = nullptr;
- int fNumUnrefs = 0;
- };
- using ReourcesAwaitingUnref = SkTHashMap<uint32_t, ResourceAwaitingUnref>;
-
static bool CompareTimestamp(GrGpuResource* const& a, GrGpuResource* const& b) {
return a->cacheAccess().timestamp() < b->cacheAccess().timestamp();
}
@@ -373,7 +353,8 @@
InvalidUniqueKeyInbox fInvalidUniqueKeyInbox;
FreedGpuResourceInbox fFreedGpuResourceInbox;
- ReourcesAwaitingUnref fResourcesAwaitingUnref;
+
+ SkTDArray<GrGpuResource*> fResourcesWaitingForFreeMsg;
uint32_t fContextUniqueID;
GrSingleOwner* fSingleOwner;