fonts: Cache serialized typeface wire data for remote fonts.

The serialization showed up as a significant cost on profiling,
primarily because of the lock acquired for query the glyph count of a
typeface and the SkData allocation each time. Avoid this by caching the
data for each typeface.

Note that since the typeface is already cached on the client side, we
shouldn't need to resend the typeface data each time. But serializing a
typeface doesn't guarentee that it will be sent, because of which we
can not make any assumptions about client state after serialize is
called.

Bug: 894200
Change-Id: I45e43e297d817826646ab08bd4937b2625603858
Reviewed-on: https://skia-review.googlesource.com/c/162841
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
Auto-Submit: Khusal Sagar <khushalsagar@chromium.org>
2 files changed