Clean up SkOnce usage in SkFontMgr_Indirect.
R=mtklein@google.com Review URL: https://codereview.chromium.org/210283002 git-svn-id: http://skia.googlecode.com/svn/trunk@13917 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
a9dae71210
commit
1ba62629f4
@ -27,12 +27,8 @@ public:
|
||||
// In the future these calls should be broken out into their own interface
|
||||
// with a name like SkFontRenderer.
|
||||
SkFontMgr_Indirect(SkFontMgr* impl, SkRemotableFontMgr* proxy)
|
||||
: fImpl(SkRef(impl)), fProxy(SkRef(proxy))
|
||||
{
|
||||
fOnce.done = false;
|
||||
fOnce.lock.thisIsPrivate = 0;
|
||||
SkDEBUGCODE(fOnce.lock.shouldBeZero = 0;)
|
||||
}
|
||||
: fImpl(SkRef(impl)), fProxy(SkRef(proxy)), fFamilyNamesInited(false)
|
||||
{ }
|
||||
|
||||
protected:
|
||||
virtual int onCountFamilies() const SK_OVERRIDE;
|
||||
@ -99,7 +95,8 @@ private:
|
||||
mutable SkMutex fDataCacheMutex;
|
||||
|
||||
mutable SkAutoTUnref<SkDataTable> fFamilyNames;
|
||||
mutable SkOnceFlag fOnce;
|
||||
mutable bool fFamilyNamesInited;
|
||||
mutable SkMutex fFamilyNamesMutex;
|
||||
static void set_up_family_names(const SkFontMgr_Indirect* self);
|
||||
|
||||
friend class SkStyleSet_Indirect;
|
||||
|
@ -155,12 +155,12 @@ void SkFontMgr_Indirect::set_up_family_names(const SkFontMgr_Indirect* self) {
|
||||
}
|
||||
|
||||
int SkFontMgr_Indirect::onCountFamilies() const {
|
||||
SkOnce(&fOnce, SkFontMgr_Indirect::set_up_family_names, this);
|
||||
SkOnce(&fFamilyNamesInited, &fFamilyNamesMutex, SkFontMgr_Indirect::set_up_family_names, this);
|
||||
return fFamilyNames->count();
|
||||
}
|
||||
|
||||
void SkFontMgr_Indirect::onGetFamilyName(int index, SkString* familyName) const {
|
||||
SkOnce(&fOnce, SkFontMgr_Indirect::set_up_family_names, this);
|
||||
SkOnce(&fFamilyNamesInited, &fFamilyNamesMutex, SkFontMgr_Indirect::set_up_family_names, this);
|
||||
if (index >= fFamilyNames->count()) {
|
||||
familyName->reset();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user