mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1139824 - Track construction/destruction of the font table wrappers attached to hb_blob objects, to enable leak detection. r=jdaggett
This commit is contained in:
parent
5ae116f0aa
commit
b0f0a419bc
@ -457,9 +457,12 @@ class FontTableRec {
|
||||
public:
|
||||
FontTableRec(IDWriteFontFace *aFontFace, void *aContext)
|
||||
: mFontFace(aFontFace), mContext(aContext)
|
||||
{ }
|
||||
{
|
||||
MOZ_COUNT_CTOR(FontTableRec);
|
||||
}
|
||||
|
||||
~FontTableRec() {
|
||||
MOZ_COUNT_DTOR(FontTableRec);
|
||||
mFontFace->ReleaseFontTable(mContext);
|
||||
}
|
||||
|
||||
|
@ -323,10 +323,35 @@ MacOSFontEntry::GetFontRef()
|
||||
return mFontRef;
|
||||
}
|
||||
|
||||
// For a logging build, we wrap the CFDataRef in a FontTableRec so that we can
|
||||
// use the MOZ_COUNT_[CD]TOR macros in it. A release build without logging
|
||||
// does not get this overhead.
|
||||
class FontTableRec {
|
||||
public:
|
||||
explicit FontTableRec(CFDataRef aDataRef)
|
||||
: mDataRef(aDataRef)
|
||||
{
|
||||
MOZ_COUNT_CTOR(FontTableRec);
|
||||
}
|
||||
|
||||
~FontTableRec() {
|
||||
MOZ_COUNT_DTOR(FontTableRec);
|
||||
::CFRelease(mDataRef);
|
||||
}
|
||||
|
||||
private:
|
||||
CFDataRef mDataRef;
|
||||
};
|
||||
|
||||
/*static*/ void
|
||||
MacOSFontEntry::DestroyBlobFunc(void* aUserData)
|
||||
{
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
FontTableRec *ftr = static_cast<FontTableRec*>(aUserData);
|
||||
delete ftr;
|
||||
#else
|
||||
::CFRelease((CFDataRef)aUserData);
|
||||
#endif
|
||||
}
|
||||
|
||||
hb_blob_t *
|
||||
@ -342,7 +367,12 @@ MacOSFontEntry::GetFontTable(uint32_t aTag)
|
||||
return hb_blob_create((const char*)::CFDataGetBytePtr(dataRef),
|
||||
::CFDataGetLength(dataRef),
|
||||
HB_MEMORY_MODE_READONLY,
|
||||
(void*)dataRef, DestroyBlobFunc);
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
new FontTableRec(dataRef),
|
||||
#else
|
||||
(void*)dataRef,
|
||||
#endif
|
||||
DestroyBlobFunc);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user