Add writeToMemory() API to SkColorSpace

New API mirrors the form of similar APIs in SkRegion,
SkMatrix, etc.

This also fixes a bug:
SkImageInfo appears in a object that Chrome stores in
discardable memory. So when sk_sp<SkColorSpace> was added
to SkImageInfo a leak was introduced. We'll use this new
method and deserialize to store the SkColorSpace in the
discardable object.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2192903002

Review-Url: https://codereview.chromium.org/2192903002
3 files changed