RESTRICT AUTOMERGE: Make listener lists threadsafe with a mutex.

Bug: 124232283
Test: Infeasible

Cherry-pick of in Skia

There were conflicts due the fact that pi-dev does not have commit
afa11586d782c7cb3e83b8af48023ff227349516 ("Make the SkPathRef
GenIDChangeListener ref counted") or
6c8d242b14355bf66c9137e9e4d6c7861d22168f ("Make atomic lists list for
bitmaps and paths" - an alternate fix for this issue) and some smaller
header file changes.

Change-Id: I7c2c5cd6603007d099169071a1b7d1a230c621bc
Merged-In: I91a8fbdd1b8fb4cf8b124ebdf17212c643058ef3
4 files changed