Index: src/gpu/GrGpuResourceRef.cpp |
diff --git a/src/gpu/GrGpuResourceRef.cpp b/src/gpu/GrGpuResourceRef.cpp |
index 405679d4f17d6c8140b05748f0c0811a59e153a1..8ffaed5b6765f32291ab96668e417e67f015a530 100644 |
--- a/src/gpu/GrGpuResourceRef.cpp |
+++ b/src/gpu/GrGpuResourceRef.cpp |
@@ -11,13 +11,15 @@ GrGpuResourceRef::GrGpuResourceRef() { |
fResource = nullptr; |
fOwnRef = false; |
fPendingIO = false; |
+ fDst = NULL; |
} |
-GrGpuResourceRef::GrGpuResourceRef(GrGpuResource* resource, GrIOType ioType) { |
+GrGpuResourceRef::GrGpuResourceRef(GrGpuResource* resource, GrIOType ioType, GrGpuResource* dst) { |
fResource = nullptr; |
fOwnRef = false; |
fPendingIO = false; |
- this->setResource(resource, ioType); |
+ fDst = NULL; |
+ this->setResource(resource, ioType, dst); |
} |
GrGpuResourceRef::~GrGpuResourceRef() { |
@@ -49,19 +51,28 @@ void GrGpuResourceRef::reset() { |
fOwnRef = false; |
fResource = nullptr; |
} |
+ fDst = NULL; |
} |
-void GrGpuResourceRef::setResource(GrGpuResource* resource, GrIOType ioType) { |
+void GrGpuResourceRef::setResource(GrGpuResource* resource, GrIOType ioType, GrGpuResource* dst) { |
SkASSERT(!fPendingIO); |
SkASSERT(SkToBool(fResource) == fOwnRef); |
SkSafeUnref(fResource); |
if (nullptr == resource) { |
+ SkASSERT(nullptr == dst); |
fResource = nullptr; |
fOwnRef = false; |
+ fDst = NULL; |
} else { |
fResource = resource; |
fOwnRef = true; |
fIOType = ioType; |
+ if (fIOType == kRead_GrIOType || fIOType == kRW_GrIOType) { |
+ SkASSERT(dst); |
+ fDst = dst; |
+ } else { |
+ fDst = NULL; |
+ } |
} |
} |
@@ -73,13 +84,15 @@ void GrGpuResourceRef::markPendingIO() const { |
fPendingIO = true; |
switch (fIOType) { |
case kRead_GrIOType: |
- fResource->addPendingRead(); |
+ SkASSERT(fDst); |
+ fResource->addPendingRead(fDst); |
break; |
case kWrite_GrIOType: |
fResource->addPendingWrite(); |
break; |
case kRW_GrIOType: |
- fResource->addPendingRead(); |
+ SkASSERT(fDst); |
+ fResource->addPendingRead(fDst); |
fResource->addPendingWrite(); |
break; |
} |