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

Unified Diff: src/gpu/GrResourceCache2.cpp

Issue 902873002: Reimplement gpu message bus for invalidated bitmap gen IDs (Closed) Base URL: https://skia.googlesource.com/skia.git@one_tex
Patch Set: fix speeling error 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 | « src/gpu/GrResourceCache2.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache2.cpp
diff --git a/src/gpu/GrResourceCache2.cpp b/src/gpu/GrResourceCache2.cpp
index 84a8d48cbc057c5337ca1ddc7dfb137e73b73953..c1656593b5e3195f2197dbeb70d9e243d8209f79 100644
--- a/src/gpu/GrResourceCache2.cpp
+++ b/src/gpu/GrResourceCache2.cpp
@@ -14,7 +14,7 @@
#include "SkGr.h"
#include "SkMessageBus.h"
-DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage);
+DECLARE_SKMESSAGEBUS_MESSAGE(GrContentKeyInvalidatedMessage);
//////////////////////////////////////////////////////////////////////////////
@@ -221,6 +221,13 @@ void GrResourceCache2::willRemoveScratchKey(const GrGpuResource* resource) {
fScratchMap.remove(resource->cacheAccess().getScratchKey(), resource);
}
+void GrResourceCache2::willRemoveContentKey(const GrGpuResource* resource) {
+ // Someone has a ref to this resource in order to invalidate it. When the ref count reaches
+ // zero we will get a notifyPurgable() and figure out what to do with it.
+ SkASSERT(resource->getContentKey().isValid());
+ fContentHash.remove(resource->getContentKey());
+}
+
bool GrResourceCache2::didSetContentKey(GrGpuResource* resource) {
SkASSERT(!fPurging);
SkASSERT(resource);
@@ -406,6 +413,17 @@ void GrResourceCache2::purgeAllUnlocked() {
this->validate();
}
+void GrResourceCache2::processInvalidContentKeys(
+ const SkTArray<GrContentKeyInvalidatedMessage>& msgs) {
+ for (int i = 0; i < msgs.count(); ++i) {
+ GrGpuResource* resource = this->findAndRefContentResource(msgs[i].key());
+ if (resource) {
+ resource->cacheAccess().removeContentKey();
+ resource->unref(); // will call notifyPurgeable, if it is indeed now purgeable.
+ }
+ }
+}
+
#ifdef SK_DEBUG
void GrResourceCache2::validate() const {
// Reduce the frequency of validations for large resource counts.
« no previous file with comments | « src/gpu/GrResourceCache2.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698