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
This commit is contained in:
Gaming4JC 2020-01-18 14:04:17 -05:00 committed by Roy Tam
commit a330217f3f
6 changed files with 212 additions and 179 deletions

View file

@ -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();
};