Commit graph

101 commits

Author SHA1 Message Date
Ben Kelly
cf2f97c065 Bug 1370025 P5 Remove the old TimeoutManager insertion point logic. r=ehsan 2017-06-05 12:42:33 -07:00
Ben Kelly
c2b540895d Bug 1370025 P4 Use FiringId validity in TimeoutManager::Timeouts::Insert() and ::ResetTimersForThrottleReduction(). r=ehsan 2017-06-05 12:42:33 -07:00
Ben Kelly
1cacde3284 Bug 1370025 P3 Give the Timeouts structure a reference back to its owning TimeoutManager. r=ehsan 2017-06-05 12:42:33 -07:00
Ben Kelly
c5ee173aaa Bug 1370025 P2 Add TimeoutManager::IsValidFiringId() helper routine. r=ehsan 2017-06-05 12:42:33 -07:00
Ben Kelly
dd9bba778b Bug 1370025 P1 Better optimize the single mFiringIdStack case in IsInvalidFiringId(). r=ehsan 2017-06-05 12:42:33 -07:00
Ben Kelly
9a57bd14ec Bug 1363829 P8 Remove TimeoutManager back pressure mechanism. r=smaug 2017-05-31 17:13:19 -07:00
Ben Kelly
f698e87bfb Bug 1363829 P6 Use the TimeoutExecutor in TimeoutManager. r=ehsan 2017-05-31 17:13:19 -07:00
Ben Kelly
e9e20536c7 Bug 1363829 P5 Add an executor class to represent the single timer executing timers for a window. r=ehsan 2017-05-31 17:13:19 -07:00
Ben Kelly
9c58cbc4d3 Bug 1363829 P4 Store the scheduled delay on Timeout instead of relying on the nsITimer to hold it. r=ehsan 2017-05-31 17:13:18 -07:00
Ben Kelly
5a9cd2b6fb Bug 1363829 P3 Improve Timeout ref counting to avoide bare AddRef/Release calls. r=ehsan 2017-05-31 17:13:18 -07:00
Ben Kelly
953ad6f162 Bug 1363829 P2 Removing the Timeout argument to TimeoutManager::RunTimeout(). r=ehsan 2017-05-31 17:13:18 -07:00
Ben Kelly
055afe6bd3 Bug 1363829 P1 Remove some deadcode in TimeoutManager related to processing pending timers. r=ehsan 2017-05-31 17:13:18 -07:00
Ehsan Akhgari
9e272b0923 Bug 1366812 - Account for the fact that the load event may fire even though mIsDocumentLoaded is true in TimeoutManager; r=cpearce a=topcrasher 2017-05-26 01:11:39 -04:00
Ehsan Akhgari
dfaa48605d Bug 1366812 - Initialize TimeoutManager::mThrottleTrackingTimeouts to false; r=smaug
This way we won't rely on code which may have potentially not run yet.
2017-05-24 14:48:53 -04:00
Andreas Farre
32f9f451fa Bug 1367025 - Don't start throttling delay timers while suspended. r=bkelly
From c350a6db4069d1a33a21546a287714bfe07e0590 Mon Sep 17 00:00:00 2001
---
 dom/base/TimeoutManager.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
2017-05-23 15:36:08 +02:00
Ben Kelly
0c0a1ef46b Bug 1343912 P5 Removed the fixed limit on consecutive Timeout callbacks. r=ehsan 2017-05-19 13:45:55 -07:00
Ben Kelly
07eac0b288 Bug 1343912 P4 Only execute consecutive timeout handlers for a limit period of time. r=ehsan 2017-05-19 13:45:55 -07:00
Ben Kelly
d642ac9124 Bug 1343912 P2 Change TimeoutManager firing depth to a unique ID that can be expired to optimize cleanup. r=ehsan 2017-05-19 13:45:55 -07:00
Ben Kelly
845f88bba1 Bug 1343912 P1 Cleanup logic in TimeoutManager::RunTimeout() to keep firing depth and other data consistent. r=ehsan 2017-05-19 13:45:55 -07:00
Andreas Farre
1494e1d3e8 Bug 1364858 - Make sure throttle timer isn't recreated. r=smaug
MozReview-Commit-ID: DU8ukd9JqI6
2017-05-19 16:07:52 +02:00
Andreas Farre
3ce44dbcc6 Bug 1355480 - Add telemetry for measuring timeout execution. r=smaug, data-r=bsmedberg
Measure execution time by adding telemetry probes for tracking
foreground, tracking background, non-tracking foreground and
non-tracking background timeouts.

