Bug 403549: Avoid memory churn from nsContentUtils::CreateContextualFragment by giving nsIParser::ParseFragment a better signature. r/sr=stuart
git-svn-id: svn://10.0.0.236/trunk@239246 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -51,12 +51,12 @@
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIDTD.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
// {d49b492c-1bdb-4b41-a138-9495a72fc11c}
|
||||
// {506527cc-d832-420b-ba3a-80c05aa105f4}
|
||||
#define NS_IPARSER_IID \
|
||||
{ 0xd49b492c, 0x1bdb, 0x4b41, \
|
||||
{ 0xa1, 0x38, 0x94, 0x95, 0xa7, 0x2f, 0xc1, 0x1c } }
|
||||
{ 0x506527cc, 0xd832, 0x420b, \
|
||||
{ 0xba, 0x3a, 0x80, 0xc0, 0x5a, 0xa1, 0x05, 0xf4 } }
|
||||
|
||||
|
||||
// {41421C60-310A-11d4-816F-000064657374}
|
||||
@@ -254,7 +254,7 @@ class nsIParser : public nsISupports {
|
||||
*/
|
||||
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
|
||||
void* aKey,
|
||||
nsVoidArray& aTagStack,
|
||||
nsTArray<nsAutoString>& aTagStack,
|
||||
PRBool aXMLMode,
|
||||
const nsACString& aContentType,
|
||||
nsDTDMode aMode = eDTDMode_autodetect) = 0;
|
||||
|
||||
@@ -1423,14 +1423,14 @@ nsParser::Parse(const nsAString& aSourceBuffer,
|
||||
NS_IMETHODIMP
|
||||
nsParser::ParseFragment(const nsAString& aSourceBuffer,
|
||||
void* aKey,
|
||||
nsVoidArray& aTagStack,
|
||||
nsTArray<nsAutoString>& aTagStack,
|
||||
PRBool aXMLMode,
|
||||
const nsACString& aMimeType,
|
||||
nsDTDMode aMode)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsAutoString theContext;
|
||||
PRUint32 theCount = aTagStack.Count();
|
||||
PRUint32 theCount = aTagStack.Length();
|
||||
PRUint32 theIndex = 0;
|
||||
|
||||
// Disable observers for fragments
|
||||
@@ -1438,7 +1438,7 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer,
|
||||
|
||||
for (theIndex = 0; theIndex < theCount; theIndex++) {
|
||||
theContext.AppendLiteral("<");
|
||||
theContext.Append((PRUnichar*)aTagStack.ElementAt(theCount - theIndex - 1));
|
||||
theContext.Append(aTagStack[theCount - theIndex - 1]);
|
||||
theContext.AppendLiteral(">");
|
||||
}
|
||||
|
||||
@@ -1515,7 +1515,7 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer,
|
||||
endContext.AppendLiteral("</");
|
||||
}
|
||||
|
||||
nsAutoString thisTag( (PRUnichar*)aTagStack.ElementAt(theIndex) );
|
||||
nsAutoString& thisTag = aTagStack[theIndex];
|
||||
// was there an xmlns=?
|
||||
PRInt32 endOfTag = thisTag.FindChar(PRUnichar(' '));
|
||||
if (endOfTag == -1) {
|
||||
|
||||
@@ -219,7 +219,7 @@ class nsParser : public nsIParser,
|
||||
*/
|
||||
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
|
||||
void* aKey,
|
||||
nsVoidArray& aTagStack,
|
||||
nsTArray<nsAutoString>& aTagStack,
|
||||
PRBool aXMLMode,
|
||||
const nsACString& aContentType,
|
||||
nsDTDMode aMode = eDTDMode_autodetect);
|
||||
|
||||
Reference in New Issue
Block a user