diff options
author | 2016-04-18 08:09:11 -0700 | |
---|---|---|
committer | 2016-04-18 08:09:11 -0700 | |
commit | d9dd4282118fc14eac735e6fa0b3ec53047b457f (patch) | |
tree | b88bce11cbcec3100e428b713df49e1fcd83f8d2 /src/fonts/SkFontMgr_indirect.cpp | |
parent | f7142e71d7c0a7d8406679e207ff766085499d2e (diff) |
Modernize and trim down SkOnce.
The API and implementation are very much simplified.
You may not want to bother reading the diff.
As is our trend, SkOnce now uses <atomic> directly.
Member initialization means we don't need SK_DECLARE_STATIC_ONCE.
SkSpinlock already works this same way.
All uses of the old API taking an external bool* and Lock* were pessimal,
so I have not carried this sort of API forward. It's simpler, faster,
and more space-efficient to always use this single SkOnce class interface.
SkOnce weighs 2 bytes: a done bool and an SkSpinlock, also a bool internally.
This API refactoring opens up the opportunity to fuse those into a single
three-state byte if we'd like.
No public API changes.
TBR=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1894893002
Review URL: https://codereview.chromium.org/1894893002
Diffstat (limited to 'src/fonts/SkFontMgr_indirect.cpp')
-rw-r--r-- | src/fonts/SkFontMgr_indirect.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp index d3fae91808..01a24c5174 100644 --- a/src/fonts/SkFontMgr_indirect.cpp +++ b/src/fonts/SkFontMgr_indirect.cpp @@ -65,12 +65,12 @@ void SkFontMgr_Indirect::set_up_family_names(const SkFontMgr_Indirect* self) { } int SkFontMgr_Indirect::onCountFamilies() const { - SkOnce(&fFamilyNamesInited, &fFamilyNamesMutex, SkFontMgr_Indirect::set_up_family_names, this); + fFamilyNamesInitOnce(SkFontMgr_Indirect::set_up_family_names, this); return fFamilyNames->count(); } void SkFontMgr_Indirect::onGetFamilyName(int index, SkString* familyName) const { - SkOnce(&fFamilyNamesInited, &fFamilyNamesMutex, SkFontMgr_Indirect::set_up_family_names, this); + fFamilyNamesInitOnce(SkFontMgr_Indirect::set_up_family_names, this); if (index >= fFamilyNames->count()) { familyName->reset(); return; |