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>
This commit is contained in:
Robert Phillips 2017-06-14 15:16:59 -04:00 committed by Skia Commit-Bot
parent b894c2b339
commit d99148623b
4 changed files with 19 additions and 19 deletions

View File

@ -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) {

View File

@ -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;
}

View File

@ -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();

View File

@ -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();)
}