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
Commit-Queue: Brian Salomon <>
Reviewed-by: Greg Daniel <>
6 files changed