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/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
index 9d30bb4..69d7200 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
@@ -18,17 +18,6 @@
 
 using PathInstance = GrCCPathProcessor::Instance;
 
-GrCCPerOpListPaths::~GrCCPerOpListPaths() {
-    // Ensure there are no surviving DrawPathsOps with a dangling pointer into this class.
-    if (!fDrawOps.isEmpty()) {
-        SK_ABORT("GrCCDrawPathsOp(s) not deleted during flush");
-    }
-    // Clip lazy proxies also reference this class from their callbacks, but those callbacks
-    // are only invoked at flush time while we are still alive. (Unlike DrawPathsOps, that
-    // unregister themselves upon destruction.) So it shouldn't matter if any clip proxies
-    // are still around.
-}
-
 bool GrCoverageCountingPathRenderer::IsSupported(const GrCaps& caps) {
     const GrShaderCaps& shaderCaps = *caps.shaderCaps();
     return shaderCaps.integerSupport() && shaderCaps.flatInterpolationSupport() &&
@@ -52,12 +41,6 @@
     }
 }
 
-GrCoverageCountingPathRenderer::~GrCoverageCountingPathRenderer() {
-    // Ensure callers are actually flushing paths they record, not causing us to leak memory.
-    SkASSERT(fPendingPaths.empty());
-    SkASSERT(!fFlushing);
-}
-
 GrCCPerOpListPaths* GrCoverageCountingPathRenderer::lookupPendingPaths(uint32_t opListID) {
     auto it = fPendingPaths.find(opListID);
     if (fPendingPaths.end() == it) {
@@ -165,7 +148,7 @@
     if (GrCCDrawPathsOp* op = opHolder.get()) {
         GrRenderTargetContext* rtc = args.fRenderTargetContext;
         if (uint32_t opListID = rtc->addDrawOp(*args.fClip, std::move(opHolder))) {
-            op->wasRecorded(this->lookupPendingPaths(opListID));
+            op->wasRecorded(sk_ref_sp(this->lookupPendingPaths(opListID)));
         }
     }
 }