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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 815833004: Add a simpler key type for scratch resource keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: final fix Created 6 years 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/GrGpu.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpuResource.cpp
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index 2a5718aefad38a14bd012a16082674ef5e600faa..b2fad0b3f7da2dcd7df53c2d21851be26ce71705 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -19,8 +19,7 @@ static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
}
GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
- : fScratchKey(GrResourceKey::NullScratchKey())
- , fGpu(gpu)
+ : fGpu(gpu)
, fGpuMemorySize(kInvalidGpuMemorySize)
, fUniqueID(CreateUniqueID()) {
if (isWrapped) {
@@ -91,7 +90,6 @@ void GrGpuResource::didChangeGpuMemorySize() const {
bool GrGpuResource::setContentKey(const GrResourceKey& contentKey) {
// Currently this can only be called once and can't be called when the resource is scratch.
- SkASSERT(!contentKey.isScratch());
SkASSERT(this->internalHasRef());
// Wrapped resources can never have a key.
@@ -123,11 +121,10 @@ void GrGpuResource::notifyIsPurgable() const {
}
}
-void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) {
- SkASSERT(fScratchKey.isNullScratch());
- SkASSERT(scratchKey.isScratch());
- SkASSERT(!scratchKey.isNullScratch());
- // Wrapped resources can never have a key.
+void GrGpuResource::setScratchKey(const GrScratchKey& scratchKey) {
+ SkASSERT(!fScratchKey.isValid());
+ SkASSERT(scratchKey.isValid());
+ // Wrapped resources can never have a scratch key.
if (this->isWrapped()) {
return;
}
@@ -135,9 +132,9 @@ void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) {
}
void GrGpuResource::removeScratchKey() {
- if (!this->wasDestroyed() && !fScratchKey.isNullScratch()) {
+ if (!this->wasDestroyed() && fScratchKey.isValid()) {
get_resource_cache2(fGpu)->resourceAccess().willRemoveScratchKey(this);
- fScratchKey = GrResourceKey::NullScratchKey();
+ fScratchKey.reset();
}
}
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698