Closed
Bug 1325467
Opened 7 years ago
Closed 6 years ago
Add some prefs for throttling tracking timeouts
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla53
Tracking | Status | |
---|---|---|
firefox53 | --- | fixed |
People
(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 2 obsolete files)
4.17 KB,
patch
|
bkelly
:
review+
|
Details | Diff | Splinter Review |
8.92 KB,
patch
|
bkelly
:
review+
|
Details | Diff | Splinter Review |
3.63 KB,
patch
|
bkelly
:
review+
|
Details | Diff | Splinter Review |
I'm adding some prefs that will allow us to experiment with various strategies for throttling tracking timeouts.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → ehsan
Blocks: QuantumDOM
Assignee | ||
Comment 1•7 years ago
|
||
Attachment #8821294 -
Flags: review?(bkelly)
Assignee | ||
Comment 2•7 years ago
|
||
Attachment #8821295 -
Flags: review?(bkelly)
Assignee | ||
Comment 3•7 years ago
|
||
These prefs allow us to customize the treatment for foreground and background tabs. By default these timeouts aren't treated differently.
Attachment #8821296 -
Flags: review?(bkelly)
Assignee | ||
Comment 4•7 years ago
|
||
Attachment #8821298 -
Flags: review?(bkelly)
Comment 5•7 years ago
|
||
Comment on attachment 8821294 [details] [diff] [review] Part 1: Add Timeout::mIsTracking Review of attachment 8821294 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/base/TimeoutManager.cpp @@ +177,5 @@ > + break; > + } > + case ALL_NORMAL_TIMEOUT_BUCKETING_STRATEGY: > + // timeout->mIsTracking is already false! > + MOZ_DIAGNOSTIC_ASSERT(!timeout->mIsTracking); Is this guaranteed for a timeout that is rescheduled exactly when the pref is changed from a different strategy to this one? Perhaps the mIsTracking flag should be cleared when the timeout is executed or canceled.
Attachment #8821294 -
Flags: review?(bkelly) → review+
Updated•7 years ago
|
Attachment #8821295 -
Flags: review?(bkelly) → review+
Updated•7 years ago
|
Attachment #8821296 -
Flags: review?(bkelly) → review+
Comment 6•7 years ago
|
||
Comment on attachment 8821298 [details] [diff] [review] Part 4: Add a pref for stretching the time for tracking timeouts Review of attachment 8821298 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/base/TimeoutManager.cpp @@ +45,5 @@ > + // the input delay and the back pressure delay. > + auto factor = aIsTracking ? (isBackground ? gTrackingBackgroundTimeoutStretchFactor > + : gTrackingTimeoutStretchFactor) > + : 1.0f; > + value = T(float(value + aInputDelay) * factor); Why do you add the input delay to the backpressure delay? It should really be a std::max() operation per the existing behavior.
Attachment #8821298 -
Flags: review?(bkelly) → review-
Assignee | ||
Comment 7•7 years ago
|
||
(In reply to Ben Kelly [Food Coma / PTO / back Jan 3 :bkelly] from comment #5) > Comment on attachment 8821294 [details] [diff] [review] > Part 1: Add Timeout::mIsTracking > > Review of attachment 8821294 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/base/TimeoutManager.cpp > @@ +177,5 @@ > > + break; > > + } > > + case ALL_NORMAL_TIMEOUT_BUCKETING_STRATEGY: > > + // timeout->mIsTracking is already false! > > + MOZ_DIAGNOSTIC_ASSERT(!timeout->mIsTracking); > > Is this guaranteed for a timeout that is rescheduled exactly when the pref > is changed from a different strategy to this one? Perhaps the mIsTracking > flag should be cleared when the timeout is executed or canceled. This code isn't involved in the rescheduling case at all, this is only invoked from setTimeout, setInterval and IdleRequest.
Assignee | ||
Comment 8•7 years ago
|
||
(In reply to Ben Kelly [Food Coma / PTO / back Jan 3 :bkelly] from comment #6) > Comment on attachment 8821298 [details] [diff] [review] > Part 4: Add a pref for stretching the time for tracking timeouts > > Review of attachment 8821298 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/base/TimeoutManager.cpp > @@ +45,5 @@ > > + // the input delay and the back pressure delay. > > + auto factor = aIsTracking ? (isBackground ? gTrackingBackgroundTimeoutStretchFactor > > + : gTrackingTimeoutStretchFactor) > > + : 1.0f; > > + value = T(float(value + aInputDelay) * factor); > > Why do you add the input delay to the backpressure delay? It should really > be a std::max() operation per the existing behavior. You're right... I don't know why I thought this makes sense before.
Assignee | ||
Comment 9•7 years ago
|
||
Attachment #8823905 -
Flags: review?(bkelly)
Assignee | ||
Updated•7 years ago
|
Attachment #8821298 -
Attachment is obsolete: true
Comment 10•7 years ago
|
||
Comment on attachment 8823905 [details] [diff] [review] Part 4: Add a pref for stretching the time for tracking timeouts Review of attachment 8823905 [details] [diff] [review]: ----------------------------------------------------------------- This is an improvement, but I still don't think it does what you want. You are only getting your stretching for setInterval, nested timers, or background windows. ::: dom/base/TimeoutManager.cpp @@ +225,5 @@ > uint32_t nestingLevel = sNestingLevel + 1; > uint32_t realInterval = interval; > if (aIsInterval || nestingLevel >= DOM_CLAMP_TIMEOUT_NESTING_LEVEL || > mBackPressureDelayMS > 0 || mWindow.IsBackgroundInternal()) { > + realInterval = ComputeDelay(realInterval, timeout->mIsTracking); I think you should move the conditional into ComputeDelay(). For example, you don't actually use your tracking stretch here because the conditional does not take that into account. Lets just keep all the logic together in one function. The main complication with doing this is getting the clamping setting in the function. I suppose you could do something like: enum class Clamp { Disabled, Enabled } Clamp clamp = (aIsInterval || nestingLevel >= DOM_CLAMP_TIMEOUT_NESTING_LEVEL) ? Clamp::Enabled : Clamp::Disabled; And then at other callsites do: ComputeDelay(timeout->mInterval, Clamp::Enabled, timeout->mIsTracking); Or you to improve things, you could track the clamping state flag on the timeout. So you could just do: ComputeDelay(timeout->mInterval, timeout->mClamping, timeout->mIsTracking);
Attachment #8823905 -
Flags: review?(bkelly) → review-
Assignee | ||
Comment 11•6 years ago
|
||
Comment on attachment 8823905 [details] [diff] [review] Part 4: Add a pref for stretching the time for tracking timeouts Looks like I forgot to land this... So after a fair amount of local testing, I think there is a good chance that we won't need the prefs for stretching the time at all, we should be able to get what we want only with the pref added in part 3, so I'll land the first 3 parts here.
Attachment #8823905 -
Attachment is obsolete: true
Comment 12•6 years ago
|
||
Pushed by eakhgari@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/00c84bfb5005 Part 1: Add Timeout::mIsTracking; r=bkelly https://hg.mozilla.org/integration/mozilla-inbound/rev/ae1b2492b2fc Part 2: Let TimeoutManager::DOMMinTimeoutValue know whethe the timeout being scheduled is tracking; r=bkelly https://hg.mozilla.org/integration/mozilla-inbound/rev/eca0ecd94ddc Part 3: Add a pref for adjusting the minimum timeout for tracking timeouts; r=bkelly
Comment 13•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/00c84bfb5005 https://hg.mozilla.org/mozilla-central/rev/ae1b2492b2fc https://hg.mozilla.org/mozilla-central/rev/eca0ecd94ddc
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox53:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Comment 14•6 years ago
|
||
Why do we have DEFAULT_MIN_TRACKING_BACKGROUND_TIMEOUT_VALUE when it is never used?
Assignee | ||
Comment 15•6 years ago
|
||
(In reply to Olli Pettay [:smaug] (review request backlog because of a work week) from comment #14) > Why do we have DEFAULT_MIN_TRACKING_BACKGROUND_TIMEOUT_VALUE when it is > never used? That's a typo, fixed in bug 1332685.
Depends on: 1332685
Updated•4 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•