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:
parent
b894c2b339
commit
d99148623b
@ -143,11 +143,12 @@ GrSurfaceProxyRef::GrSurfaceProxyRef(sk_sp<GrSurfaceProxy> proxy, GrIOType ioTyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrSurfaceProxyRef::~GrSurfaceProxyRef() {
|
GrSurfaceProxyRef::~GrSurfaceProxyRef() {
|
||||||
if (fOwnRef) {
|
this->reset();
|
||||||
SkASSERT(fProxy);
|
}
|
||||||
fProxy->unref();
|
|
||||||
}
|
void GrSurfaceProxyRef::reset() {
|
||||||
if (fPendingIO) {
|
if (fPendingIO) {
|
||||||
|
SkASSERT(fProxy);
|
||||||
switch (fIOType) {
|
switch (fIOType) {
|
||||||
case kRead_GrIOType:
|
case kRead_GrIOType:
|
||||||
fProxy->completedRead();
|
fProxy->completedRead();
|
||||||
@ -160,17 +161,15 @@ GrSurfaceProxyRef::~GrSurfaceProxyRef() {
|
|||||||
fProxy->completedWrite();
|
fProxy->completedWrite();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
fPendingIO = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void GrSurfaceProxyRef::reset() {
|
|
||||||
SkASSERT(!fPendingIO);
|
|
||||||
SkASSERT(SkToBool(fProxy) == fOwnRef);
|
|
||||||
if (fOwnRef) {
|
if (fOwnRef) {
|
||||||
|
SkASSERT(fProxy);
|
||||||
fProxy->unref();
|
fProxy->unref();
|
||||||
fOwnRef = false;
|
fOwnRef = false;
|
||||||
fProxy = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fProxy = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrSurfaceProxyRef::setProxy(sk_sp<GrSurfaceProxy> proxy, GrIOType ioType) {
|
void GrSurfaceProxyRef::setProxy(sk_sp<GrSurfaceProxy> proxy, GrIOType ioType) {
|
||||||
|
@ -41,13 +41,7 @@ GrOpList::GrOpList(GrResourceProvider* resourceProvider,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrOpList::~GrOpList() {
|
GrOpList::~GrOpList() {
|
||||||
if (fTarget.get()) {
|
this->reset();
|
||||||
if (this == fTarget.get()->getLastOpList()) {
|
|
||||||
fTarget.get()->setLastOpList(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
fTarget.pendingIOComplete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GrOpList::instantiate(GrResourceProvider* resourceProvider) {
|
bool GrOpList::instantiate(GrResourceProvider* resourceProvider) {
|
||||||
@ -59,7 +53,6 @@ void GrOpList::reset() {
|
|||||||
fTarget.get()->setLastOpList(nullptr);
|
fTarget.get()->setLastOpList(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fTarget.pendingIOComplete();
|
|
||||||
fTarget.reset();
|
fTarget.reset();
|
||||||
fAuditTrail = nullptr;
|
fAuditTrail = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,10 @@ public:
|
|||||||
virtual bool executeOps(GrOpFlushState* flushState) = 0;
|
virtual bool executeOps(GrOpFlushState* flushState) = 0;
|
||||||
|
|
||||||
virtual void makeClosed(const GrCaps&) {
|
virtual void makeClosed(const GrCaps&) {
|
||||||
|
if (!this->isClosed()) {
|
||||||
this->setFlag(kClosed_Flag);
|
this->setFlag(kClosed_Flag);
|
||||||
|
fTarget.removeRef();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void reset();
|
virtual void reset();
|
||||||
|
@ -119,6 +119,11 @@ GrRenderTargetContext::GrRenderTargetContext(GrContext* context,
|
|||||||
auto srgbColorSpace = SkColorSpace::MakeSRGB();
|
auto srgbColorSpace = SkColorSpace::MakeSRGB();
|
||||||
fColorXformFromSRGB = GrColorSpaceXform::Make(srgbColorSpace.get(), fColorSpace.get());
|
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();)
|
SkDEBUGCODE(this->validate();)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user