aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkSpinlock.cpp
Commit message (Collapse)AuthorAge
* Modernize SkSpinlock.Gravatar mtklein2016-02-29
| | | | | | | | | | | | | | | | | | | | | | | | - Use std::atomic directly. - No more need for SkPODSpinlock or SK_DECLARE_STATIC_SPINLOCK. Now simple code like this works as you'd hope: static SkSpinlock gLock; That is, it starts unlocked and there's no static initializer. std::atomic_flag would make this terser and standard-guaranteed, but ATOMIC_FLAG_INIT caused not-yet-implemented errors on MSVC 2013. The generated code for this approach is identical. It appears the implicit constructor is constexpr when all the member initializers are. I'm hoping this way of producing constexpr constructors without typing "constexpr" gives us a way to eliminate more SkFoo / SkBaseFoo distinctions and SK_DECLARE_STATIC_FOO. This was certainly the easiest. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1734383002 Review URL: https://codereview.chromium.org/1734383002
* Outline SkSpinlock::acquire().Gravatar mtklein2015-07-09
The proportion of time spent doing useful work is well over 99% in acquire(), so outlining it doesn't hurt speed at all, and makes it much easier to pick out on a profile. It'd be about 50/50 work/overhead if we outlined the extremely-cheap release(). I also tried outlining some SkRefCnt methods with similar mixed results. BUG=skia: No public API changes. TBR=reed@google.com Review URL: https://codereview.chromium.org/1212253013