Fixing bug 112473. Eliminate unnecessary allocations in the CSS parser and speed up NS_NewHTMLReflowCommand() a bit. r=dbaron@fas.harvard.edu, rs=waterson@netscape.com
git-svn-id: svn://10.0.0.236/trunk@109187 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -625,7 +625,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
|
||||
|
||||
// XXXldb XXXperf nsIUnicharInputStream is horrible! It makes us make
|
||||
// a copy.
|
||||
nsString* str = new nsString(aAttributeValue);
|
||||
nsString* str = new nsAutoString(aAttributeValue);
|
||||
if (nsnull == str) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@@ -791,7 +791,7 @@ CSSParserImpl::ParseProperty(const nsAReadableString& aPropName,
|
||||
NS_ASSERTION(nsnull != aBaseURL, "need base URL");
|
||||
NS_ASSERTION(nsnull != aDeclaration, "Need declaration to parse into!");
|
||||
|
||||
nsString* str = new nsString(aPropValue);
|
||||
nsString* str = new nsAutoString(aPropValue);
|
||||
if (!str) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@@ -55,16 +55,18 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIAtom* aAttribute)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLReflowCommand* cmd = new nsHTMLReflowCommand(aTargetFrame, aReflowType, aChildFrame, aAttribute);
|
||||
if (nsnull == cmd) {
|
||||
NS_ASSERTION(aInstancePtrResult,
|
||||
"null result passed to NS_NewHTMLReflowCommand");
|
||||
|
||||
*aInstancePtrResult = new nsHTMLReflowCommand(aTargetFrame, aReflowType,
|
||||
aChildFrame, aAttribute);
|
||||
if (!*aInstancePtrResult) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return cmd->QueryInterface(NS_GET_IID(nsIReflowCommand), (void**)aInstancePtrResult);
|
||||
NS_ADDREF(*aInstancePtrResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_jesup
|
||||
|
||||
@@ -55,16 +55,18 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
|
||||
nsIFrame* aChildFrame,
|
||||
nsIAtom* aAttribute)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsHTMLReflowCommand* cmd = new nsHTMLReflowCommand(aTargetFrame, aReflowType, aChildFrame, aAttribute);
|
||||
if (nsnull == cmd) {
|
||||
NS_ASSERTION(aInstancePtrResult,
|
||||
"null result passed to NS_NewHTMLReflowCommand");
|
||||
|
||||
*aInstancePtrResult = new nsHTMLReflowCommand(aTargetFrame, aReflowType,
|
||||
aChildFrame, aAttribute);
|
||||
if (!*aInstancePtrResult) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return cmd->QueryInterface(NS_GET_IID(nsIReflowCommand), (void**)aInstancePtrResult);
|
||||
NS_ADDREF(*aInstancePtrResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_jesup
|
||||
|
||||
@@ -625,7 +625,7 @@ CSSParserImpl::ParseStyleAttribute(const nsAReadableString& aAttributeValue,
|
||||
|
||||
// XXXldb XXXperf nsIUnicharInputStream is horrible! It makes us make
|
||||
// a copy.
|
||||
nsString* str = new nsString(aAttributeValue);
|
||||
nsString* str = new nsAutoString(aAttributeValue);
|
||||
if (nsnull == str) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@@ -791,7 +791,7 @@ CSSParserImpl::ParseProperty(const nsAReadableString& aPropName,
|
||||
NS_ASSERTION(nsnull != aBaseURL, "need base URL");
|
||||
NS_ASSERTION(nsnull != aDeclaration, "Need declaration to parse into!");
|
||||
|
||||
nsString* str = new nsString(aPropValue);
|
||||
nsString* str = new nsAutoString(aPropValue);
|
||||
if (!str) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user