Bug 1342863 - (Part 7) DocGroup labeling for timer callback in nsPresContext. r?dholbert draft
authorKuoE0 <kuoe0.tw@gmail.com>
Wed, 15 Mar 2017 17:38:29 +0800
changeset 503466 9d43480dac4b2d9ac4770232c4aced3621350e8d
parent 503465 ee110bcdaa4279fe6f005cdf9539868c3db8d0a8
child 503467 cded6b47cc218c017dc1b156c39e17bf7435c9de
child 503508 e06f0f95ba62d90ff956aadba2de939965580e65
push id50581
push userbmo:kuoe0@mozilla.com
push dateThu, 23 Mar 2017 06:44:18 +0000
reviewersdholbert
bugs1342863
milestone55.0a1
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;
     }
   }
 }