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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 720033004: Correct accounting for wrapped resources (Closed) Base URL: https://skia.googlesource.com/skia.git@res2
Patch Set: rebase again Created 6 years, 1 month 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/GrContext.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 fcc5f4de509e56f5419371cb7e056e57f3d45fd9..ea3756b8dd07733fe5e711331d853fb5cecf28b6 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -87,6 +87,11 @@ 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.
+ if (this->isWrapped()) {
+ return false;
+ }
if (fContentKeySet || this->wasDestroyed()) {
return false;
@@ -116,6 +121,10 @@ void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) {
SkASSERT(fScratchKey.isNullScratch());
SkASSERT(scratchKey.isScratch());
SkASSERT(!scratchKey.isNullScratch());
+ // Wrapped resources can never have a key.
+ if (this->isWrapped()) {
+ return;
+ }
fScratchKey = scratchKey;
}
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698