diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 74f4c34f53f2..dfd111f19387 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -1009,13 +1009,13 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext) mInRefresh(false), mWaitingForTransaction(false), mSkippedPaints(false), - mResizeSuppressed(false), - mWarningThreshold(1) + mResizeSuppressed(false) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mPresContext, "Need a pres context to tell us to call Disconnect() later " "and decrement sRefreshDriverCount."); + mMostRecentRefreshEpochTime = JS_Now(); mMostRecentRefresh = TimeStamp::Now(); mMostRecentTick = mMostRecentRefresh; @@ -1065,7 +1065,6 @@ nsRefreshDriver::AdvanceTimeAndRefresh(int64_t aMilliseconds) // Disable any refresh driver throttling when entering test mode mWaitingForTransaction = false; mSkippedPaints = false; - mWarningThreshold = 1; } } @@ -1656,7 +1655,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime) mRootRefresh = nullptr; } mSkippedPaints = false; - mWarningThreshold = 1; nsCOMPtr presShell = mPresContext->GetPresShell(); if (!presShell || (ObserverCount() == 0 && ImageRequestCount() == 0)) { @@ -1994,7 +1992,6 @@ nsRefreshDriver::FinishedWaitingForTransaction() profiler_tracing("Paint", "RD", TRACING_INTERVAL_END); } mSkippedPaints = false; - mWarningThreshold = 1; } uint64_t @@ -2007,7 +2004,6 @@ nsRefreshDriver::GetTransactionId() !mTestControllingRefreshes) { mWaitingForTransaction = true; mSkippedPaints = false; - mWarningThreshold = 1; } return mPendingTransaction; @@ -2067,14 +2063,17 @@ nsRefreshDriver::IsWaitingForPaint(mozilla::TimeStamp aTime) if (mTestControllingRefreshes) { return false; } - - if (aTime > (mMostRecentTick + TimeDuration::FromMilliseconds(mWarningThreshold * 1000))) { - gfxCriticalNote << "Refresh driver waiting for the compositor for" - << (aTime - mMostRecentTick).ToSeconds() - << " seconds."; - mWarningThreshold *= 2; + // If we've skipped too many ticks then it's possible + // that something went wrong and we're waiting on + // a notification that will never arrive. + if (aTime > (mMostRecentTick + TimeDuration::FromMilliseconds(200))) { + mSkippedPaints = false; + mWaitingForTransaction = false; + if (mRootRefresh) { + mRootRefresh->RemoveRefreshObserver(this, Flush_Style); + } + return false; } - if (mWaitingForTransaction) { mSkippedPaints = true; return true; diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index 7c3495d991a7..b7fe1a180515 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -424,10 +424,6 @@ private: bool mResizeSuppressed; int64_t mMostRecentRefreshEpochTime; - // Number of seconds that the refresh driver is blocked waiting for a compositor - // transaction to be completed before we append a note to the gfx critical log. - // The number is doubled every time the threshold is hit. - uint64_t mWarningThreshold; mozilla::TimeStamp mMostRecentRefresh; mozilla::TimeStamp mMostRecentTick; mozilla::TimeStamp mTickStart;