--HG--
extra : source : 69439c0cd3e6d118681d1bb6586cb0a7b4bb85fc
2017-05-02 07:23:00 -04:00
Sebastian Hengst
2ed9a7bb99 Backed out changeset 69439c0cd3e6 (bug 1355480) on suspicion of triggering assertion CompositorThreadHolder::IsInCompositorThread() on Windows 8 x64 M-e10s. r=backout 2017-05-02 23:41:44 +02:00
Andreas Farre
0205fac807 Bug 1355480 - Add telemetry for measuring timeout execution. r=smaug, data-r=bsmedberg
Measure execution time by adding telemetry probes for tracking
foreground, tracking background, non-tracking foreground and
non-tracking background timeouts.

--HG--
extra : rebase_source : f638cc4422a777bbd093d5bbb2d5852c19b1c9d1
2017-05-02 07:23:00 -04:00
Andreas Farre
d91399fada Bug 1339909 - More eagarly clear throttle tracking timer. r=bkelly
Clear the throttle tracking timer in ClearAllTimeouts. Also clear it
in Suspend, and if mThrottleTrackingTimeouts isn't set restart the
timer if the document hasn't loaded.

--HG--
extra : rebase_source : 8be5570265adda22775f6bf7528e39dde855429f
2017-04-25 05:20:00 -04:00
Ben Kelly
ded5d4f5c4 Bug 1346426 Don't crash if a window is frozen while there is a dummy timer in the list. r=ehsan 2017-03-13 15:26:22 -04:00
Ben Kelly
14680016ee Bug 1343877 Don't allow an extra timer callback beyond configured pref value. r=smaug 2017-03-02 11:33:11 -05:00
Ben Kelly
2f8d218126 Bug 1342854 Run a limited number of timer callbacks in the same event loop runnable. r=smaug 2017-02-27 17:33:30 -05:00
Ehsan Akhgari
e5fb1b9d4f Bug 1338691 - Add a pref for delaying tracking timeout throttling after the page load finishes; r=bkelly 2017-02-14 10:57:47 -05:00
Ehsan Akhgari
8a998d9134 Bug 1336484 - Don't throttle timeouts in background tabs that are playing audio; r=baku
In websites such as Facebook Live, timeout chains are used to drive the
playback of a video or something similar in JavaScript.  Throttling the
minimum timeout values a tab playing a video from such websites in the
background could make the timeout based scheduling of video playback to
not work correctly, and cause audio buffer under-runs that are audible.

