Bug 551344 part 2 - Address sicking's review comments in nsHtml5TreeOpExecutor.cpp. r=jonas.
authorHenri Sivonen <hsivonen@iki.fi>
Mon, 15 Mar 2010 14:04:42 +0200
changeset 40913 47327da4d134e85f82f8dbdc577ed3610dd3de37
parent 40912 fc3befa99ab72d146c0c54b2e18f9f01f4b929e9
child 40914 a8327985f6e4372ce9abca8ad8e87321e11f2cd1
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonas
bugs551344
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 551344 part 2 - Address sicking's review comments in nsHtml5TreeOpExecutor.cpp. r=jonas.
parser/html/nsHtml5TreeOpExecutor.cpp
parser/html/nsHtml5TreeOpExecutor.h
parser/html/nsHtml5TreeOperation.cpp
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -113,30 +113,31 @@ nsHtml5TreeOpExecutor::WillParse()
 
 // This is called when the tree construction has ended
 NS_IMETHODIMP
 nsHtml5TreeOpExecutor::DidBuildModel(PRBool aTerminated)
 {
   NS_PRECONDITION(mStarted, "Bad life cycle.");
 
   if (!aTerminated) {
-    // Break out of update batch if we are in one 
-    // and aren't forcibly terminating
+    // This is needed to avoid unblocking loads too many times on one hand
+    // and on the other hand to avoid destroying the frame constructor from
+    // within an update batch. See bug 537683.
     EndDocUpdate();
     
     // If the above caused a call to nsIParser::Terminate(), let that call
     // win.
     if (!mParser) {
       return NS_OK;
     }
   }
   
   static_cast<nsHtml5Parser*> (mParser.get())->DropStreamParser();
 
-  // This is comes from nsXMLContentSink and nsHTMLContentSink
+  // This comes from nsXMLContentSink and nsHTMLContentSink
   DidBuildModelImpl(aTerminated);
 
   if (!mLayoutStarted) {
     // We never saw the body, and layout never got started. Force
     // layout *now*, to get an initial reflow.
 
     // NOTE: only force the layout if we are NOT destroying the
     // docshell. If we are destroying it, then starting layout will
@@ -209,21 +210,21 @@ nsHtml5TreeOpExecutor::SetDocumentCharse
     mDocument->SetDocumentCharacterSetSource(aCharsetSource);
     mDocument->SetDocumentCharacterSet(aCharset);
   }
   if (mDocShell) {
     // the following logic to get muCV is copied from
     // nsHTMLDocument::StartDocumentLoad
     // We need to call muCV->SetPrevDocCharacterSet here in case
     // the charset is detected by parser DetectMetaTag
-    nsCOMPtr<nsIMarkupDocumentViewer> muCV;
+    nsCOMPtr<nsIMarkupDocumentViewer> mucv;
     nsCOMPtr<nsIContentViewer> cv;
     mDocShell->GetContentViewer(getter_AddRefs(cv));
     if (cv) {
-      muCV = do_QueryInterface(cv);
+      mucv = do_QueryInterface(cv);
     } else {
       // in this block of code, if we get an error result, we return
       // it but if we get a null pointer, that's perfectly legal for
       // parent and parentContentViewer
       nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
         do_QueryInterface(mDocShell);
       if (!docShellAsItem) {
     	  return;
@@ -231,22 +232,22 @@ nsHtml5TreeOpExecutor::SetDocumentCharse
       nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
       docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem));
       nsCOMPtr<nsIDocShell> parent(do_QueryInterface(parentAsItem));
       if (parent) {
         nsCOMPtr<nsIContentViewer> parentContentViewer;
         nsresult rv =
           parent->GetContentViewer(getter_AddRefs(parentContentViewer));
         if (NS_SUCCEEDED(rv) && parentContentViewer) {
-          muCV = do_QueryInterface(parentContentViewer);
+          mucv = do_QueryInterface(parentContentViewer);
         }
       }
     }
-    if (muCV) {
-      muCV->SetPrevDocCharacterSet(aCharset);
+    if (mucv) {
+      mucv->SetPrevDocCharacterSet(aCharset);
     }
   }
 }
 
 nsISupports*
 nsHtml5TreeOpExecutor::GetTarget()
 {
   return mDocument;
@@ -650,17 +651,17 @@ nsHtml5TreeOpExecutor::IsScriptEnabled()
   NS_ENSURE_TRUE(cx, PR_TRUE);
   PRBool enabled = PR_TRUE;
   nsContentUtils::GetSecurityManager()->
     CanExecuteScripts(cx, mDocument->NodePrincipal(), &enabled);
   return enabled;
 }
 
 void
-nsHtml5TreeOpExecutor::DocumentMode(nsHtml5DocumentMode m)
+nsHtml5TreeOpExecutor::SetDocumentMode(nsHtml5DocumentMode m)
 {
   nsCompatibility mode = eCompatibility_NavQuirks;
   switch (m) {
     case STANDARDS_MODE:
       mode = eCompatibility_FullStandards;
       break;
     case ALMOST_STANDARDS_MODE:
       mode = eCompatibility_AlmostStandards;
--- a/parser/html/nsHtml5TreeOpExecutor.h
+++ b/parser/html/nsHtml5TreeOpExecutor.h
@@ -320,17 +320,17 @@ class nsHtml5TreeOpExecutor : public nsC
           }
         }
         aNode = parent;
       }
     }
 
     void StartLayout();
     
-    void DocumentMode(nsHtml5DocumentMode m);
+    void SetDocumentMode(nsHtml5DocumentMode m);
 
     nsresult Init(nsIDocument* aDoc, nsIURI* aURI,
                   nsISupports* aContainer, nsIChannel* aChannel);
 
     void FlushSpeculativeLoads();
                   
     void RunFlushLoop();
 
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -632,17 +632,17 @@ nsHtml5TreeOperation::Perform(nsHtml5Tre
       aBuilder->DidBuildModel(PR_FALSE); // this causes a notifications flush anyway
       return rv;
     }
     case eTreeOpStartLayout: {
       aBuilder->StartLayout(); // this causes a notification flush anyway
       return rv;
     }
     case eTreeOpDocumentMode: {
-      aBuilder->DocumentMode(mOne.mode);
+      aBuilder->SetDocumentMode(mOne.mode);
       return rv;
     }
     case eTreeOpSetStyleLineNumber: {
       nsIContent* node = *(mOne.node);
       nsCOMPtr<nsIStyleSheetLinkingElement> ssle = do_QueryInterface(node);
       NS_ASSERTION(ssle, "Node didn't QI to style.");
       ssle->SetLineNumber(mInt);
       return rv;