Bug 612568 - Drop nsIContent handles when finished parsing a fragment. r=Olli.Pettay, a=jst.
authorHenri Sivonen <hsivonen@iki.fi>
Thu, 18 Nov 2010 10:19:59 +0200
changeset 57848 a74526663273be7605ba513fa1ca6a81e75ac7dc
parent 57847 f6fec8c990b1587a61843fa032e52d7fbe3627cd
child 57849 fe9637495f974593b4c6e706f1ddb22b57c021f6
push id17040
push userhsivonen@iki.fi
push dateThu, 18 Nov 2010 08:43:19 +0000
treeherderautoland@d6d9cb57b170 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersOlli.Pettay, jst
bugs612568
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 612568 - Drop nsIContent handles when finished parsing a fragment. r=Olli.Pettay, a=jst.
parser/html/nsHtml5Parser.cpp
parser/html/nsHtml5TreeBuilderCppSupplement.h
parser/html/nsHtml5TreeBuilderHSupplement.h
--- a/parser/html/nsHtml5Parser.cpp
+++ b/parser/html/nsHtml5Parser.cpp
@@ -493,16 +493,17 @@ nsHtml5Parser::ParseHtml5Fragment(const 
   }
   mTokenizer->eof();
   mTreeBuilder->StreamEnded();
   mTreeBuilder->Flush();
   mExecutor->FlushDocumentWrite();
   mTokenizer->end();
   mExecutor->DropParserAndPerfHint();
   mExecutor->DropHeldElements();
+  mTreeBuilder->DropHandles();
   mAtomTable.Clear();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHtml5Parser::BuildModel()
 {
   NS_NOTREACHED("Don't call this!");
--- a/parser/html/nsHtml5TreeBuilderCppSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h
@@ -662,16 +662,23 @@ nsHtml5TreeBuilder::AddSnapshotToScript(
 PRBool 
 nsHtml5TreeBuilder::IsDiscretionaryFlushSafe()
 {
   return !(charBufferLen && 
            currentPtr >= 0 && 
            stack[currentPtr]->fosterParenting);
 }
 
+void
+nsHtml5TreeBuilder::DropHandles()
+{
+  mOldHandles.Clear();
+  mHandlesUsed = 0;
+}
+
 // DocumentModeHandler
 void
 nsHtml5TreeBuilder::documentMode(nsHtml5DocumentMode m)
 {
   nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
   NS_ASSERTION(treeOp, "Tree op allocation failed.");
   treeOp->Init(m);
 }
--- a/parser/html/nsHtml5TreeBuilderHSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderHSupplement.h
@@ -90,8 +90,10 @@
 
     void SetDocumentCharset(nsACString& aCharset, PRInt32 aCharsetSource);
 
     void StreamEnded();
 
     void NeedsCharsetSwitchTo(const nsACString& aEncoding);
 
     void AddSnapshotToScript(nsAHtml5TreeBuilderState* aSnapshot, PRInt32 aLine);
+
+    void DropHandles();