ported mozilla upstream change: Bug 1355441 - Reuse StackNode in TreeBuilder to avoid malloc. r=hsivonen.

This commit is contained in:
Roy Tam 2019-06-29 07:35:34 +08:00
commit b7a35ab2cd
8 changed files with 578 additions and 177 deletions

View file

@ -60,6 +60,7 @@ class nsHtml5Portability;
class nsHtml5StackNode
{
public:
int32_t idxInTreeBuilder;
int32_t flags;
nsIAtom* name;
nsIAtom* popName;
@ -79,12 +80,28 @@ class nsHtml5StackNode
bool isSpecial();
bool isFosterParenting();
bool isHtmlIntegrationPoint();
nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* popName, nsIContentHandle* node);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName, bool markAsIntegrationPoint);
explicit nsHtml5StackNode(int32_t idxInTreeBuilder);
void setValues(int32_t flags,
int32_t ns,
nsIAtom* name,
nsIContentHandle* node,
nsIAtom* popName,
nsHtml5HtmlAttributes* attributes);
void setValues(nsHtml5ElementName* elementName, nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsIAtom* popName);
void setValues(nsHtml5ElementName* elementName,
nsIAtom* popName,
nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsIAtom* popName,
bool markAsIntegrationPoint);
private:
static int32_t prepareSvgFlags(int32_t flags);
static int32_t prepareMathFlags(int32_t flags, bool markAsIntegrationPoint);
@ -92,7 +109,8 @@ class nsHtml5StackNode
~nsHtml5StackNode();
void dropAttributes();
void retain();
void release();
void release(nsHtml5TreeBuilder* owningTreeBuilder);
bool isUnused();
static void initializeStatics();
static void releaseStatics();
};