Backed out changeset b6422d885f48 (bug 1342863)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 23 Mar 2017 08:41:38 +0100
changeset 349014 f7b3ed3f4674d2b37fc143730c1a06049b7c9820
parent 349013 8336e78ce5b43b1e70b690f6231b563c6aa8b050
child 349015 9a6b874ce36df39ae189be8fa13878f4e6817671
push id39380
push usercbook@mozilla.com
push dateThu, 23 Mar 2017 07:42:12 +0000
treeherderautoland@9a6b874ce36d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1342863
milestone55.0a1
backs outb6422d885f48c555978fa56712c1b994ea6ba421
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
Backed out changeset b6422d885f48 (bug 1342863)
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1086,19 +1086,17 @@ nsPresContext::UpdateCharSet(const nsCSt
 NS_IMETHODIMP
 nsPresContext::Observe(nsISupports* aSubject,
                         const char* aTopic,
                         const char16_t* aData)
 {
   if (!nsCRT::strcmp(aTopic, "charset")) {
     RefPtr<CharSetChangingRunnable> runnable =
       new CharSetChangingRunnable(this, NS_LossyConvertUTF16toASCII(aData));
-    return Document()->Dispatch("CharSetChangingRunnable",
-                                TaskCategory::Other,
-                                runnable.forget());
+    return NS_DispatchToCurrentThread(runnable);
   }
 
   NS_WARNING("unrecognized topic in nsPresContext::Observe");
   return NS_ERROR_FAILURE;
 }
 
 nsPresContext*
 nsPresContext::GetParentPresContext()
@@ -1745,20 +1743,17 @@ void
 nsPresContext::ThemeChanged()
 {
   if (!mPendingThemeChanged) {
     sLookAndFeelChanged = true;
     sThemeChanged = true;
 
     nsCOMPtr<nsIRunnable> ev =
       NewRunnableMethod(this, &nsPresContext::ThemeChangedInternal);
-    nsresult rv = Document()->Dispatch("nsPresContext::ThemeChangedInternal",
-                                       TaskCategory::Other,
-                                       ev.forget());
-    if (NS_SUCCEEDED(rv)) {
+    if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
       mPendingThemeChanged = true;
     }
   }
 }
 
 static bool
 NotifyThemeChanged(TabParent* aTabParent, void* aArg)
 {
@@ -1808,20 +1803,17 @@ nsPresContext::ThemeChangedInternal()
 
 void
 nsPresContext::SysColorChanged()
 {
   if (!mPendingSysColorChanged) {
     sLookAndFeelChanged = true;
     nsCOMPtr<nsIRunnable> ev =
       NewRunnableMethod(this, &nsPresContext::SysColorChangedInternal);
-    nsresult rv = Document()->Dispatch("nsPresContext::SysColorChangedInternal",
-                                       TaskCategory::Other,
-                                       ev.forget());
-    if (NS_SUCCEEDED(rv)) {
+    if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
       mPendingSysColorChanged = true;
     }
   }
 }
 
 void
 nsPresContext::SysColorChangedInternal()
 {
@@ -1843,21 +1835,17 @@ nsPresContext::SysColorChangedInternal()
 }
 
 void
 nsPresContext::UIResolutionChanged()
 {
   if (!mPendingUIResolutionChanged) {
     nsCOMPtr<nsIRunnable> ev =
       NewRunnableMethod(this, &nsPresContext::UIResolutionChangedInternal);
-    nsresult rv =
-      Document()->Dispatch("nsPresContext::UIResolutionChangedInternal",
-                           TaskCategory::Other,
-                           ev.forget());
-    if (NS_SUCCEEDED(rv)) {
+    if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
       mPendingUIResolutionChanged = true;
     }
   }
 }
 
 void
 nsPresContext::UIResolutionChangedSync()
 {
@@ -2103,21 +2091,17 @@ nsPresContext::PostMediaFeatureValuesCha
 {
   // FIXME: We should probably replace this event with use of
   // nsRefreshDriver::AddStyleFlushObserver (except the pres shell would
   // need to track whether it's been added).
   if (!mPendingMediaFeatureValuesChanged && mShell) {
     nsCOMPtr<nsIRunnable> ev =
       NewRunnableMethod("nsPresContext::HandleMediaFeatureValuesChangedEvent",
                         this, &nsPresContext::HandleMediaFeatureValuesChangedEvent);
-    nsresult rv =
-      Document()->Dispatch("nsPresContext::HandleMediaFeatureValuesChangedEvent",
-                           TaskCategory::Other,
-                           ev.forget());
-    if (NS_SUCCEEDED(rv)) {
+    if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
       mPendingMediaFeatureValuesChanged = true;
       mShell->SetNeedStyleFlush();
     }
   }
 }
 
 void
 nsPresContext::HandleMediaFeatureValuesChangedEvent()
@@ -2300,21 +2284,17 @@ nsPresContext::RebuildCounterStyles()
   mCounterStylesDirty = true;
   if (mShell) {
     mShell->SetNeedStyleFlush();
   }
   if (!mPostedFlushCounterStyles) {
     nsCOMPtr<nsIRunnable> ev =
       NewRunnableMethod("nsPresContext::HandleRebuildCounterStyles",
                         this, &nsPresContext::HandleRebuildCounterStyles);
-    nsresult rv =
-      Document()->Dispatch("nsPresContext::HandleRebuildCounterStyles",
-                           TaskCategory::Other,
-                           ev.forget());
-    if (NS_SUCCEEDED(rv)) {
+    if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
       mPostedFlushCounterStyles = true;
     }
   }
 }
 
 void
 nsPresContext::NotifyMissingFonts()
 {
@@ -3333,19 +3313,17 @@ nsRootPresContext::CancelAllDidPaintTime
   mNotifyDidPaintTimers.Clear();
 }
 
 void
 nsRootPresContext::AddWillPaintObserver(nsIRunnable* aRunnable)
 {
   if (!mWillPaintFallbackEvent.IsPending()) {
     mWillPaintFallbackEvent = new RunWillPaintObservers(this);
-    Document()->Dispatch("RunWillPaintObservers",
-                         TaskCategory::Other,
-                         do_AddRef(mWillPaintFallbackEvent.get()));
+    NS_DispatchToMainThread(mWillPaintFallbackEvent.get());
   }
   mWillPaintObservers.AppendElement(aRunnable);
 }
 
 /**
  * Run all runnables that need to get called before the next paint.
  */
 void