Make callback std::function

* change some {} to = default;

Change-Id: I22aea84d74b4a5b0c826618d18d6eb300c5dcfa4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291360
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/text/GrTextBlobCache.cpp b/src/gpu/text/GrTextBlobCache.cpp
index 37489c6..619bb4f 100644
--- a/src/gpu/text/GrTextBlobCache.cpp
+++ b/src/gpu/text/GrTextBlobCache.cpp
@@ -15,14 +15,11 @@
     return msg.fContextID == msgBusUniqueID;
 }
 
-GrTextBlobCache::GrTextBlobCache(GrTextBlobCache::PFOverBudgetCB cb, void* data, uint32_t uniqueID)
-        : fCallback(cb)
-        , fData(data)
+GrTextBlobCache::GrTextBlobCache(PurgeMore purgeMore, uint32_t uniqueID)
+        : fPurgeMore(purgeMore)
         , fSizeBudget(kDefaultBudget)
         , fUniqueID(uniqueID)
-        , fPurgeBlobInbox(uniqueID) {
-    SkASSERT(cb != nullptr && data != nullptr);
-}
+        , fPurgeBlobInbox(uniqueID) { }
 
 GrTextBlobCache::~GrTextBlobCache() {
     this->freeAll();
@@ -133,7 +130,7 @@
         // use the call back and try to free some more.  If we are still overbudget after this,
         // then this single textblob is over our budget
         if (blob && lruBlob == blob) {
-            (*fCallback)(fData);
+            fPurgeMore();
         }
 
     #ifdef SPEW_BUDGET_MESSAGE
diff --git a/src/gpu/text/GrTextBlobCache.h b/src/gpu/text/GrTextBlobCache.h
index 01433d1..5a2a241 100644
--- a/src/gpu/text/GrTextBlobCache.h
+++ b/src/gpu/text/GrTextBlobCache.h
@@ -15,12 +15,14 @@
 #include "src/core/SkTextBlobPriv.h"
 #include "src/gpu/text/GrTextBlob.h"
 
+#include <functional>
+
 class GrTextBlobCache {
 public:
      // The callback function used by the cache when it is still over budget after a purge.
-    using PFOverBudgetCB = void (*)(void* data);
+    using PurgeMore = std::function<void()>;
 
-    GrTextBlobCache(PFOverBudgetCB cb, void* data, uint32_t uniqueID);
+    GrTextBlobCache(PurgeMore purgeMore, uint32_t uniqueID);
     ~GrTextBlobCache();
 
     sk_sp<GrTextBlob> makeCachedBlob(const SkGlyphRunList& glyphRunList,
@@ -85,8 +87,7 @@
 
     TextBlobList fBlobList;
     SkTHashMap<uint32_t, BlobIDCacheEntry> fBlobIDCache;
-    PFOverBudgetCB fCallback;
-    void* fData;
+    PurgeMore fPurgeMore;
     size_t fSizeBudget;
     size_t fCurrentSize{0};
     uint32_t fUniqueID;      // unique id to use for messaging