Override operator delete for GrCpuBuffer

GrCpuBuffer allocates extra space for a buffer in Make but using sized
delete will then lead to UB as operator delete is not implemented.

This change overrides the delete operator to force the unsized variant
which gets rid of the UB at the cost of not taking advantage of sized
delete. Once P0722R1 is available to safely compute the full size of
the object inside delete, this code can change to use sized delete.

c.f. https://bugs.chromium.org/p/skia/issues/detail?id=6384
and http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0722r1.html

Change-Id: I8f9172c35d17a5acee777d802dfdb25f031868b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237847
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrCpuBuffer.h b/src/gpu/GrCpuBuffer.h
index 5a4bc08..5149766 100644
--- a/src/gpu/GrCpuBuffer.h
+++ b/src/gpu/GrCpuBuffer.h
@@ -25,6 +25,9 @@
         return sk_sp<GrCpuBuffer>(new (mem) GrCpuBuffer((char*)mem + sizeof(GrCpuBuffer), size));
     }
 
+    // TODO(b/30449950): use sized delete once P0722R3 is available
+    static void operator delete(void* p) { ::operator delete(p); }
+
     void ref() const override { GrNonAtomicRef<GrCpuBuffer>::ref(); }
     void unref() const override { GrNonAtomicRef<GrCpuBuffer>::unref(); }
     size_t size() const override { return fSize; }