Replace the id<-->key hashmap in SkImageFilter by a SkTArray

In the current implementation, SkImageFilter::Cache maintains a hash map
that maps SkImageFilter's uniqueID to an array of keys, and its purpose
is to remove the values in Cache that are associated with this array of
keys that are indexed by uniqueID. However, maintaining this hash map
causes perf regression to smoothness.tough_filters_cases.

This CL removes the id<-->key hashmap. Instead, we maintain an array of
keys in SkImageFilter. Whenever there is a new key, we push it into the
array. In ~SkImageFilter(), we call Cache::purgeByKeys to remove all the
values that are associated with the keys that are maintained by SkImageFilter.

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

Review URL: https://codereview.chromium.org/1651433002
2 files changed