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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 481443002: Add GrResourceCache2. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix leaks Created 6 years, 4 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/GrGpu.cpp ('k') | src/gpu/GrLayerCache.cpp » ('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 8c2dc4508009a10fa181fd477636c35743b94a1d..7a19c25e46dcf5806db47955b7f22818d75f95a5 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -8,19 +8,27 @@
#include "GrGpuResource.h"
+#include "GrResourceCache2.h"
#include "GrGpu.h"
+static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
+ SkASSERT(NULL != gpu);
+ SkASSERT(NULL != gpu->getContext());
+ SkASSERT(NULL != gpu->getContext()->getResourceCache2());
+ return gpu->getContext()->getResourceCache2();
+}
+
GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
- : fRefCnt(1)
+ : fGpu(gpu)
+ , fRefCnt(1)
, fCacheEntry(NULL)
, fUniqueID(CreateUniqueID()) {
- fGpu = gpu;
if (isWrapped) {
fFlags = kWrapped_FlagBit;
} else {
fFlags = 0;
}
- fGpu->insertObject(this);
+ get_resource_cache2(fGpu)->insertResource(this);
}
GrGpuResource::~GrGpuResource() {
@@ -32,7 +40,7 @@ GrGpuResource::~GrGpuResource() {
void GrGpuResource::release() {
if (NULL != fGpu) {
this->onRelease();
- fGpu->removeObject(this);
+ get_resource_cache2(fGpu)->removeResource(this);
fGpu = NULL;
}
}
@@ -40,7 +48,7 @@ void GrGpuResource::release() {
void GrGpuResource::abandon() {
if (NULL != fGpu) {
this->onAbandon();
- fGpu->removeObject(this);
+ get_resource_cache2(fGpu)->removeResource(this);
fGpu = NULL;
}
}
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698