Bug 1674776 - Update DocumentTimeline::mLastRefreshDriverTime outside parallel styling. r=boris,decoder

Note that we can probably use mLastRefreshDriverTime directly in
DocumentTimeline::GetCurrentTimeStamp(), i.e. we don't need to use the refresh
driver there, but I'd preserve the current behavior.

Differential Revision: https://phabricator.services.mozilla.com/D97823
This commit is contained in:
Hiroyuki Ikezoe 2020-12-17 00:51:18 +00:00
Родитель 0c6954bd7e
Коммит f78a1ad627
3 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -49,6 +49,8 @@ DocumentTimeline::DocumentTimeline(Document* aDocument,
if (mDocument) {
mDocument->Timelines().insertBack(this);
}
// Ensure mLastRefreshDriverTime is valid.
UpdateLastRefreshDriverTime();
}
DocumentTimeline::~DocumentTimeline() {
@ -97,11 +99,16 @@ bool DocumentTimeline::TracksWallclockTime() const {
}
TimeStamp DocumentTimeline::GetCurrentTimeStamp() const {
nsRefreshDriver* refreshDriver = GetRefreshDriver();
return refreshDriver ? refreshDriver->MostRecentRefresh()
: mLastRefreshDriverTime;
}
void DocumentTimeline::UpdateLastRefreshDriverTime() {
nsRefreshDriver* refreshDriver = GetRefreshDriver();
TimeStamp refreshTime =
refreshDriver ? refreshDriver->MostRecentRefresh() : TimeStamp();
// Always return the same object to benefit from return-value optimization.
TimeStamp result =
!refreshTime.IsNull() ? refreshTime : mLastRefreshDriverTime;
@ -125,8 +132,6 @@ TimeStamp DocumentTimeline::GetCurrentTimeStamp() const {
if (!refreshTime.IsNull()) {
mLastRefreshDriverTime = refreshTime;
}
return result;
}
Nullable<TimeDuration> DocumentTimeline::ToTimelineTime(
@ -211,6 +216,7 @@ void DocumentTimeline::MostRecentRefreshTimeUpdated() {
}
void DocumentTimeline::WillRefresh(mozilla::TimeStamp aTime) {
UpdateLastRefreshDriverTime();
MostRecentRefreshTimeUpdated();
}

Просмотреть файл

@ -68,6 +68,8 @@ class DocumentTimeline final : public AnimationTimeline,
Document* GetDocument() const override { return mDocument; }
void UpdateLastRefreshDriverTime();
protected:
TimeStamp GetCurrentTimeStamp() const;
nsRefreshDriver* GetRefreshDriver() const;
@ -81,7 +83,7 @@ class DocumentTimeline final : public AnimationTimeline,
// The most recently used refresh driver time. This is used in cases where
// we don't have a refresh driver (e.g. because we are in a display:none
// iframe).
mutable TimeStamp mLastRefreshDriverTime;
TimeStamp mLastRefreshDriverTime;
bool mIsObservingRefreshDriver;
TimeDuration mOriginTime;

Просмотреть файл

@ -266,9 +266,6 @@ extern "C" const char* __tsan_default_suppressions() {
"race:VRShMem::PullSystemState\n"
"race:VRShMem::PushSystemState\n"
// Bug 1674776
"race:DocumentTimeline::GetCurrentTimeAsDuration\n"
// Bug 1674835
"race:nsHttpTransaction::ReadSegments\n"
"race:nsHttpTransaction::SecurityInfo\n"