Bug 1347815 - part2: label LayerActivityTracker.
LayerActivityTracker::NotifyExpired() will be invoked by
nsExpirationTracker::TimerCallback() from an unlabeled runnable.
We provide a SystemGroup EventTarget for the invocation of this
callback since there's nothing within a page that would rely on
the timer firing at a particular time (i.e., it doesn't matter
when this timer's callback is scheduled, relative to other
runnables dispatched for the page).
MozReview-Commit-ID: FZHtqicwDG5
--- a/layout/painting/ActiveLayerTracker.cpp
+++ b/layout/painting/ActiveLayerTracker.cpp
@@ -114,19 +114,20 @@ public:
uint8_t mRestyleCounts[ACTIVITY_COUNT];
bool mContentActive;
};
class LayerActivityTracker final : public nsExpirationTracker<LayerActivity,4> {
public:
// 75-100ms is a good timeout period. We use 4 generations of 25ms each.
enum { GENERATION_MS = 100 };
- LayerActivityTracker()
+ explicit LayerActivityTracker(nsIEventTarget* aEventTarget)
: nsExpirationTracker<LayerActivity,4>(GENERATION_MS,
- "LayerActivityTracker")
+ "LayerActivityTracker",
+ aEventTarget)
, mDestroying(false)
{}
~LayerActivityTracker() {
mDestroying = true;
AgeAllGenerations();
}
virtual void NotifyExpired(LayerActivity* aObject);
@@ -198,17 +199,18 @@ static LayerActivity*
GetLayerActivityForUpdate(nsIFrame* aFrame)
{
FrameProperties properties = aFrame->Properties();
LayerActivity* layerActivity = properties.Get(LayerActivityProperty());
if (layerActivity) {
gLayerActivityTracker->MarkUsed(layerActivity);
} else {
if (!gLayerActivityTracker) {
- gLayerActivityTracker = new LayerActivityTracker();
+ gLayerActivityTracker = new LayerActivityTracker(
+ SystemGroup::EventTargetFor(TaskCategory::Other));
}
layerActivity = new LayerActivity(aFrame);
gLayerActivityTracker->AddObject(layerActivity);
aFrame->AddStateBits(NS_FRAME_HAS_LAYER_ACTIVITY_PROPERTY);
properties.Set(LayerActivityProperty(), layerActivity);
}
return layerActivity;
}
@@ -506,17 +508,18 @@ ActiveLayerTracker::IsContentActive(nsIF
LayerActivity* layerActivity = GetLayerActivity(aFrame);
return layerActivity && layerActivity->mContentActive;
}
/* static */ void
ActiveLayerTracker::SetCurrentScrollHandlerFrame(nsIFrame* aFrame)
{
if (!gLayerActivityTracker) {
- gLayerActivityTracker = new LayerActivityTracker();
+ gLayerActivityTracker = new LayerActivityTracker(
+ SystemGroup::EventTargetFor(TaskCategory::Other));
}
gLayerActivityTracker->mCurrentScrollHandlerFrame = aFrame;
}
/* static */ void
ActiveLayerTracker::Shutdown()
{
delete gLayerActivityTracker;