aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuResourceRef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrGpuResourceRef.cpp')
-rw-r--r--src/gpu/GrGpuResourceRef.cpp19
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) {