In order to address this, other major browsers don't throttle timeouts
in tabs that are playing audio.  This brings us to parity to other
browsers (even though we already do this for websites that use Web Audio
since we've had similar bug reports using the Web Audio API.)

The current audio agent setup that drives the tab audio notification
icons is currently tracking whether a Window is playing audio.  We use
this setup to decide whether to throttle timeouts when a window goes
into background.
2017-02-10 12:08:25 -05:00
Ben Kelly
5466fd2706 Bug 1336822 Optimize ResetTimesForTHrottleReduction() for common case. r=ehsan 2017-02-06 12:10:00 -05:00
Ben Kelly
b639eaf199 Bug 1336598 P3 Add preferences to control timeout back pressure algorithm. r=smaug 2017-02-05 21:50:12 -05:00
Ben Kelly
cc8571902b Bug 1336598 P2 Avoid underflow in timeout CancelOrUpdateBackpressure(). r=smaug 2017-02-05 21:50:09 -05:00
Ben Kelly
10744cc4bb Bug 1336598 P1 Tune setTimeout anti-flood constants to minimize jank. r=smaug 2017-02-05 21:50:07 -05:00
Ehsan Akhgari
4941f9389a Bug 1332752 - Add some logging to TimeoutManager; r=bkelly 2017-01-23 16:04:26 -05:00
Ehsan Akhgari
b54c9c2848 Bug 1332776 - Ensure that the dom.min_tracking_timeout_value pref takes effect; r=bkelly
Without this, we would only try to clamp the timeout for background
windows and nested timeouts.  We should also do this for all timeouts
that are classified as tracking.
2017-01-23 16:04:21 -05:00
Ehsan Akhgari
ac63725c64 Bug 1332685 - Actually use DEFAULT_MIN_TRACKING_BACKGROUND_TIMEOUT_VALUE; r=bkelly 2017-01-20 14:20:42 -05:00
Ehsan Akhgari
48a4abb8c9 Bug 1325467 - Part 3: Add a pref for adjusting the minimum timeout for tracking timeouts; r=bkelly
These prefs allow us to customize the treatment for foreground and
background tabs.  By default these timeouts aren't treated differently.
2017-01-17 21:01:17 -05:00
Ehsan Akhgari
d9ae1e342b Bug 1325467 - Part 2: Let TimeoutManager::DOMMinTimeoutValue know whethe the timeout being scheduled is tracking; r=bkelly 2017-01-17 21:01:16 -05:00
Ehsan Akhgari
453c89e409 Bug 1325467 - Part 1: Add Timeout::mIsTracking; r=bkelly 2017-01-17 21:01:15 -05:00
Ben Kelly
7254b4bfa4 Bug 1329284 Refactor DOM timeout to set mWhen/mTimeRemaining from one place. r=ehsan 2017-01-10 08:08:18 -08:00
Gerald Squelart
5d4cad020a Bug 1320785 - Remove obsolete 'ns' from 'StorensRefPtrPassByPtr' - r=froydnj
MozReview-Commit-ID: FuhlsLVFdLi

--HG--
extra : rebase_source : c1bb8330c4ca0dbf15a68a4dbd0dfeff615163be
2017-01-09 07:55:19 +11:00
Ben Kelly
35c6feb9f3 Bug 1329006 Make RescheduleTimeouts() deadlines correctly for suspended windows. r=smaug 2017-01-06 11:24:43 -08:00
Bill McCloskey
8a53959bbe Bug 1320753 - Make TabGroup event target be a ThrottledEventQueue for timers, workers (r=bkelly)
MozReview-Commit-ID: FCfYz02r8yI
2016-12-23 11:48:13 -08:00
Ehsan Akhgari
35e93a7bdf Bug 1312514 - Part 3: Add a test to ensure that timeouts from tracking scripts end up in the tracking bucket; r=bkelly
For simplicity, this test is being added to test_classifier.html which
already has all of the infrastructure necessary for setting up a test
domain as a tracking domain.
2016-12-20 12:40:30 -05:00
Ehsan Akhgari
21f7873ec2 Bug 1312514 - Part 2: Add a hidden pref to control how we split the list of our timeouts into the normal and tracking buckets; r=bkelly
This pref allows easier testing and debugging of this feature
by forcing timeouts to end up in the tracking bucket in either
the alternating or random fashion.
2016-12-20 12:40:28 -05:00
Ehsan Akhgari
7326630b5d Bug 1312514 - Part 1: Split tracking and non-tracking timeouts into two separate lists; r=bkelly
This will allow us to schedule these timers differently in the future.
This patch only performs the refactoring, and is not intended to change
any behavior.  Specifically, this patch doesn't change the order in
which timeouts are fired -- they should still all be fired according to
the mWhen field.

The implementation works by splitting timeout storage per window into
two Timeouts objects, mNormalTimeouts and mTrackingTimeouts.  The ForEach
helper methods are extended to deal with both of these objects, and as a
result, most of the algorithms operating on the list of timeouts work
correctly without any modification, with the notable exception of
RunTimeout.

In RunTimeout(), the order in which Timeout objects are processed does
matter, so for that case we use the OrderedTimeoutIterator class to
iterate over both linked lists simultaneously in the mWhen order.  Also,
inserting the dummy timeout when running the timeouts is only necessary
for the linked list where the last expired timeout is coming from, so we
only inject the dummy timer into the corresponding list, therefore we
remember which list we picked the last expired timeout from when
looking for it.
2016-12-20 12:40:26 -05:00
Ehsan Akhgari
5dcff2e3c6 Bug 1323337 - Refactor two methods looping over timeouts from TimeoutManager into Timeouts; r=bkelly
With this patch, all of the methods which loop over the timeouts
are refactored in preparation for splitting the list of timeouts
into a tracking and a normal list.
2016-12-14 16:02:22 -05:00
Ehsan Akhgari
32a2d894ed Bug 1323326 - Refactor the normal loops over Timeouts inisde TimeoutManager to use ForEach helpers; r=bkelly
These generic loops need to run in the same way for both normal and
tracking timeouts.  This refactoring allows us to only change the
TimeoutManager ForEach helpers to loop over both linked lists when
splitting the timeouts into two separate lists without needing to
modify each call site separately.
2016-12-14 16:02:21 -05:00
Ben Kelly
439d5808fc Bug 1319991 Introduce hysteresis into window timer back pressure calculations. r=smaug 2016-12-13 17:01:45 -08:00
Ehsan Akhgari
7c362efcfe Bug 1323202 - Factor out the timeouts linked list into a separate data structure; r=bkelly
This is in preparation of splitting the timeouts list into normal and
tracking timeouts.
2016-12-13 19:09:19 -05:00
Ehsan Akhgari
443e426d7c Bug 1321903 - Refactor the timeout/interval management code out of nsGlobalWindow; r=bkelly
This code now lives in TimeoutManager.  Note that this is a transition
state, the Timeout list management code also needs to be refactored out
later.

In order to simplify the lifetime management of the new class, its
lifetime is equal to the lifetime of its containing nsGlobalWindow.  In
a few places where we need to dispatch runnables to do asynchronous work
on this object, we hold the containing window alive to guarantee safety.

This patch also removes a bit of dead code that was left over from the
code removed in bug 1281793. See:
https://hg.mozilla.org/mozilla-central/rev/0ac748f4d677#l1.63
2016-12-13 14:08:47 -05:00