From 4f93bc7c4e3a9939c1a09d5f35832a19509b565c Mon Sep 17 00:00:00 2001 From: KuoE0 Date: Mon, 20 Mar 2017 16:06:23 +0800 Subject: [PATCH] Bug 1342874 - (Part 7) DocGroup labeling for timer callbacks in nsTreeBodyFrame. r=dholbert MozReview-Commit-ID: L8IHAGDAC5Q --HG-- extra : rebase_source : 9f07f7f4cdb1a7dedc2384fc3e0c9c10e6c990f4 --- layout/xul/tree/nsTreeBodyFrame.cpp | 21 ++++++++++++++------- layout/xul/tree/nsTreeBodyFrame.h | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 14188be3d549..46724df77b74 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -1796,7 +1796,7 @@ nsTreeBodyFrame::MarkDirtyIfSelect() nsresult nsTreeBodyFrame::CreateTimer(const LookAndFeel::IntID aID, nsTimerCallbackFunc aFunc, int32_t aType, - nsITimer** aTimer) + nsITimer** aTimer, const char* aName) { // Get the delay from the look and feel service. int32_t delay = LookAndFeel::GetInt(aID, 0); @@ -1807,8 +1807,11 @@ nsTreeBodyFrame::CreateTimer(const LookAndFeel::IntID aID, // Zero value means that this feature is completely disabled. if (delay > 0) { timer = do_CreateInstance("@mozilla.org/timer;1"); - if (timer) - timer->InitWithFuncCallback(aFunc, this, delay, aType); + if (timer) { + timer->SetTarget( + mContent->OwnerDoc()->EventTargetFor(TaskCategory::Other)); + timer->InitWithNamedFuncCallback(aFunc, this, delay, aType, aName); + } } NS_IF_ADDREF(*aTimer = timer); @@ -2642,7 +2645,8 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext, // Set a timer to trigger the tree scrolling. CreateTimer(LookAndFeel::eIntID_TreeLazyScrollDelay, LazyScrollCallback, nsITimer::TYPE_ONE_SHOT, - getter_AddRefs(mSlots->mTimer)); + getter_AddRefs(mSlots->mTimer), + "nsTreeBodyFrame::LazyScrollCallback"); } #endif // Bail out to prevent spring loaded timer and feedback line settings. @@ -2680,7 +2684,8 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext, // This node isn't expanded, set a timer to expand it. CreateTimer(LookAndFeel::eIntID_TreeOpenDelay, OpenCallback, nsITimer::TYPE_ONE_SHOT, - getter_AddRefs(mSlots->mTimer)); + getter_AddRefs(mSlots->mTimer), + "nsTreeBodyFrame::OpenCallback"); } } } @@ -2754,7 +2759,8 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext, // Close all spring loaded folders except the drop folder. CreateTimer(LookAndFeel::eIntID_TreeCloseDelay, CloseCallback, nsITimer::TYPE_ONE_SHOT, - getter_AddRefs(mSlots->mTimer)); + getter_AddRefs(mSlots->mTimer), + "nsTreeBodyFrame::CloseCallback"); } } @@ -4691,7 +4697,8 @@ nsTreeBodyFrame::LazyScrollCallback(nsITimer *aTimer, void *aClosure) // Set a new timer to scroll the tree repeatedly. self->CreateTimer(LookAndFeel::eIntID_TreeScrollDelay, ScrollCallback, nsITimer::TYPE_REPEATING_SLACK, - getter_AddRefs(self->mSlots->mTimer)); + getter_AddRefs(self->mSlots->mTimer), + "nsTreeBodyFrame::ScrollCallback"); self->ScrollByLines(self->mSlots->mScrollLines); // ScrollByLines may have deleted |self|. } diff --git a/layout/xul/tree/nsTreeBodyFrame.h b/layout/xul/tree/nsTreeBodyFrame.h index 6e5b6e19cf1a..2653b30a71e8 100644 --- a/layout/xul/tree/nsTreeBodyFrame.h +++ b/layout/xul/tree/nsTreeBodyFrame.h @@ -462,7 +462,7 @@ protected: // the timer fires and aType is type of timer - one shot or repeating. nsresult CreateTimer(const mozilla::LookAndFeel::IntID aID, nsTimerCallbackFunc aFunc, int32_t aType, - nsITimer** aTimer); + nsITimer** aTimer, const char* aName); static void OpenCallback(nsITimer *aTimer, void *aClosure);