Rename GrOpList::reset to endFlush

Bug: skia:7111
Change-Id: I9e48224c7edcc51bd0368cb7c115acbc3bf8da16
Reviewed-on: https://skia-review.googlesource.com/54500
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 48540e0..f1e116f 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -36,7 +36,11 @@
         // We shouldn't need to do this, but it turns out some clients still hold onto opLists
         // after a cleanup.
         // MDB TODO: is this still true?
-        fOpLists[i]->reset();
+        if (!fOpLists[i]->unique()) {
+            // TODO: Eventually this should be guaranteed unique.
+            // https://bugs.chromium.org/p/skia/issues/detail?id=7111
+            fOpLists[i]->endFlush();
+        }
     }
 
     fOpLists.reset();
@@ -78,13 +82,6 @@
 
 }
 
-void GrDrawingManager::reset() {
-    for (int i = 0; i < fOpLists.count(); ++i) {
-        fOpLists[i]->reset();
-    }
-    fFlushState.reset();
-}
-
 gr_instanced::OpAllocator* GrDrawingManager::instancingAllocator() {
     if (fInstancingAllocator) {
         return fInstancingAllocator.get();
@@ -162,6 +159,7 @@
                 if (!opList) {
                     continue;   // Odd - but not a big deal
                 }
+                SkASSERT(opList->unique());
                 opList->makeClosed(*fContext->caps());
                 opList->prepare(&fFlushState);
                 if (!opList->execute(&fFlushState)) {
@@ -224,7 +222,11 @@
         if (!fOpLists[i]) {
             continue;
         }
-        fOpLists[i]->reset();
+        if (!fOpLists[i]->unique()) {
+            // TODO: Eventually this should be guaranteed unique.
+            // https://bugs.chromium.org/p/skia/issues/detail?id=7111
+            fOpLists[i]->endFlush();
+        }
     }
     fOpLists.reset();