mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
Bug 838105 - add debug logging code for userfont cache. r=birtles
This commit is contained in:
parent
bdfea7f41f
commit
f751ca2a58
@ -899,6 +899,11 @@ gfxUserFontSet::UserFontCache::CacheFont(gfxFontEntry *aFontEntry)
|
||||
gfxUserFontData *data = aFontEntry->mUserFontData;
|
||||
sUserFonts->PutEntry(Key(data->mURI, data->mPrincipal, aFontEntry,
|
||||
data->mPrivate));
|
||||
|
||||
#ifdef DEBUG_USERFONT_CACHE
|
||||
printf("userfontcache added fontentry: %p\n", aFontEntry);
|
||||
Dump();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -915,6 +920,11 @@ gfxUserFontSet::UserFontCache::ForgetFont(gfxFontEntry *aFontEntry)
|
||||
// would no longer find the entry (bug 838105).
|
||||
sUserFonts->EnumerateEntries(
|
||||
gfxUserFontSet::UserFontCache::Entry::RemoveIfMatches, aFontEntry);
|
||||
|
||||
#ifdef DEBUG_USERFONT_CACHE
|
||||
printf("userfontcache removed fontentry: %p\n", aFontEntry);
|
||||
Dump();
|
||||
#endif
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
@ -944,3 +954,52 @@ gfxUserFontSet::UserFontCache::Shutdown()
|
||||
sUserFonts = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_USERFONT_CACHE
|
||||
|
||||
PLDHashOperator
|
||||
gfxUserFontSet::UserFontCache::Entry::DumpEntry(Entry* aEntry, void* aUserData)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsAutoCString principalURISpec;
|
||||
|
||||
nsCOMPtr<nsIURI> principalURI;
|
||||
rv = aEntry->mPrincipal->GetURI(getter_AddRefs(principalURI));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
principalURI->GetSpec(principalURISpec);
|
||||
}
|
||||
|
||||
bool setDomain = false;
|
||||
nsCOMPtr<nsIURI> domainURI;
|
||||
|
||||
aEntry->mPrincipal->GetDomain(getter_AddRefs(domainURI));
|
||||
if (domainURI) {
|
||||
setDomain = true;
|
||||
}
|
||||
|
||||
NS_ASSERTION(aEntry->mURI, "null URI in userfont cache entry");
|
||||
|
||||
printf("userfontcache fontEntry: %p fonturihash: %8.8x family: %s domainset: %s principal: [%s]\n",
|
||||
aEntry->mFontEntry,
|
||||
nsURIHashKey::HashKey(aEntry->mURI),
|
||||
NS_ConvertUTF16toUTF8(aEntry->mFontEntry->FamilyName()).get(),
|
||||
(setDomain ? "true" : "false"),
|
||||
principalURISpec.get()
|
||||
);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
gfxUserFontSet::UserFontCache::Dump()
|
||||
{
|
||||
if (!sUserFonts) {
|
||||
return;
|
||||
}
|
||||
|
||||
printf("userfontcache dump count: %d ========\n", sUserFonts->Count());
|
||||
sUserFonts->EnumerateEntries(Entry::DumpEntry, nullptr);
|
||||
printf("userfontcache dump ==================\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,8 @@
|
||||
class gfxMixedFontFamily;
|
||||
class nsFontFaceLoader;
|
||||
|
||||
//#define DEBUG_USERFONT_CACHE
|
||||
|
||||
// parsed CSS @font-face rule information
|
||||
// lifetime: from when @font-face rule processed until font is loaded
|
||||
struct gfxFontFaceSrc {
|
||||
@ -270,6 +272,11 @@ public:
|
||||
// Clear everything so that we don't leak URIs and Principals.
|
||||
static void Shutdown();
|
||||
|
||||
#ifdef DEBUG_USERFONT_CACHE
|
||||
// dump contents
|
||||
static void Dump();
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Helper that we use to observe the empty-cache notification
|
||||
// from nsICacheService.
|
||||
@ -349,6 +356,10 @@ public:
|
||||
static PLDHashOperator RemoveIfMatches(Entry* aEntry, void* aUserData);
|
||||
static PLDHashOperator DisconnectSVG(Entry* aEntry, void* aUserData);
|
||||
|
||||
#ifdef DEBUG_USERFONT_CACHE
|
||||
static PLDHashOperator DumpEntry(Entry* aEntry, void* aUserData);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static uint32_t
|
||||
HashFeatures(const nsTArray<gfxFontFeature>& aFeatures) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user