WebKit Bugzilla
Attachment 349276 Details for
Bug 189147
: svg/W3C-SVG-1.1/render-groups-03-t.svg and some other SVG tests leak documents
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch showing how to use RefToken tracking on SVGFontFaceElements
SVGFontFaceElement-ref-tracking.patch (text/plain), 3.47 KB, created by
Simon Fraser (smfr)
on 2018-09-08 20:29:19 PDT
(
hide
)
Description:
Patch showing how to use RefToken tracking on SVGFontFaceElements
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-09-08 20:29:19 PDT
Size:
3.47 KB
patch
obsolete
>diff --git a/Source/WebCore/page/mac/PageMac.mm b/Source/WebCore/page/mac/PageMac.mm >index 44e940c1ee45968ead1fc9234570d9d91dede833..c1f39536b13ec00554263a364ede90e98d7132aa 100644 >--- a/Source/WebCore/page/mac/PageMac.mm >+++ b/Source/WebCore/page/mac/PageMac.mm >@@ -37,6 +37,7 @@ > #import "Logging.h" > #import "RenderObject.h" > #import "SVGDocument.h" >+#import "SVGFontFaceElement.h" > #import <pal/Logging.h> > > #if PLATFORM(IOS) >@@ -81,6 +82,11 @@ void Page::platformInitialize() > const char* documentType = is<SVGDocument>(document) ? "SVGDocument" : "Document"; > WTFLogAlways("%s %p %llu (refCount %d, referencingNodeCount %d) %s", documentType, document, document->identifier().toUInt64(), document->refCount(), document->referencingNodeCount(), document->url().string().utf8().data()); > } >+ >+ for (auto* element : SVGFontFaceElement::allSVGFontFaceElements()) { >+ WTFLogAlways("SVGFontFaceElement %p (refCount %d)", element, element->refCount()); >+ element->refTracker().dumpRemainingReferences(); >+ } > }); > }); > } >diff --git a/Source/WebCore/svg/SVGFontFaceElement.cpp b/Source/WebCore/svg/SVGFontFaceElement.cpp >index 90ec2697c774ec3ac9900fd3b6049b82828079df..fc218a6b1298549b17625faa5402f494e4b6bb4f 100644 >--- a/Source/WebCore/svg/SVGFontFaceElement.cpp >+++ b/Source/WebCore/svg/SVGFontFaceElement.cpp >@@ -51,12 +51,20 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFontFaceElement); > > using namespace SVGNames; > >+HashSet<SVGFontFaceElement*>& SVGFontFaceElement::allSVGFontFaceElements() >+{ >+ static NeverDestroyed<HashSet<SVGFontFaceElement*>> allElements; >+ return allElements; >+} >+ > inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) > , m_fontFaceRule(StyleRuleFontFace::create(MutableStyleProperties::create(HTMLStandardMode))) > , m_fontElement(nullptr) > { > ASSERT(hasTagName(font_faceTag)); >+ >+ allSVGFontFaceElements().add(this); > } > > Ref<SVGFontFaceElement> SVGFontFaceElement::create(const QualifiedName& tagName, Document& document) >@@ -64,6 +72,11 @@ Ref<SVGFontFaceElement> SVGFontFaceElement::create(const QualifiedName& tagName, > return adoptRef(*new SVGFontFaceElement(tagName, document)); > } > >+SVGFontFaceElement::~SVGFontFaceElement() >+{ >+ allSVGFontFaceElements().remove(this); >+} >+ > void SVGFontFaceElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > CSSPropertyID propertyId = cssPropertyIdForSVGAttributeName(name); >diff --git a/Source/WebCore/svg/SVGFontFaceElement.h b/Source/WebCore/svg/SVGFontFaceElement.h >index 4d5365345b5060ecd765fd17d3bf225d008c3e3a..82988782f42c920e9dddcfc37e75b1e8b19e2982 100644 >--- a/Source/WebCore/svg/SVGFontFaceElement.h >+++ b/Source/WebCore/svg/SVGFontFaceElement.h >@@ -24,6 +24,7 @@ > #if ENABLE(SVG_FONTS) > > #include "SVGElement.h" >+#include <wtf/HashSet.h> > > namespace WebCore { > >@@ -34,6 +35,8 @@ class SVGFontFaceElement final : public SVGElement { > WTF_MAKE_ISO_ALLOCATED(SVGFontFaceElement); > public: > static Ref<SVGFontFaceElement> create(const QualifiedName&, Document&); >+ >+ static HashSet<SVGFontFaceElement*>& allSVGFontFaceElements(); > > unsigned unitsPerEm() const; > int xHeight() const; >@@ -55,6 +58,7 @@ public: > > private: > SVGFontFaceElement(const QualifiedName&, Document&); >+ ~SVGFontFaceElement(); > > void parseAttribute(const QualifiedName&, const AtomicString&) final; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189147
: 349276 |
349282