Bug 1696527 - Remove unused 'JankLevel' code from nsRefreshDriver, r=bas

Differential Revision: https://phabricator.services.mozilla.com/D107283
This commit is contained in:
Olli Pettay 2021-03-09 12:37:25 +00:00
Родитель c43fe05565
Коммит 93c81f5154
2 изменённых файлов: 0 добавлений и 75 удалений

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

@ -129,24 +129,6 @@ static mozilla::LazyLogModule sRefreshDriverLog("nsRefreshDriver");
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(nsRefreshDriver::TickReasons);
namespace {
// `true` if we are currently in jank-critical mode.
//
// In jank-critical mode, any iteration of the event loop that takes
// more than 16ms to compute will cause an ongoing animation to miss
// frames.
//
// For simplicity, the current implementation assumes that we are in
// jank-critical mode if and only if at least one vsync driver has
// at least one observer.
static uint64_t sActiveVsyncTimers = 0;
// The latest value of process-wide jank levels.
//
// For each i, sJankLevels[i] counts the number of times delivery of
// vsync to the main thread has been delayed by at least 2^i ms. Use
// GetJankLevels to grab a copy of this array.
uint64_t sJankLevels[12];
// The number outstanding nsRefreshDrivers (that have been created but not
// disconnected). When this reaches zero we will call
// nsRefreshDriver::Shutdown.
@ -654,7 +636,6 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
Telemetry::FX_REFRESH_DRIVER_CHROME_FRAME_DELAY_MS, sample);
Telemetry::Accumulate(
Telemetry::FX_REFRESH_DRIVER_SYNC_SCROLL_FRAME_DELAY_MS, sample);
RecordJank(sample);
} else if (mVsyncRate != TimeDuration::Forever()) {
TimeDuration contentDelay = (TimeStamp::Now() - mLastTick) - mVsyncRate;
if (contentDelay.ToMilliseconds() < 0) {
@ -668,7 +649,6 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
Telemetry::FX_REFRESH_DRIVER_CONTENT_FRAME_DELAY_MS, sample);
Telemetry::Accumulate(
Telemetry::FX_REFRESH_DRIVER_SYNC_SCROLL_FRAME_DELAY_MS, sample);
RecordJank(sample);
} else {
// Request the vsync rate from the parent process. Might be a few vsyncs
// until the parent responds.
@ -679,15 +659,6 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
#endif
}
void RecordJank(uint32_t aJankMS) {
uint32_t duration = 1 /* ms */;
for (size_t i = 0;
i < mozilla::ArrayLength(sJankLevels) && duration < aJankMS;
++i, duration *= 2) {
sJankLevels[i]++;
}
}
void TickRefreshDriver(VsyncId aId, TimeStamp aVsyncTimestamp) {
MOZ_ASSERT(NS_IsMainThread());
@ -761,7 +732,6 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
}
void StartTimer() override {
// Protect updates to `sActiveVsyncTimers`.
MOZ_ASSERT(NS_IsMainThread());
mLastFireTime = TimeStamp::Now();
@ -772,12 +742,9 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
mVsyncChild->AddChildRefreshTimer(mVsyncObserver);
mVsyncObserver->OnTimerStart();
}
++sActiveVsyncTimers;
}
void StopTimer() override {
// Protect updates to `sActiveVsyncTimers`.
MOZ_ASSERT(NS_IsMainThread());
if (mVsyncDispatcher) {
@ -785,9 +752,6 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
} else if (mVsyncChild) {
mVsyncChild->RemoveChildRefreshTimer(mVsyncObserver);
}
MOZ_ASSERT(sActiveVsyncTimers > 0);
--sActiveVsyncTimers;
}
void ScheduleNextTick(TimeStamp aNowTime) override {
@ -982,8 +946,6 @@ static StaticRefPtr<InactiveRefreshDriverTimer> sThrottledRateTimer;
void nsRefreshDriver::CreateVsyncRefreshTimer() {
MOZ_ASSERT(NS_IsMainThread());
PodArrayZero(sJankLevels);
if (gfxPlatform::IsInLayoutAsapMode()) {
return;
}
@ -2794,16 +2756,4 @@ void nsRefreshDriver::Disconnect() {
}
}
/* static */
bool nsRefreshDriver::IsJankCritical() {
MOZ_ASSERT(NS_IsMainThread());
return sActiveVsyncTimers > 0;
}
/* static */
bool nsRefreshDriver::GetJankLevels(Vector<uint64_t>& aJank) {
aJank.clear();
return aJank.append(sJankLevels, ArrayLength(sJankLevels));
}
#undef LOG

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

@ -321,20 +321,6 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator,
void SetIsResizeSuppressed() { mResizeSuppressed = true; }
bool IsResizeSuppressed() const { return mResizeSuppressed; }
/**
* The latest value of process-wide jank levels.
*
* For each i, sJankLevels[i] counts the number of times delivery of
* vsync to the main thread has been delayed by at least 2^i
* ms. This data structure has been designed to make it easy to
* determine how much jank has taken place between two instants in
* time.
*
* Return `false` if `aJank` needs to be grown to accomodate the
* data but we didn't have enough memory.
*/
static bool GetJankLevels(mozilla::Vector<uint64_t>& aJank);
// mozilla::layers::TransactionIdAllocator
TransactionId GetTransactionId(bool aThrottle) override;
TransactionId LastTransactionId() const override;
@ -617,17 +603,6 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator,
friend class mozilla::RefreshDriverTimer;
static void Shutdown();
// `true` if we are currently in jank-critical mode.
//
// In jank-critical mode, any iteration of the event loop that takes
// more than 16ms to compute will cause an ongoing animation to miss
// frames.
//
// For simplicity, the current implementation assumes that we are
// in jank-critical mode if and only if the vsync driver has at least
// one observer.
static bool IsJankCritical();
};
#endif /* !defined(nsRefreshDriver_h_) */