Bug 1342863 - (Part 7) DocGroup labeling for timer callback in nsPresContext. r=dholbert
☠☠ backed out by 157014c32ff1 ☠ ☠
authorKuoE0 <kuoe0.tw@gmail.com>
Wed, 15 Mar 2017 17:38:29 +0800
changeset 349006 581cfae86457f40e2df8e4fbd111199214b88324
parent 349005 07e257b46b6f84a393dc6428e1d7f6d0d6f711e3
child 349007 ca409f78c8a30208636e3f216924b87ffe7270b9
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 7) DocGroup labeling for timer callback in nsPresContext. r=dholbert MozReview-Commit-ID: Jhl2FVc8PRd
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -2698,16 +2698,17 @@ nsPresContext::HasCachedStyleData()
 }
 
 already_AddRefed<nsITimer>
 nsPresContext::CreateTimer(nsTimerCallbackFunc aCallback,
                            const char* aName,
                            uint32_t aDelay)
 {
   nsCOMPtr<nsITimer> timer = do_CreateInstance("@mozilla.org/timer;1");
+  timer->SetTarget(Document()->EventTargetFor(TaskCategory::Other));
   if (timer) {
     nsresult rv = timer->InitWithNamedFuncCallback(aCallback, this, aDelay,
                                                    nsITimer::TYPE_ONE_SHOT,
                                                    aName);
     if (NS_SUCCEEDED(rv)) {
       return timer.forget();
     }
   }
@@ -3290,22 +3291,24 @@ nsRootPresContext::EnsureEventualDidPain
 {
   for (NotifyDidPaintTimer& t : mNotifyDidPaintTimers) {
     if (t.mTransactionId == aTransactionId) {
       return;
     }
   }
 
   nsCOMPtr<nsITimer> timer = do_CreateInstance("@mozilla.org/timer;1");
+  timer->SetTarget(Document()->EventTargetFor(TaskCategory::Other));
   if (timer) {
     RefPtr<nsRootPresContext> self = this;
-    nsresult rv = timer->InitWithCallback(NewTimerCallback([self, aTransactionId](){
-      nsAutoScriptBlocker blockScripts;
-      self->NotifyDidPaintForSubtree(aTransactionId);
-    }), 100, nsITimer::TYPE_ONE_SHOT);
+    nsresult rv = timer->InitWithCallback(
+      NewNamedTimerCallback([self, aTransactionId](){
+        nsAutoScriptBlocker blockScripts;
+        self->NotifyDidPaintForSubtree(aTransactionId);
+    }, "NotifyDidPaintForSubtree"), 100, nsITimer::TYPE_ONE_SHOT);
 
     if (NS_SUCCEEDED(rv)) {
       NotifyDidPaintTimer* t = mNotifyDidPaintTimers.AppendElement();
       t->mTransactionId = aTransactionId;
       t->mTimer = timer;
     }
   }
 }