Backed out changeset b4f05a5d9d89 (bug 854421)

This commit is contained in:
Ed Morley 2014-05-29 10:55:40 +01:00
Родитель 71a04f2fab
Коммит 00ee5e127c
2 изменённых файлов: 11 добавлений и 23 удалений

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

@ -696,7 +696,7 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext)
mRequestedHighPrecision(false), mRequestedHighPrecision(false),
mInRefresh(false), mInRefresh(false),
mWaitingForTransaction(false), mWaitingForTransaction(false),
mSkippedPaints(0) mSkippedPaint(false)
{ {
mMostRecentRefreshEpochTime = JS_Now(); mMostRecentRefreshEpochTime = JS_Now();
mMostRecentRefresh = TimeStamp::Now(); mMostRecentRefresh = TimeStamp::Now();
@ -737,7 +737,7 @@ nsRefreshDriver::AdvanceTimeAndRefresh(int64_t aMilliseconds)
if (mWaitingForTransaction) { if (mWaitingForTransaction) {
// Disable any refresh driver throttling when entering test mode // Disable any refresh driver throttling when entering test mode
mWaitingForTransaction = false; mWaitingForTransaction = false;
mSkippedPaints = 0; mSkippedPaint = false;
} }
} }
@ -1080,7 +1080,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
mRootRefresh->RemoveRefreshObserver(this, Flush_Style); mRootRefresh->RemoveRefreshObserver(this, Flush_Style);
mRootRefresh = nullptr; mRootRefresh = nullptr;
} }
mSkippedPaints = 0; mSkippedPaint = false;
nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell(); nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell();
if (!presShell || (ObserverCount() == 0 && ImageRequestCount() == 0)) { if (!presShell || (ObserverCount() == 0 && ImageRequestCount() == 0)) {
@ -1385,12 +1385,12 @@ void
nsRefreshDriver::FinishedWaitingForTransaction() nsRefreshDriver::FinishedWaitingForTransaction()
{ {
mWaitingForTransaction = false; mWaitingForTransaction = false;
if (mSkippedPaints && if (mSkippedPaint &&
!IsInRefresh() && !IsInRefresh() &&
(ObserverCount() || ImageRequestCount())) { (ObserverCount() || ImageRequestCount())) {
DoRefresh(); DoRefresh();
} }
mSkippedPaints = 0; mSkippedPaint = false;
} }
uint64_t uint64_t
@ -1402,7 +1402,7 @@ nsRefreshDriver::GetTransactionId()
!mWaitingForTransaction && !mWaitingForTransaction &&
!mTestControllingRefreshes) { !mTestControllingRefreshes) {
mWaitingForTransaction = true; mWaitingForTransaction = true;
mSkippedPaints = 0; mSkippedPaint = false;
} }
return mPendingTransaction; return mPendingTransaction;
@ -1414,7 +1414,7 @@ nsRefreshDriver::RevokeTransactionId(uint64_t aTransactionId)
MOZ_ASSERT(aTransactionId == mPendingTransaction); MOZ_ASSERT(aTransactionId == mPendingTransaction);
if (mPendingTransaction == mCompletedTransaction + 2 && if (mPendingTransaction == mCompletedTransaction + 2 &&
mWaitingForTransaction) { mWaitingForTransaction) {
MOZ_ASSERT(!mSkippedPaints, "How did we skip a paint when we're in the middle of one?"); MOZ_ASSERT(!mSkippedPaint, "How did we skip a paint when we're in the middle of one?");
FinishedWaitingForTransaction(); FinishedWaitingForTransaction();
} }
mPendingTransaction--; mPendingTransaction--;
@ -1439,7 +1439,7 @@ nsRefreshDriver::WillRefresh(mozilla::TimeStamp aTime)
{ {
mRootRefresh->RemoveRefreshObserver(this, Flush_Style); mRootRefresh->RemoveRefreshObserver(this, Flush_Style);
mRootRefresh = nullptr; mRootRefresh = nullptr;
if (mSkippedPaints) { if (mSkippedPaint) {
DoRefresh(); DoRefresh();
} }
} }
@ -1450,20 +1450,8 @@ nsRefreshDriver::IsWaitingForPaint()
if (mTestControllingRefreshes) { if (mTestControllingRefreshes) {
return false; return false;
} }
// 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.
static const uint32_t kMaxSkippedPaints = 10;
if (mSkippedPaints > kMaxSkippedPaints) {
mSkippedPaints = 0;
mWaitingForTransaction = false;
if (mRootRefresh) {
mRootRefresh->RemoveRefreshObserver(this, Flush_Style);
}
return false;
}
if (mWaitingForTransaction) { if (mWaitingForTransaction) {
mSkippedPaints++; mSkippedPaint = true;
return true; return true;
} }
@ -1481,7 +1469,7 @@ nsRefreshDriver::IsWaitingForPaint()
rootRefresh->AddRefreshObserver(this, Flush_Style); rootRefresh->AddRefreshObserver(this, Flush_Style);
mRootRefresh = rootRefresh; mRootRefresh = rootRefresh;
} }
mSkippedPaints++; mSkippedPaint = true;
return true; return true;
} }
} }

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

@ -355,7 +355,7 @@ private:
// True if Tick() was skipped because of mWaitingForTransaction and // True if Tick() was skipped because of mWaitingForTransaction and
// we should schedule a new Tick immediately when resumed instead // we should schedule a new Tick immediately when resumed instead
// of waiting until the next interval. // of waiting until the next interval.
uint32_t mSkippedPaints; bool mSkippedPaint;
int64_t mMostRecentRefreshEpochTime; int64_t mMostRecentRefreshEpochTime;
mozilla::TimeStamp mMostRecentRefresh; mozilla::TimeStamp mMostRecentRefresh;