Spin off more thread-safe work in DM.

Even in GPU configs, encoding a .png and writing to disk is thread safe.
This CL moves that work to an SkTaskGroup, offloading it from the GPU
thread to a threadpool.

In my brief local testing, this makes DM run in about half the time
for GPU-bound work, e.g.

    $ out/Release/dm --src gm --config gpudft -w output
    Before: 43.79 real        37.01 user         4.28 sys
    After : 23.64 real        39.31 user         4.46 sys

This won't affect the bots much, as they already skip .png generation
when gold.skia.org already has a .png of an image with a given hash.
(Most of the time saved here is under WriteToDisk() after the
gUninterestingHashes check.)

CQ_EXTRA_TRYBOTS=client.skia:Test-Mac10.9-Clang-MacMini6.2-GPU-HD4000-x86_64-Release-Trybot

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1561553002

Review URL: https://codereview.chromium.org/1561553002
1 file changed