Add ability to uninstantiate lazy proxies after every flush.

Bug: skia:
Change-Id: Id32540cda54a9c5e3e6cb721776699be3cc8ac1a
Reviewed-on: https://skia-review.googlesource.com/113263
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 470ab7d..d90c408 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -58,7 +58,8 @@
 #endif
 
     void release() {
-        SkASSERT(1 == fRefCnt);
+        // The proxy itself may still have multiple refs. It can be owned by an SkImage and multiple
+        // SkDeferredDisplayLists at the same time if we are using DDLs.
         SkASSERT(0 == fPendingReads);
         SkASSERT(0 == fPendingWrites);
 
@@ -194,8 +195,10 @@
 class GrSurfaceProxy : public GrIORefProxy {
 public:
     enum class LazyInstantiationType {
-        kSingleUse,    // Instantiation callback is allowed to be called only once
-        kMultipleUse,  // Instantiation callback can be called multiple times.
+        kSingleUse,         // Instantiation callback is allowed to be called only once
+        kMultipleUse,       // Instantiation callback can be called multiple times.
+        kUninstantiate,     // Instantiation callback can be called multiple times,
+                            // but we will uninstantiate the proxy after every flush
     };
 
     enum class LazyState {