aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTextureOpList.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-06-19 13:09:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-19 19:51:20 +0000
commitc994a93b327235182c6d29a782c409b2c58476ae (patch)
treedba9ab1ff4a414e76da883f47ee90acbf0f27868 /src/gpu/GrTextureOpList.cpp
parent4d75975b70c454288226afc03e512ad9bc2db5ac (diff)
Move op memory storage to GrContext (take 2)
TBR=bsalomon@google.com Change-Id: I4a448694d4114d83cd3a720cfc8bd37de51733d1 Reviewed-on: https://skia-review.googlesource.com/135707 Reviewed-by: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrTextureOpList.cpp')
-rw-r--r--src/gpu/GrTextureOpList.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp
index a868b5d393..6a601aa83c 100644
--- a/src/gpu/GrTextureOpList.cpp
+++ b/src/gpu/GrTextureOpList.cpp
@@ -11,6 +11,7 @@
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
+#include "GrMemoryPool.h"
#include "GrResourceAllocator.h"
#include "GrTextureProxy.h"
#include "SkStringUtils.h"
@@ -19,12 +20,28 @@
////////////////////////////////////////////////////////////////////////////////
GrTextureOpList::GrTextureOpList(GrResourceProvider* resourceProvider,
+ sk_sp<GrOpMemoryPool> opMemoryPool,
GrTextureProxy* proxy,
GrAuditTrail* auditTrail)
- : INHERITED(resourceProvider, proxy, auditTrail) {
+ : INHERITED(resourceProvider, std::move(opMemoryPool), proxy, auditTrail) {
+ SkASSERT(fOpMemoryPool);
+}
+
+void GrTextureOpList::deleteOp(int index) {
+ SkASSERT(index >= 0 && index < fRecordedOps.count());
+ fOpMemoryPool->release(std::move(fRecordedOps[index]));
+}
+
+void GrTextureOpList::deleteOps() {
+ for (int i = 0; i < fRecordedOps.count(); ++i) {
+ fOpMemoryPool->release(std::move(fRecordedOps[i]));
+ }
+ fRecordedOps.reset();
+ fOpMemoryPool = nullptr;
}
GrTextureOpList::~GrTextureOpList() {
+ this->deleteOps();
}
////////////////////////////////////////////////////////////////////////////////
@@ -107,7 +124,7 @@ bool GrTextureOpList::onExecute(GrOpFlushState* flushState) {
}
void GrTextureOpList::endFlush() {
- fRecordedOps.reset();
+ this->deleteOps();
INHERITED::endFlush();
}
@@ -152,7 +169,7 @@ void GrTextureOpList::purgeOpsWithUninstantiatedProxies() {
}
if (hasUninstantiatedProxy) {
// When instantiation of the proxy fails we drop the Op
- fRecordedOps[i] = nullptr;
+ this->deleteOp(i);
}
}
}