Use a spinlock in SkOnce.
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 8 Jan 2014 21:15:56 +0000 (21:15 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 8 Jan 2014 21:15:56 +0000 (21:15 +0000)
commit4b5fba5a3cc29058088a9a62df1da83e1a3c7db0
treef50e71f9e8f93b6649b36aecd13068e8e1ae6a83
parentd4ba6e778122df9b52dc68a2f41210d33fd43471
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
include/core/SkThread.h
src/core/SkOnce.h
src/ports/SkAtomics_android.h
src/ports/SkAtomics_none.h
src/ports/SkAtomics_sync.h
src/ports/SkAtomics_win.h