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 2022-03-28 23:29:14 +00:00
Родитель 47637cdee0
Коммит a04b6f26a2
4 изменённых файлов: 19 добавлений и 6 удалений

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

@ -49,6 +49,8 @@ DocumentTimeline::DocumentTimeline(Document* aDocument,
if (mDocument) {
mDocument->Timelines().insertBack(this);
}
// Ensure mLastRefreshDriverTime is valid.
UpdateLastRefreshDriverTime();
}
DocumentTimeline::~DocumentTimeline() {
@ -97,6 +99,12 @@ 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();
@ -125,8 +133,6 @@ TimeStamp DocumentTimeline::GetCurrentTimeStamp() const {
if (!refreshTime.IsNull()) {
mLastRefreshDriverTime = refreshTime;
}
return result;
}
Nullable<TimeDuration> DocumentTimeline::ToTimelineTime(
@ -182,6 +188,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();
bool IsMonotonicallyIncreasing() const override { return true; }
protected:
@ -83,7 +85,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;

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

@ -13236,6 +13236,13 @@ void Document::SetNavigationTiming(nsDOMNavigationTiming* aTiming) {
if (!mLoadingTimeStamp.IsNull() && mTiming) {
mTiming->SetDOMLoadingTimeStamp(GetDocumentURI(), mLoadingTimeStamp);
}
// If there's already the DocumentTimeline instance, tell it since the
// DocumentTimeline is based on both the navigation start time stamp and the
// refresh driver timestamp.
if (mDocumentTimeline) {
mDocumentTimeline->UpdateLastRefreshDriverTime();
}
}
nsContentList* Document::ImageMapList() {

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

@ -263,9 +263,6 @@ extern "C" const char* __tsan_default_suppressions() {
"race:VRShMem::PullBrowserState\n"
"race:VRShMem::PushBrowserState\n"
// Bug 1674776
"race:DocumentTimeline::GetCurrentTimeAsDuration\n"
// Bug 1607588
"race:nssToken_Destroy\n"
"race:nssSlot_GetToken\n"