Backout 8cf563a575fd (bug 734015) due to random Moth orange.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 23 May 2012 19:27:40 -0400
changeset 94733 d499dc65cdabd29f1a87879bf5701fdb3d281acf
parent 94732 c3495842c662bb0b8528f4dcd33cc8662574a8a7
child 94734 9ea2c30127ef15399dc5ba440e7a45429ab26766
child 94743 8aeae08720f88e0b6043fc1a51132e731d324cf6
push id9772
push userryanvm@gmail.com
push dateWed, 23 May 2012 23:35:15 +0000
treeherdermozilla-inbound@9ea2c30127ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs734015
milestone15.0a1
backs out8cf563a575fdba335c3a862fd6da19aedb9965c8
first release with
nightly linux32
d499dc65cdab / 15.0a1 / 20120523164348 / files
nightly linux64
d499dc65cdab / 15.0a1 / 20120523164348 / files
nightly mac
d499dc65cdab / 15.0a1 / 20120523164348 / files
nightly win32
d499dc65cdab / 15.0a1 / 20120523164348 / files
nightly win64
d499dc65cdab / 15.0a1 / 20120523164348 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout 8cf563a575fd (bug 734015) due to random Moth orange.
content/base/public/nsIDocument.h
content/base/src/nsContentSink.cpp
parser/html/nsHtml5StreamParser.cpp
parser/html/nsHtml5TreeOpExecutor.cpp
parser/html/nsHtml5TreeOpExecutor.h
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -87,18 +87,18 @@ class Loader;
 
 namespace dom {
 class Link;
 class Element;
 } // namespace dom
 } // namespace mozilla
 
 #define NS_IDOCUMENT_IID \
