Bug 1355769 - Avoid malloc for nsHtml5ElementName when processing a non-interned element name. r=wchen
MozReview-Commit-ID: 4In5wo0flOB
This commit is contained in:
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2007-2011 Mozilla Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@@ -98,69 +98,76 @@ nsHtml5StackNode::nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsI
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node)
|
||||
: flags(elementName->getFlags()),
|
||||
name(elementName->name),
|
||||
popName(elementName->name),
|
||||
ns(kNameSpaceID_XHTML),
|
||||
node(node),
|
||||
attributes(nullptr),
|
||||
refcount(1)
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
|
||||
nsIContentHandle* node)
|
||||
: flags(elementName->getFlags())
|
||||
, name(elementName->getName())
|
||||
, popName(elementName->getName())
|
||||
, ns(kNameSpaceID_XHTML)
|
||||
, node(node)
|
||||
, attributes(nullptr)
|
||||
, refcount(1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
MOZ_ASSERT(!elementName->isCustom(), "Don't use this constructor for custom elements.");
|
||||
MOZ_ASSERT(elementName->isInterned(),
|
||||
"Don't use this constructor for custom elements.");
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsHtml5HtmlAttributes* attributes)
|
||||
: flags(elementName->getFlags()),
|
||||
name(elementName->name),
|
||||
popName(elementName->name),
|
||||
ns(kNameSpaceID_XHTML),
|
||||
node(node),
|
||||
attributes(attributes),
|
||||
refcount(1)
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
|
||||
nsIContentHandle* node,
|
||||
nsHtml5HtmlAttributes* attributes)
|
||||
: flags(elementName->getFlags())
|
||||
, name(elementName->getName())
|
||||
, popName(elementName->getName())
|
||||
, ns(kNameSpaceID_XHTML)
|
||||
, node(node)
|
||||
, attributes(attributes)
|
||||
, refcount(1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
MOZ_ASSERT(!elementName->isCustom(), "Don't use this constructor for custom elements.");
|
||||
MOZ_ASSERT(elementName->isInterned(),
|
||||
"Don't use this constructor for custom elements.");
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName)
|
||||
: flags(elementName->getFlags()),
|
||||
name(elementName->name),
|
||||
popName(popName),
|
||||
ns(kNameSpaceID_XHTML),
|
||||
node(node),
|
||||
attributes(nullptr),
|
||||
refcount(1)
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
|
||||
nsIContentHandle* node,
|
||||
nsIAtom* popName)
|
||||
: flags(elementName->getFlags())
|
||||
, name(elementName->getName())
|
||||
, popName(popName)
|
||||
, ns(kNameSpaceID_XHTML)
|
||||
, node(node)
|
||||
, attributes(nullptr)
|
||||
, refcount(1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* popName, nsIContentHandle* node)
|
||||
: flags(prepareSvgFlags(elementName->getFlags())),
|
||||
name(elementName->name),
|
||||
popName(popName),
|
||||
ns(kNameSpaceID_SVG),
|
||||
node(node),
|
||||
attributes(nullptr),
|
||||
refcount(1)
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
|
||||
nsIAtom* popName,
|
||||
nsIContentHandle* node)
|
||||
: flags(prepareSvgFlags(elementName->getFlags()))
|
||||
, name(elementName->getName())
|
||||
, popName(popName)
|
||||
, ns(kNameSpaceID_SVG)
|
||||
, node(node)
|
||||
, attributes(nullptr)
|
||||
, refcount(1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
}
|
||||
|
||||
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName, bool markAsIntegrationPoint)
|
||||
: flags(prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint)),
|
||||
name(elementName->name),
|
||||
popName(popName),
|
||||
ns(kNameSpaceID_MathML),
|
||||
node(node),
|
||||
attributes(nullptr),
|
||||
refcount(1)
|
||||
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName,
|
||||
nsIContentHandle* node,
|
||||
nsIAtom* popName,
|
||||
bool markAsIntegrationPoint)
|
||||
: flags(prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint))
|
||||
, name(elementName->getName())
|
||||
, popName(popName)
|
||||
, ns(kNameSpaceID_MathML)
|
||||
, node(node)
|
||||
, attributes(nullptr)
|
||||
, refcount(1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5StackNode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user