Use a spinlock in SkOnce.

SkOnceFlag is now statically initializable on all platforms.

Also adds sk_atomic_cas, used to implement new SkSpinlock.

Going to punt on making SkOnceFlag any smaller (for now, it's 8 bytes).  We could conceivably get it down to two bits, one for done and one for a one-bit spinlock (we'd need atomic-& and atomic-| to make that work, but they appear to be available everywhere).

BUG=skia:1929
R=bungeman@google.com, reed@google.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/123093002

git-svn-id: http://skia.googlecode.com/svn/trunk@12968 2bbb7eff-a529-9590-31e7-b0007b416f81
6 files changed