summaryrefslogtreecommitdiffstats
path: root/layout/base/nsRefreshDriver.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-04-03 18:14:15 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 13:23:48 +0200
commit8bd941d4e32008b0c49953c0c6f93124e2823696 (patch)
treedb843cb1b12ef3c5bb7d9b2bf91e95965fe021a3 /layout/base/nsRefreshDriver.cpp
parent7172fc72a3b279ca1ebe1035ea0d4c5ea35c13b1 (diff)
downloadUXP-8bd941d4e32008b0c49953c0c6f93124e2823696.tar
UXP-8bd941d4e32008b0c49953c0c6f93124e2823696.tar.gz
UXP-8bd941d4e32008b0c49953c0c6f93124e2823696.tar.lz
UXP-8bd941d4e32008b0c49953c0c6f93124e2823696.tar.xz
UXP-8bd941d4e32008b0c49953c0c6f93124e2823696.zip
Issue #1507 - Remove nsRefreshDriver's use of high res system timers.
Since we are using vsync for timing anyway in the layout refresh driver, there is no need to bump the system timer resolution down to 1 ms. This resolves #1507.
Diffstat (limited to 'layout/base/nsRefreshDriver.cpp')
-rw-r--r--layout/base/nsRefreshDriver.cpp98
1 files changed, 0 insertions, 98 deletions
diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp
index 5ea7a0188..c0d09d2a0 100644
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -851,12 +851,6 @@ NS_IMPL_ISUPPORTS(VsyncChildCreateCallback, nsIIPCBackgroundChildCreateCallback)
static StaticRefPtr<RefreshDriverTimer> sRegularRateTimer;
static StaticRefPtr<InactiveRefreshDriverTimer> sThrottledRateTimer;
-#ifdef XP_WIN
-static int32_t sHighPrecisionTimerRequests = 0;
-// a bare pointer to avoid introducing a static constructor
-static nsITimer *sDisableHighPrecisionTimersTimer = nullptr;
-#endif
-
static void
CreateContentVsyncRefreshTimer(void*)
{
@@ -934,16 +928,6 @@ nsRefreshDriver::Shutdown()
sRegularRateTimer = nullptr;
sThrottledRateTimer = nullptr;
-
-#ifdef XP_WIN
- if (sDisableHighPrecisionTimersTimer) {
- sDisableHighPrecisionTimersTimer->Cancel();
- NS_RELEASE(sDisableHighPrecisionTimersTimer);
- timeEndPeriod(1);
- } else if (sHighPrecisionTimerRequests) {
- timeEndPeriod(1);
- }
-#endif
}
/* static */ int32_t
@@ -1062,7 +1046,6 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext)
mNeedToRecomputeVisibility(false),
mTestControllingRefreshes(false),
mViewManagerFlushIsPending(false),
- mRequestedHighPrecision(false),
mInRefresh(false),
mWaitingForTransaction(false),
mSkippedPaints(false),
@@ -1300,83 +1283,6 @@ nsRefreshDriver::StopTimer()
mActiveTimer->RemoveRefreshDriver(this);
mActiveTimer = nullptr;
-
- if (mRequestedHighPrecision) {
- SetHighPrecisionTimersEnabled(false);
- }
-}
-
-#ifdef XP_WIN
-static void
-DisableHighPrecisionTimersCallback(nsITimer *aTimer, void *aClosure)
-{
- timeEndPeriod(1);
- NS_RELEASE(sDisableHighPrecisionTimersTimer);
-}
-#endif
-
-void
-nsRefreshDriver::ConfigureHighPrecision()
-{
- bool haveUnthrottledFrameRequestCallbacks =
- mFrameRequestCallbackDocs.Length() > 0;
-
- // if the only change that's needed is that we need high precision,
- // then just set that
- if (!mThrottled && !mRequestedHighPrecision &&
- haveUnthrottledFrameRequestCallbacks) {
- SetHighPrecisionTimersEnabled(true);
- } else if (mRequestedHighPrecision && !haveUnthrottledFrameRequestCallbacks) {
- SetHighPrecisionTimersEnabled(false);
- }
-}
-
-void
-nsRefreshDriver::SetHighPrecisionTimersEnabled(bool aEnable)
-{
- LOG("[%p] SetHighPrecisionTimersEnabled (%s)", this, aEnable ? "true" : "false");
-
- if (aEnable) {
- NS_ASSERTION(!mRequestedHighPrecision, "SetHighPrecisionTimersEnabled(true) called when already requested!");
-#ifdef XP_WIN
- if (++sHighPrecisionTimerRequests == 1) {
- // If we had a timer scheduled to disable it, that means that it's already
- // enabled; just cancel the timer. Otherwise, really enable it.
- if (sDisableHighPrecisionTimersTimer) {
- sDisableHighPrecisionTimersTimer->Cancel();
- NS_RELEASE(sDisableHighPrecisionTimersTimer);
- } else {
- timeBeginPeriod(1);
- }
- }
-#endif
- mRequestedHighPrecision = true;
- } else {
- NS_ASSERTION(mRequestedHighPrecision, "SetHighPrecisionTimersEnabled(false) called when not requested!");
-#ifdef XP_WIN
- if (--sHighPrecisionTimerRequests == 0) {
- // Don't jerk us around between high precision and low precision
- // timers; instead, only allow leaving high precision timers
- // after 90 seconds. This is arbitrary, but hopefully good
- // enough.
- NS_ASSERTION(!sDisableHighPrecisionTimersTimer, "We shouldn't have an outstanding disable-high-precision timer !");
-
- nsCOMPtr<nsITimer> timer = do_CreateInstance(NS_TIMER_CONTRACTID);
- if (timer) {
- timer.forget(&sDisableHighPrecisionTimersTimer);
- sDisableHighPrecisionTimersTimer->InitWithFuncCallback(DisableHighPrecisionTimersCallback,
- nullptr,
- 90 * 1000,
- nsITimer::TYPE_ONE_SHOT);
- } else {
- // might happen if we're shutting down XPCOM; just drop the time period down
- // immediately
- timeEndPeriod(1);
- }
- }
-#endif
- mRequestedHighPrecision = false;
- }
}
uint32_t
@@ -1993,8 +1899,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
observer->DidRefresh();
}
- ConfigureHighPrecision();
-
NS_ASSERTION(mInRefresh, "Still in refresh");
if (mPresContext->IsRoot() && XRE_IsContentProcess() && gfxPrefs::AlwaysPaint()) {
@@ -2247,7 +2151,6 @@ nsRefreshDriver::ScheduleFrameRequestCallbacks(nsIDocument* aDocument)
}
// make sure that the timer is running
- ConfigureHighPrecision();
EnsureTimerStarted();
}
@@ -2256,7 +2159,6 @@ nsRefreshDriver::RevokeFrameRequestCallbacks(nsIDocument* aDocument)
{
mFrameRequestCallbackDocs.RemoveElement(aDocument);
mThrottledFrameRequestCallbackDocs.RemoveElement(aDocument);
- ConfigureHighPrecision();
// No need to worry about restarting our timer in slack mode if it's already
// running; that will happen automatically when it fires.
}