diff options
author | 2017-06-14 15:16:59 -0400 | |
---|---|---|
committer | 2017-06-14 20:11:51 +0000 | |
commit | d99148623b1daecc54eca1e2df607a49f86c6fae (patch) | |
tree | e8bbbf01f624b24e5ea6c876715145cd6f5ec0aa /src/gpu/GrGpuResourceRef.cpp | |
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>
Diffstat (limited to 'src/gpu/GrGpuResourceRef.cpp')
-rw-r--r-- | src/gpu/GrGpuResourceRef.cpp | 19 |
1 files changed, 9 insertions, 10 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) { |