Make unref messages to GrResourceCache work with all resource types.

Previously we made them texture-only to fix an upcast that occurred
through a virtual inheritance link on a pointer to a deleted object.

This change changes the mechanism such that the sender of the message
maintains a ref that is moved into the sent message. The upcast happens
during creation of the message and thus before the resource is deleted.

The motivation is to use this for SkCustomMesh vertex/index buffers.

Bug: skia:13036
Change-Id: I0990eaed0d736257e1b19e9819e0dac8a9af8c18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537084
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
6 files changed