diff options
author | Robert Phillips <robertphillips@google.com> | 2017-06-14 15:16:59 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-14 20:11:51 +0000 |
commit | d99148623b1daecc54eca1e2df607a49f86c6fae (patch) | |
tree | e8bbbf01f624b24e5ea6c876715145cd6f5ec0aa | |
parent | b894c2b339471d417ef926709613f1e96660c331 (diff) |
Drop the ref on the GrOpList's target in makeClosed (take 2)
Bug: 729233
TBR=bsalomon@google.com
Change-Id: I5c9a0cb793c7c6564ad355a4a63b29fdc12f6cd7
Reviewed-on: https://skia-review.googlesource.com/19860
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r-- | src/gpu/GrGpuResourceRef.cpp | 19 | ||||
-rw-r--r-- | src/gpu/GrOpList.cpp | 9 | ||||
-rw-r--r-- | src/gpu/GrOpList.h | 5 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 5 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/gpu/GrGpuResourceRef.cpp b/src/gpu/GrGpuResourceRef.cpp index 115e0b1797..b4703830ec 100644 --- a/src/gpu/GrGpuResourceRef.cpp +++ b/src/gpu/GrGpuResourceRef.cpp @@ -143,11 +143,12 @@ GrSurfaceProxyRef::GrSurfaceProxyRef(sk_sp<GrSurfaceProxy> proxy, GrIOType ioTyp } GrSurfaceProxyRef::~GrSurfaceProxyRef() { - if (fOwnRef) { - SkASSERT(fProxy); - fProxy->unref(); - } + this->reset(); +} + +void GrSurfaceProxyRef::reset() { if (fPendingIO) { + SkASSERT(fProxy); switch (fIOType) { case kRead_GrIOType: fProxy->completedRead(); @@ -160,17 +161,15 @@ GrSurfaceProxyRef::~GrSurfaceProxyRef() { fProxy->completedWrite(); break; } + fPendingIO = false; } -} - -void GrSurfaceProxyRef::reset() { - SkASSERT(!fPendingIO); - SkASSERT(SkToBool(fProxy) == fOwnRef); if (fOwnRef) { + SkASSERT(fProxy); fProxy->unref(); fOwnRef = false; - fProxy = nullptr; } + + fProxy = nullptr; } void GrSurfaceProxyRef::setProxy(sk_sp<GrSurfaceProxy> proxy, GrIOType ioType) { diff --git a/src/gpu/GrOpList.cpp b/src/gpu/GrOpList.cpp index 5160be16c2..5a9a1bdad8 100644 --- a/src/gpu/GrOpList.cpp +++ b/src/gpu/GrOpList.cpp @@ -41,13 +41,7 @@ GrOpList::GrOpList(GrResourceProvider* resourceProvider, } GrOpList::~GrOpList() { - if (fTarget.get()) { - if (this == fTarget.get()->getLastOpList()) { - fTarget.get()->setLastOpList(nullptr); - } - - fTarget.pendingIOComplete(); - } + this->reset(); } bool GrOpList::instantiate(GrResourceProvider* resourceProvider) { @@ -59,7 +53,6 @@ void GrOpList::reset() { fTarget.get()->setLastOpList(nullptr); } - fTarget.pendingIOComplete(); fTarget.reset(); fAuditTrail = nullptr; } diff --git a/src/gpu/GrOpList.h b/src/gpu/GrOpList.h index dc624415d1..04142d873f 100644 --- a/src/gpu/GrOpList.h +++ b/src/gpu/GrOpList.h @@ -35,7 +35,10 @@ public: virtual bool executeOps(GrOpFlushState* flushState) = 0; virtual void makeClosed(const GrCaps&) { - this->setFlag(kClosed_Flag); + if (!this->isClosed()) { + this->setFlag(kClosed_Flag); + fTarget.removeRef(); + } } virtual void reset(); diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 39148bbe5a..21a47eec49 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -119,6 +119,11 @@ GrRenderTargetContext::GrRenderTargetContext(GrContext* context, auto srgbColorSpace = SkColorSpace::MakeSRGB(); fColorXformFromSRGB = GrColorSpaceXform::Make(srgbColorSpace.get(), fColorSpace.get()); } + + // MDB TODO: to ensure all resources still get allocated in the correct order in the hybrid + // world we need to get the correct opList here so that it, in turn, can grab and hold + // its rendertarget. + this->getOpList(); SkDEBUGCODE(this->validate();) } |