Bug 1342863 - (Part 7) DocGroup labeling for timer callback in nsPresContext. r?dholbert
MozReview-Commit-ID: Jhl2FVc8PRd
--- 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;
}
}
}