Drop the ref on the GrOpList's target in makeClosed

Bug: 729233
Change-Id: Ifb66b745e604d7f7c22c2907bcffa91d2086236d
Reviewed-on: https://skia-review.googlesource.com/19495
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Robert Phillips 2017-06-14 12:21:39 -04:00 committed by Skia Commit-Bot
parent 1d06078fef
commit dcd499caed
5 changed files with 17 additions and 14 deletions

View File

@ -44,7 +44,7 @@ GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor(
resourceProvider,
SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())),
maskProxy.get())
, fMaskTextureSampler(resourceProvider, maskProxy) {
, fMaskTextureSampler(resourceProvider, std::move(maskProxy)) {
this->initClassID<GrAlphaThresholdFragmentProcessor>();
this->addCoordTransform(&fImageCoordTransform);
this->addTextureSampler(&fImageTextureSampler);

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,13 +161,10 @@ 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;

View File

@ -45,8 +45,6 @@ GrOpList::~GrOpList() {
if (this == fTarget.get()->getLastOpList()) {
fTarget.get()->setLastOpList(nullptr);
}
fTarget.pendingIOComplete();
}
}
@ -59,7 +57,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

@ -92,6 +92,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();)
}