ccpr: Remove the dangling pointer from GrCCDrawPathsOp
Actually takes a ref on fOwningPerOpListPaths, instead of just
asserting it continues to exist. Removes unnecessary asserts
surrounding dangling pointers.
Bug: skia:8359
Change-Id: Ie80da55510f320452bd9ee3a4b38bd59d48681a0
Reviewed-on: https://skia-review.googlesource.com/154684
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index 1ec9493..7390b9f 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -130,7 +130,7 @@
GrCCDrawPathsOp::~GrCCDrawPathsOp() {
if (fOwningPerOpListPaths) {
- // Remove CCPR's dangling pointer to this Op before deleting it.
+ // Remove the list's dangling pointer to this Op before deleting it.
fOwningPerOpListPaths->fDrawOps.remove(this);
}
}
@@ -223,11 +223,11 @@
return CombineResult::kMerged;
}
-void GrCCDrawPathsOp::wasRecorded(GrCCPerOpListPaths* owningPerOpListPaths) {
+void GrCCDrawPathsOp::wasRecorded(sk_sp<GrCCPerOpListPaths> owningPerOpListPaths) {
SkASSERT(1 == fNumDraws);
SkASSERT(!fOwningPerOpListPaths);
- owningPerOpListPaths->fDrawOps.addToTail(this);
- fOwningPerOpListPaths = owningPerOpListPaths;
+ fOwningPerOpListPaths = std::move(owningPerOpListPaths);
+ fOwningPerOpListPaths->fDrawOps.addToTail(this);
}
void GrCCDrawPathsOp::accountForOwnPaths(GrCCPathCache* pathCache,