Bug 1961687 - Stop starting the refresh driver timer from MostRecentRefresh(). r=smaug
Now this does a lot less, and I don't see a reason for needing it anymore. I did a bit of auditing of the callers and they seem fine: https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/dom/animation/KeyframeEffect.cpp#1493 https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/dom/animation/KeyframeEffect.cpp#671 https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/dom/base/Document.cpp#17577 We definitely don't want to trigger a tick from there. https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/dom/animation/DocumentTimeline.cpp#97 We require already to call EnsureAnimationUpdate() to run that code next frame. https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/dom/smil/SMILAnimationController.cpp#41 SMIL uses a refresh observer which keeps the driver ticking. See UpdateSampling(). https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/dom/base/nsDOMWindowUtils.cpp#2946 https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/layout/generic/ScrollContainerFrame.cpp#2475 Test only, for manual refresh driver control which won't use the timer anyways. https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/layout/generic/ScrollContainerFrame.cpp#5872 We're running a scroll event from the refresh driver. https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/layout/base/RestyleManager.cpp#3236-3238 Just to work around this very thing (removed). https://searchfox.org/mozilla-central/rev/29184ec2b107c8b9dd8c9a594711c27545dfb2c7/layout/generic/ScrollVelocityQueue.cpp#25 For scroll snapping, no need to fire the refresh driver. Differential Revision: https://phabricator.services.mozilla.com/D246141
This commit is contained in:
@@ -1393,7 +1393,7 @@ static TimeStamp EnsurePaintIsScheduled(Document& aDoc) {
|
|||||||
if (!rd->IsInRefresh()) {
|
if (!rd->IsInRefresh()) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return rd->MostRecentRefresh(/* aEnsureTimerStarted = */ false);
|
return rd->MostRecentRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/web-animations/#play-an-animation
|
// https://drafts.csswg.org/web-animations/#play-an-animation
|
||||||
|
|||||||
@@ -513,8 +513,7 @@ void AnimationInfo::AddAnimationForProperty(
|
|||||||
if (readyTime.IsNull()) {
|
if (readyTime.IsNull()) {
|
||||||
// TODO(emilio): This should generally not happen anymore, can we remove
|
// TODO(emilio): This should generally not happen anymore, can we remove
|
||||||
// this SetPendingReadyTime call?
|
// this SetPendingReadyTime call?
|
||||||
readyTime = aFrame->PresContext()->RefreshDriver()->MostRecentRefresh(
|
readyTime = aFrame->PresContext()->RefreshDriver()->MostRecentRefresh();
|
||||||
/* aEnsureTimerStarted= */ false);
|
|
||||||
MOZ_ASSERT(!readyTime.IsNull());
|
MOZ_ASSERT(!readyTime.IsNull());
|
||||||
aAnimation->SetPendingReadyTime(readyTime);
|
aAnimation->SetPendingReadyTime(readyTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3233,10 +3233,6 @@ void RestyleManager::DoProcessPendingRestyles(ServoTraversalFlags aFlags) {
|
|||||||
ServoStyleSet* styleSet = StyleSet();
|
ServoStyleSet* styleSet = StyleSet();
|
||||||
Document* doc = presContext->Document();
|
Document* doc = presContext->Document();
|
||||||
|
|
||||||
// Ensure the refresh driver is active during traversal to avoid mutating
|
|
||||||
// mActiveTimer and mMostRecentRefresh time.
|
|
||||||
presContext->RefreshDriver()->MostRecentRefresh();
|
|
||||||
|
|
||||||
if (!doc->GetServoRestyleRoot()) {
|
if (!doc->GetServoRestyleRoot()) {
|
||||||
// This might post new restyles, so need to do it here. Don't do it if we're
|
// This might post new restyles, so need to do it here. Don't do it if we're
|
||||||
// already going to restyle tho, so that we don't potentially reflow with
|
// already going to restyle tho, so that we don't potentially reflow with
|
||||||
|
|||||||
@@ -2824,8 +2824,7 @@ void nsPresContext::NotifyContentfulPaint() {
|
|||||||
"We should only notify contentful paint during refresh "
|
"We should only notify contentful paint during refresh "
|
||||||
"driver ticks");
|
"driver ticks");
|
||||||
if (!perf->HadFCPTimingEntry()) {
|
if (!perf->HadFCPTimingEntry()) {
|
||||||
TimeStamp nowTime = rootPresContext->RefreshDriver()->MostRecentRefresh(
|
TimeStamp nowTime = rootPresContext->RefreshDriver()->MostRecentRefresh();
|
||||||
/* aEnsureTimerStarted */ false);
|
|
||||||
MOZ_ASSERT(!nowTime.IsNull(),
|
MOZ_ASSERT(!nowTime.IsNull(),
|
||||||
"Most recent refresh timestamp should exist since we are in "
|
"Most recent refresh timestamp should exist since we are in "
|
||||||
"a refresh driver tick");
|
"a refresh driver tick");
|
||||||
|
|||||||
@@ -1497,16 +1497,6 @@ void nsRefreshDriver::RestoreNormalRefresh() {
|
|||||||
mPendingTransactions.Clear();
|
mPendingTransactions.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeStamp nsRefreshDriver::MostRecentRefresh(bool aEnsureTimerStarted) const {
|
|
||||||
// In case of stylo traversal, we have already activated the refresh driver in
|
|
||||||
// RestyleManager::ProcessPendingRestyles().
|
|
||||||
if (aEnsureTimerStarted && !ServoStyleSet::IsInServoTraversal()) {
|
|
||||||
const_cast<nsRefreshDriver*>(this)->EnsureTimerStarted();
|
|
||||||
}
|
|
||||||
|
|
||||||
return mMostRecentRefresh;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsRefreshDriver::AddRefreshObserver(nsARefreshObserver* aObserver,
|
void nsRefreshDriver::AddRefreshObserver(nsARefreshObserver* aObserver,
|
||||||
FlushType aFlushType,
|
FlushType aFlushType,
|
||||||
const char* aObserverDescription) {
|
const char* aObserverDescription) {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator,
|
|||||||
* ensure that multiple animations started during the same event off
|
* ensure that multiple animations started during the same event off
|
||||||
* the main event loop have the same start time.)
|
* the main event loop have the same start time.)
|
||||||
*/
|
*/
|
||||||
mozilla::TimeStamp MostRecentRefresh(bool aEnsureTimerStarted = true) const;
|
mozilla::TimeStamp MostRecentRefresh() const { return mMostRecentRefresh; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add / remove refresh observers.
|
* Add / remove refresh observers.
|
||||||
|
|||||||
Reference in New Issue
Block a user