mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1855506: Add assertions to validate the return value of gfxPlatformFontList::FindAndAddFamilies. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D189413
This commit is contained in:
parent
f68d515b21
commit
077578eff4
@ -1498,6 +1498,31 @@ gfxFontFamily* gfxPlatformFontList::CheckFamily(gfxFontFamily* aFamily) {
|
||||
return aFamily;
|
||||
}
|
||||
|
||||
bool gfxPlatformFontList::FindAndAddFamilies(
|
||||
nsPresContext* aPresContext, StyleGenericFontFamily aGeneric,
|
||||
const nsACString& aFamily, nsTArray<FamilyAndGeneric>* aOutput,
|
||||
FindFamiliesFlags aFlags, gfxFontStyle* aStyle, nsAtom* aLanguage,
|
||||
gfxFloat aDevToCssSize) {
|
||||
AutoLock lock(mLock);
|
||||
|
||||
#ifdef DEBUG
|
||||
auto initialLength = aOutput->Length();
|
||||
#endif
|
||||
|
||||
bool didFind =
|
||||
FindAndAddFamiliesLocked(aPresContext, aGeneric, aFamily, aOutput, aFlags,
|
||||
aStyle, aLanguage, aDevToCssSize);
|
||||
#ifdef DEBUG
|
||||
auto finalLength = aOutput->Length();
|
||||
// Validate the expectation that the output-array grows if we return true,
|
||||
// or remains the same (probably empty) if we return false.
|
||||
MOZ_ASSERT_IF(didFind, finalLength > initialLength);
|
||||
MOZ_ASSERT_IF(!didFind, finalLength == initialLength);
|
||||
#endif
|
||||
|
||||
return didFind;
|
||||
}
|
||||
|
||||
bool gfxPlatformFontList::FindAndAddFamiliesLocked(
|
||||
nsPresContext* aPresContext, StyleGenericFontFamily aGeneric,
|
||||
const nsACString& aFamily, nsTArray<FamilyAndGeneric>* aOutput,
|
||||
|
@ -332,11 +332,8 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
||||
nsPresContext* aPresContext, mozilla::StyleGenericFontFamily aGeneric,
|
||||
const nsACString& aFamily, nsTArray<FamilyAndGeneric>* aOutput,
|
||||
FindFamiliesFlags aFlags, gfxFontStyle* aStyle = nullptr,
|
||||
nsAtom* aLanguage = nullptr, gfxFloat aDevToCssSize = 1.0) {
|
||||
AutoLock lock(mLock);
|
||||
return FindAndAddFamiliesLocked(aPresContext, aGeneric, aFamily, aOutput,
|
||||
aFlags, aStyle, aLanguage, aDevToCssSize);
|
||||
}
|
||||
nsAtom* aLanguage = nullptr, gfxFloat aDevToCssSize = 1.0);
|
||||
|
||||
virtual bool FindAndAddFamiliesLocked(
|
||||
nsPresContext* aPresContext, mozilla::StyleGenericFontFamily aGeneric,
|
||||
const nsACString& aFamily, nsTArray<FamilyAndGeneric>* aOutput,
|
||||
|
Loading…
Reference in New Issue
Block a user