Add syncing of gpu work before releasing resources in GrDirectContext teardowns.

As we start moving backends to tracking resources on command buffers by using
GrGpuResources, we need to make sure we don't release this resources from the
cache during teardown until they have finished on the gpu. Thus this CL adds
a way for the GrDirectContext to tell the GrGpu to finish all outstanding
work.

Bug: skia:11232
Change-Id: I953d89f514ad32f1d2c57279a670b336d7575ffe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361457
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
19 files changed