-{ 0x8c6a1e62, 0xd5ad, 0x4297, \
-  { 0xb9, 0x41, 0x64, 0x49, 0x22, 0x2e, 0xc4, 0xf0 } }
+{ 0x88d887da, 0xd228, 0x41c2, \
+  { 0xb8, 0x0a, 0x42, 0xec, 0xf0, 0xcb, 0xce, 0x37 } }
 
 // Flag for AddStyleSheet().
 #define NS_STYLESHEET_FROM_CATALOG                (1 << 0)
 
 // Enum for requesting a particular type of document when creating a doc
 enum DocumentFlavor {
   DocumentFlavorLegacyGuess, // compat with old code until made HTML5-compliant
   DocumentFlavorHTML, // HTMLDocument with HTMLness bit set to true
@@ -669,22 +669,16 @@ public:
   /**
    * Return the window containing the document (the outer window).
    */
   nsPIDOMWindow *GetWindow() const
   {
     return mWindow ? mWindow->GetOuterWindow() : GetWindowInternal();
   }
 
-  bool IsInBackgroundWindow() const
-  {
-    nsPIDOMWindow* outer = mWindow ? mWindow->GetOuterWindow() : nsnull;
-    return outer && outer->IsBackground();
-  }
-  
   /**
    * Return the inner window used as the script compilation scope for
    * this document. If you're not absolutely sure you need this, use
    * GetWindow().
    */
   nsPIDOMWindow* GetInnerWindow()
   {
     return mRemovedFromDocShell ? GetInnerWindowInternal() : mWindow;
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -1542,19 +1542,18 @@ nsContentSink::WillParseImpl(void)
 
   if (sEnablePerfMode == 0) {
     nsIViewManager* vm = shell->GetViewManager();
     NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
     PRUint32 lastEventTime;
     vm->GetLastUserEventTime(lastEventTime);
 
     bool newDynLower =
-      mDocument->IsInBackgroundWindow() ||
-      ((currentTime - mBeginLoadTime) > PRUint32(sInitialPerfTime) &&
-       (currentTime - lastEventTime) < PRUint32(sInteractiveTime));
+      (currentTime - mBeginLoadTime) > PRUint32(sInitialPerfTime) &&
+      (currentTime - lastEventTime) < PRUint32(sInteractiveTime);
     
     if (mDynamicLowerValue != newDynLower) {
       FavorPerformanceHint(!newDynLower, 0);
       mDynamicLowerValue = newDynLower;
     }
   }
   
   mDeflectedCount = 0;
--- a/parser/html/nsHtml5StreamParser.cpp
+++ b/parser/html/nsHtml5StreamParser.cpp
@@ -152,19 +152,17 @@ class nsHtml5ExecutorFlusher : public ns
   private:
     nsRefPtr<nsHtml5TreeOpExecutor> mExecutor;
   public:
     nsHtml5ExecutorFlusher(nsHtml5TreeOpExecutor* aExecutor)
       : mExecutor(aExecutor)
     {}
     NS_IMETHODIMP Run()
     {
-      if (!mExecutor->isInList()) {
-        mExecutor->RunFlushLoop();
-      }
+      mExecutor->RunFlushLoop();
       return NS_OK;
     }
 };
 
 class nsHtml5LoadFlusher : public nsRunnable
 {
   private:
     nsRefPtr<nsHtml5TreeOpExecutor> mExecutor;
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -94,41 +94,26 @@ class nsHtml5ExecutorReflusher : public 
     {}
     NS_IMETHODIMP Run()
     {
       mExecutor->RunFlushLoop();
       return NS_OK;
     }
 };
 
-static mozilla::LinkedList<nsHtml5TreeOpExecutor>* gBackgroundFlushList = nsnull;
-static nsITimer* gFlushTimer = nsnull;
-
 nsHtml5TreeOpExecutor::nsHtml5TreeOpExecutor(bool aRunsToCompletion)
 {
   mRunsToCompletion = aRunsToCompletion;
   mPreloadedURLs.Init(23); // Mean # of preloadable resources per page on dmoz
   // zeroing operator new for everything else
 }
 
 nsHtml5TreeOpExecutor::~nsHtml5TreeOpExecutor()
 {
   NS_ASSERTION(mOpQueue.IsEmpty(), "Somehow there's stuff in the op queue.");
-  
-  if (gBackgroundFlushList && isInList()) {
-    remove();
-    if (gBackgroundFlushList->isEmpty()) {
-      delete gBackgroundFlushList;
-      gBackgroundFlushList = nsnull;
-      if (gFlushTimer) {
-        gFlushTimer->Cancel();
-        NS_RELEASE(gFlushTimer);
-      }
-    }
-  }
 }
 
 // nsIContentSink
 NS_IMETHODIMP
 nsHtml5TreeOpExecutor::WillParse()
 {
   NS_NOTREACHED("No one should call this");
   return NS_ERROR_NOT_IMPLEMENTED;
@@ -332,55 +317,22 @@ nsHtml5TreeOpExecutor::MarkAsBroken(nsre
 
 nsresult
 nsHtml5TreeOpExecutor::FlushTags()
 {
   return NS_OK;
 }
 
 void
-FlushTimerCallback(nsITimer* aTimer, void* aClosure)
-{
-  nsRefPtr<nsHtml5TreeOpExecutor> ex = gBackgroundFlushList->popFirst();
-  if (ex) {
-    ex->RunFlushLoop();
-  }
-  if (gBackgroundFlushList && gBackgroundFlushList->isEmpty()) {
-    delete gBackgroundFlushList;
-    gBackgroundFlushList = nsnull;
-    gFlushTimer->Cancel();
-    NS_RELEASE(gFlushTimer);
-  }
-}
-
-void
 nsHtml5TreeOpExecutor::ContinueInterruptedParsingAsync()
 {
-  if (!mDocument || !mDocument->IsInBackgroundWindow()) {
-    nsCOMPtr<nsIRunnable> flusher = new nsHtml5ExecutorReflusher(this);  
-    if (NS_FAILED(NS_DispatchToMainThread(flusher))) {
-      NS_WARNING("failed to dispatch executor flush event");
-    }
-  } else {
-    if (!gBackgroundFlushList) {
-      gBackgroundFlushList = new mozilla::LinkedList<nsHtml5TreeOpExecutor>();
-    }
-    if (!isInList()) {
-      gBackgroundFlushList->insertBack(this);
-    }
-    if (!gFlushTimer) {
-      nsCOMPtr<nsITimer> t = do_CreateInstance("@mozilla.org/timer;1");
-      t.swap(gFlushTimer);
-      // The timer value 50 should not hopefully slow down background pages too
-      // much, yet lets event loop to process enough between ticks.
-      // See bug 734015.
-      gFlushTimer->InitWithFuncCallback(FlushTimerCallback, nsnull,
-                                        50, nsITimer::TYPE_REPEATING_SLACK);
-    }
-  }
+  nsCOMPtr<nsIRunnable> flusher = new nsHtml5ExecutorReflusher(this);  
+  if (NS_FAILED(NS_DispatchToMainThread(flusher))) {
+    NS_WARNING("failed to dispatch executor flush event");
+  }          
 }
 
 void
 nsHtml5TreeOpExecutor::UpdateStyleSheet(nsIContent* aElement)
 {
   // Break out of the doc update created by Flush() to zap a runnable 
   // waiting to call UpdateStyleSheet without the right observer
   EndDocUpdate();
--- a/parser/html/nsHtml5TreeOpExecutor.h
+++ b/parser/html/nsHtml5TreeOpExecutor.h
@@ -53,17 +53,16 @@
 #include "nsHtml5DocumentMode.h"
 #include "nsIScriptElement.h"
 #include "nsIParser.h"
 #include "nsAHtml5TreeOpSink.h"
 #include "nsHtml5TreeOpStage.h"
 #include "nsIURI.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
-#include "mozilla/LinkedList.h"
 
 class nsHtml5Parser;
 class nsHtml5TreeBuilder;
 class nsHtml5Tokenizer;
 class nsHtml5StreamParser;
 
 typedef nsIContent* nsIContentPtr;
 
@@ -71,18 +70,17 @@ enum eHtml5FlushState {
   eNotFlushing = 0,  // not flushing
   eInFlush = 1,      // the Flush() method is on the call stack
   eInDocUpdate = 2,  // inside an update batch on the document
   eNotifying = 3     // flushing pending append notifications
 };
 
 class nsHtml5TreeOpExecutor : public nsContentSink,
                               public nsIContentSink,
-                              public nsAHtml5TreeOpSink,
-                              public mozilla::LinkedListElement<nsHtml5TreeOpExecutor>
+                              public nsAHtml5TreeOpSink
 {
   friend class nsHtml5FlushLoopGuard;
 
   public:
     NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
     NS_DECL_ISUPPORTS_INHERITED
     NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHtml5TreeOpExecutor, nsContentSink)