aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrResourceKey.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-02-06 11:54:28 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-06 11:54:28 -0800
commit23e619cf462b2a8a500f3ca750e099f79601f508 (patch)
treeee448aaed72aa80f035a8b7b2ec285cd8aadfd2b /include/gpu/GrResourceKey.h
parentd0423587ac56ae84d3f1eb796d5c1e2dfba9646e (diff)
Reimplement gpu message bus for invalidated bitmap gen IDs
Diffstat (limited to 'include/gpu/GrResourceKey.h')
-rw-r--r--include/gpu/GrResourceKey.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/gpu/GrResourceKey.h b/include/gpu/GrResourceKey.h
index e09a2c710f..906bc6a4be 100644
--- a/include/gpu/GrResourceKey.h
+++ b/include/gpu/GrResourceKey.h
@@ -46,11 +46,13 @@ protected:
}
GrResourceKey& operator=(const GrResourceKey& that) {
+ SkASSERT(that.isValid());
if (this != &that) {
size_t bytes = that.size();
SkASSERT(SkIsAlign4(bytes));
fKey.reset(SkToInt(bytes / sizeof(uint32_t)));
memcpy(fKey.get(), that.fKey.get(), bytes);
+ this->validate();
}
return *this;
}
@@ -236,4 +238,17 @@ public:
};
};
+// The cache listens for these messages to purge junk resources proactively.
+class GrContentKeyInvalidatedMessage {
+public:
+ explicit GrContentKeyInvalidatedMessage(const GrContentKey& key) : fKey(key) {}
+ GrContentKeyInvalidatedMessage(const GrContentKeyInvalidatedMessage& that) : fKey(that.fKey) {}
+ GrContentKeyInvalidatedMessage& operator=(const GrContentKeyInvalidatedMessage& that) {
+ fKey = that.fKey;
+ return *this;
+ }
+ const GrContentKey& key() const { return fKey; }
+private:
+ GrContentKey fKey;
+};
#endif