diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-18 14:04:17 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:36 -0500 |
commit | 650f6b5eb31dfe6c60da16d1498f8cc3efac4dfa (patch) | |
tree | 588b205b62bbf6677eac3e679731716078452971 /parser/html/nsHtml5HtmlAttributes.h | |
parent | 90d19b0a319a2e153069896453e02a53b1e2cd06 (diff) | |
download | UXP-650f6b5eb31dfe6c60da16d1498f8cc3efac4dfa.tar UXP-650f6b5eb31dfe6c60da16d1498f8cc3efac4dfa.tar.gz UXP-650f6b5eb31dfe6c60da16d1498f8cc3efac4dfa.tar.lz UXP-650f6b5eb31dfe6c60da16d1498f8cc3efac4dfa.tar.xz UXP-650f6b5eb31dfe6c60da16d1498f8cc3efac4dfa.zip |
Bug 1355479 - Flatten attribute storage in the HTML parser to AutoTArray to avoid malloc.
- Removes nsHtml5ReleasableAttributeName
- Adds nsHtml5AttributeEntry.h
- Makes nsHtml5HtmlAttributes no longer gentered.
Tag UXP Issue #1344
Diffstat (limited to 'parser/html/nsHtml5HtmlAttributes.h')
-rw-r--r-- | parser/html/nsHtml5HtmlAttributes.h | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/parser/html/nsHtml5HtmlAttributes.h b/parser/html/nsHtml5HtmlAttributes.h index f97e80c8a..8dde05771 100644 --- a/parser/html/nsHtml5HtmlAttributes.h +++ b/parser/html/nsHtml5HtmlAttributes.h @@ -23,11 +23,6 @@ * DEALINGS IN THE SOFTWARE. */ -/* - * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT. - * Please edit HtmlAttributes.java instead and regenerate. - */ - #ifndef nsHtml5HtmlAttributes_h #define nsHtml5HtmlAttributes_h @@ -45,6 +40,8 @@ #include "nsIUnicodeDecoder.h" #include "nsHtml5Macros.h" #include "nsIContentHandle.h" +#include "nsTArray.h" +#include "nsHtml5AttributeEntry.h" class nsHtml5StreamParser; @@ -63,32 +60,39 @@ class nsHtml5HtmlAttributes public: static nsHtml5HtmlAttributes* EMPTY_ATTRIBUTES; private: - int32_t mode; - int32_t length; - autoJArray<nsHtml5AttributeName*,int32_t> names; - autoJArray<nsHtml5String,int32_t> values; - autoJArray<int32_t,int32_t> lines; + AutoTArray<nsHtml5AttributeEntry, 5> mStorage; + int32_t mMode; + void AddEntry(nsHtml5AttributeEntry&& aEntry); + public: - explicit nsHtml5HtmlAttributes(int32_t mode); + explicit nsHtml5HtmlAttributes(int32_t aMode); ~nsHtml5HtmlAttributes(); - int32_t getIndex(nsHtml5AttributeName* name); - nsHtml5String getValue(nsHtml5AttributeName* name); + + // Remove getIndex when removing isindex support + int32_t getIndex(nsHtml5AttributeName* aName); + + nsHtml5String getValue(nsHtml5AttributeName* aName); int32_t getLength(); - nsIAtom* getLocalNameNoBoundsCheck(int32_t index); - int32_t getURINoBoundsCheck(int32_t index); - nsIAtom* getPrefixNoBoundsCheck(int32_t index); - nsHtml5String getValueNoBoundsCheck(int32_t index); - nsHtml5AttributeName* getAttributeNameNoBoundsCheck(int32_t index); - int32_t getLineNoBoundsCheck(int32_t index); - void addAttribute(nsHtml5AttributeName* name, nsHtml5String value, int32_t line); - void clear(int32_t m); - void releaseValue(int32_t i); + nsIAtom* getLocalNameNoBoundsCheck(int32_t aIndex); + int32_t getURINoBoundsCheck(int32_t aIndex); + nsIAtom* getPrefixNoBoundsCheck(int32_t aIndex); + nsHtml5String getValueNoBoundsCheck(int32_t aIndex); + nsHtml5AttributeName* getAttributeNameNoBoundsCheck(int32_t aIndex); + int32_t getLineNoBoundsCheck(int32_t aIndex); + void addAttribute(nsHtml5AttributeName* aName, + nsHtml5String aValue, + int32_t aLine); + void AddAttributeWithLocal(nsIAtom* aName, + nsHtml5String aValue, + int32_t aLine); + void clear(int32_t aMode); + void releaseValue(int32_t aIndex); void clearWithoutReleasingContents(); - bool contains(nsHtml5AttributeName* name); + bool contains(nsHtml5AttributeName* aName); void adjustForMath(); void adjustForSvg(); - nsHtml5HtmlAttributes* cloneAttributes(nsHtml5AtomTable* interner); - bool equalsAnother(nsHtml5HtmlAttributes* other); + nsHtml5HtmlAttributes* cloneAttributes(nsHtml5AtomTable* aInterner); + bool equalsAnother(nsHtml5HtmlAttributes* aOther); static void initializeStatics(); static void releaseStatics(); }; |