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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 715333003: Revert of Replace GrResourceCache with GrResourceCache2. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 be8ea0daf07f744a921b06a2b3684be1b3c9066e..f6f7282700a3d7e231ceab522d4e11933f595723 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -18,8 +18,16 @@
return gpu->getContext()->getResourceCache2();
}
+static inline GrResourceCache* get_resource_cache(GrGpu* gpu) {
+ SkASSERT(gpu);
+ SkASSERT(gpu->getContext());
+ SkASSERT(gpu->getContext()->getResourceCache());
+ return gpu->getContext()->getResourceCache();
+}
+
GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
: fGpu(gpu)
+ , fCacheEntry(NULL)
, fGpuMemorySize(kInvalidGpuMemorySize)
, fUniqueID(CreateUniqueID())
, fScratchKey(GrResourceKey::NullScratchKey())
@@ -32,7 +40,7 @@
}
void GrGpuResource::registerWithCache() {
- get_resource_cache2(fGpu)->resourceAccess().insertResource(this);
+ get_resource_cache2(fGpu)->insertResource(this);
}
GrGpuResource::~GrGpuResource() {
@@ -43,18 +51,16 @@
void GrGpuResource::release() {
if (fGpu) {
this->onRelease();
- get_resource_cache2(fGpu)->resourceAccess().removeResource(this);
+ get_resource_cache2(fGpu)->removeResource(this);
fGpu = NULL;
- fGpuMemorySize = 0;
}
}
void GrGpuResource::abandon() {
if (fGpu) {
this->onAbandon();
- get_resource_cache2(fGpu)->resourceAccess().removeResource(this);
+ get_resource_cache2(fGpu)->removeResource(this);
fGpu = NULL;
- fGpuMemorySize = 0;
}
}
@@ -74,17 +80,6 @@
}
}
-void GrGpuResource::didChangeGpuMemorySize() const {
- if (this->wasDestroyed()) {
- return;
- }
-
- size_t oldSize = fGpuMemorySize;
- SkASSERT(kInvalidGpuMemorySize != oldSize);
- fGpuMemorySize = kInvalidGpuMemorySize;
- get_resource_cache2(fGpu)->resourceAccess().didChangeGpuMemorySize(this, oldSize);
-}
-
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());
@@ -97,7 +92,7 @@
fContentKey = contentKey;
fContentKeySet = true;
- if (!get_resource_cache2(fGpu)->resourceAccess().didSetContentKey(this)) {
+ if (!get_resource_cache2(fGpu)->didSetContentKey(this)) {
fContentKeySet = false;
return false;
}
@@ -105,8 +100,8 @@
}
void GrGpuResource::notifyIsPurgable() const {
- if (!this->wasDestroyed()) {
- get_resource_cache2(fGpu)->resourceAccess().notifyPurgable(this);
+ if (fCacheEntry && !this->wasDestroyed()) {
+ get_resource_cache(fGpu)->notifyPurgable(this);
}
}
« 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