Bug 1342863 - (Part 1) DocGroup labeling for runnables dispatched by NS_DispatchTo(Main|Current)Thread in PresShell. r=dholbert
☠☠ backed out by 9a6b874ce36d ☠ ☠
authorKuoE0 <kuoe0.tw@gmail.com>
Thu, 09 Mar 2017 17:08:41 +0800
changeset 349000 17d753a5dd9a136cd91f1d762f2c78c561be3abb
parent 348999 7c7f3615f433c9d5dd898fb3fbe95601c1e85751
child 349001 b6422d885f48c555978fa56712c1b994ea6ba421
push id39379
push usertlin@mozilla.com
push dateThu, 23 Mar 2017 07:04:44 +0000
treeherderautoland@ca409f78c8a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1342863
milestone55.0a1
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 1342863 - (Part 1) DocGroup labeling for runnables dispatched by NS_DispatchTo(Main|Current)Thread in PresShell. r=dholbert MozReview-Commit-ID: HNBIDrSAo5B
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -2005,21 +2005,23 @@ PresShell::ResizeReflowIgnoreOverride(ns
       }
       if (mAsyncResizeEventTimer) {
         mAsyncResizeTimerIsActive = true;
         mAsyncResizeEventTimer->InitWithFuncCallback(AsyncResizeEventCallback,
                                                      this, 15,
                                                      nsITimer::TYPE_ONE_SHOT);
       }
     } else {
-      RefPtr<nsRunnableMethod<PresShell> > resizeEvent =
-        NewRunnableMethod("PresShell::FireResizeEvent",
-                          this, &PresShell::FireResizeEvent);
-      if (NS_SUCCEEDED(NS_DispatchToCurrentThread(resizeEvent))) {
-        mResizeEvent = resizeEvent;
+      RefPtr<nsRunnableMethod<PresShell>> event =
+        NewRunnableMethod(this, &PresShell::FireResizeEvent);
+      nsresult rv = mDocument->Dispatch("PresShell::FireResizeEvent",
+                                        TaskCategory::Other,
+                                        do_AddRef(event));
+      if (NS_SUCCEEDED(rv)) {
+        mResizeEvent = event;
         SetNeedStyleFlush();
       }
     }
   }
 
   return NS_OK; //XXX this needs to be real. MMP
 }
 
@@ -6251,21 +6253,25 @@ PresShell::ScheduleApproximateFrameVisib
   if (mHaveShutDown || mIsDestroying) {
     return;
   }
 
   if (mUpdateApproximateFrameVisibilityEvent.IsPending()) {
     return;
   }
 
-  RefPtr<nsRunnableMethod<PresShell> > ev =
-    NewRunnableMethod("PresShell::UpdateApproximateFrameVisibility",
-                      this, &PresShell::UpdateApproximateFrameVisibility);
-  if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
-    mUpdateApproximateFrameVisibilityEvent = ev;
+  RefPtr<nsRunnableMethod<PresShell>> event =
+    NewRunnableMethod(this, &PresShell::UpdateApproximateFrameVisibility);
+  nsresult rv =
+    mDocument->Dispatch("PresShell::UpdateApproximateFrameVisibility",
+                        TaskCategory::Other,
+                        do_AddRef(event));
+
+  if (NS_SUCCEEDED(rv)) {
+    mUpdateApproximateFrameVisibilityEvent = event;
   }
 }
 
 void
 PresShell::EnsureFrameInApproximatelyVisibleList(nsIFrame* aFrame)
 {
   if (!aFrame->TrackingVisibility()) {
     return;