Fix abandonment of programs

Bug: skia:8092
TBR=bsalomon@google.com
Change-Id: If9cf4ed9f8ded4b7fbb58a244ec0b179b8430ca2
Reviewed-on: https://skia-review.googlesource.com/137121
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/include/gpu/gl/GrGLFunctions.h b/include/gpu/gl/GrGLFunctions.h
index e0bc390..15dc154 100644
--- a/include/gpu/gl/GrGLFunctions.h
+++ b/include/gpu/gl/GrGLFunctions.h
@@ -308,6 +308,8 @@
         return fCall != nullptr;
     }
 
+    void reset() { fCall = nullptr; }
+
 private:
     R (*fCall)(const void*, Args...);
     size_t fBuf[4];
diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h
index bf2685e..0b7bd96 100644
--- a/include/gpu/gl/GrGLInterface.h
+++ b/include/gpu/gl/GrGLInterface.h
@@ -77,6 +77,7 @@
     /**
      * The function pointers are in a struct so that we can have a compiler generated assignment
      * operator.
+     * If one were to add a new function to this struct, one should also clear it in abandon.
      */
     struct Functions {
         GrGLFunction<GrGLActiveTextureProc> fActiveTexture;
@@ -335,8 +336,10 @@
         GrGLFunction<GrEGLDestroyImageProc> fEGLDestroyImage;
     } fFunctions;
 
+#if GR_TEST_UTILS
     // This exists for internal testing.
-    virtual void abandon() const {}
+    virtual void abandon() const;
+#endif
 };
 
 #endif