Revert "Drop the ref on the GrOpList's target in makeClosed"

This reverts commit dcd499caed.

Reason for revert: memory issue
Original change's description:
> 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>

TBR=bsalomon@google.com,robertphillips@google.com

Change-Id: I4269c696c57a93cdd056e7c3a887c35b8765ac6d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 729233
Reviewed-on: https://skia-review.googlesource.com/19793
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2017-06-14 17:55:12 +00:00 committed by Skia Commit-Bot
parent e225b565fc
commit c8ecb0328b
5 changed files with 14 additions and 17 deletions

View File

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

View File

@ -143,12 +143,11 @@ GrSurfaceProxyRef::GrSurfaceProxyRef(sk_sp<GrSurfaceProxy> proxy, GrIOType ioTyp
}
GrSurfaceProxyRef::~GrSurfaceProxyRef() {
this->reset();
}
void GrSurfaceProxyRef::reset() {
if (fPendingIO) {
if (fOwnRef) {
SkASSERT(fProxy);
fProxy->unref();
}
if (fPendingIO) {
switch (fIOType) {
case kRead_GrIOType:
fProxy->completedRead();
@ -161,10 +160,13 @@ void GrSurfaceProxyRef::reset() {
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,6 +45,8 @@ GrOpList::~GrOpList() {
if (this == fTarget.get()->getLastOpList()) {
fTarget.get()->setLastOpList(nullptr);
}
fTarget.pendingIOComplete();
}
}
@ -57,6 +59,7 @@ void GrOpList::reset() {
fTarget.get()->setLastOpList(nullptr);
}
fTarget.pendingIOComplete();
fTarget.reset();
fAuditTrail = nullptr;
}

View File

@ -35,10 +35,7 @@ public:
virtual bool executeOps(GrOpFlushState* flushState) = 0;
virtual void makeClosed(const GrCaps&) {
if (!this->isClosed()) {
this->setFlag(kClosed_Flag);
fTarget.removeRef();
}
this->setFlag(kClosed_Flag);
}
virtual void reset();

View File

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