aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/timers.rs
Commit message (Collapse)AuthorAgeFilesLines
* Replace all uses of the `heapsize` crate with `malloc_size_of`.Nicholas Nethercote2017-10-181-22/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`. `malloc_size_of` is better -- it handles various cases that `heapsize` does not -- so this patch changes Servo to use `malloc_size_of`. This patch makes the following changes to the `malloc_size_of` crate. - Adds `MallocSizeOf` trait implementations for numerous types, some built-in (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`). - Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't support that operation. - For `HashSet`/`HashMap`, falls back to a computed estimate when `enclosing_size_of_op` isn't available. - Adds an extern "C" `malloc_size_of` function that does the actual heap measurement; this is based on the same functions from the `heapsize` crate. This patch makes the following changes elsewhere. - Converts all the uses of `heapsize` to instead use `malloc_size_of`. - Disables the "heapsize"/"heap_size" feature for the external crates that provide it. - Removes the `HeapSizeOf` implementation from `hashglobe`. - Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of` doesn't derive those types, unlike `heapsize`.
* Rename DOMRefCell<T> to DomRefCell<T>Anthony Ramine2017-09-261-5/+5
| | | | | | | | I don't want to do such a gratuitous rename, but with all the other types now having "Dom" as part of their name, and especially with "DomOnceCell", I feel like the other cell type that we already have should also follow the convention. That argument loses weight though when we realise there is still DOMString and other things.
* order derivable traits listsClément DAVID2017-08-231-7/+7
| | | | | | Ignoring : - **generated**.rs - python/tidy/servo_tidy_tests/rust_tidy.rs
* Use boxed slice instead of vec for FuntionTimerCallbackSadman Kazi2017-07-111-2/+2
|
* Bump euclid to 0.14.Nicolas Silva2017-06-141-1/+1
|
* Terminate timer scheduler thread during shutdownFernando Jiménez Moreno2017-03-301-4/+5
|
* script: Use a timer when rAF is used for non-animation purposesPatrick Walton2017-03-031-0/+3
| | | | | | | | | | | | After this patch, when the page calls `requestAnimationFrame()` too many times in the row without actually mutating the DOM, further calls to `rAF` will actually perform the moral equivalent of `setTimeout(16)`. This saves a lot of CPU time compared to actually waiting for the vertical blanking interval, because waiting for that requires us to draw the page. Reduces CPU usage drastically on nytimes.com, which has a perpetual `requestAnimationFrame()` loop that checks whether ads are in view.
* Change #[privatize] into #[derive(DenyPublicFields)]Anthony Ramine2017-02-151-6/+3
|
* The constellation notifies the script thread about documents becoming ↵Alan Jeffrey2017-01-271-1/+3
| | | | inactive, active and fully active.
* Remove some unsound JSVal handling in JsTimerTask::invoke.Ms2ger2017-01-051-7/+2
| | | | | We were using Handles to *copies* of the traced values, rather than the originals.
* Added warnings for idempotent freeze/thaw.Alan Jeffrey2017-01-041-2/+4
|
* Implement discarding Document objects to reclaim space.Alan Jeffrey2017-01-041-4/+4
|
* Removed util.Alan Jeffrey2016-12-141-1/+1
|
* Rename `Reflectable` to `DomObject`.Corey Farwell2016-12-081-4/+4
| | | | Fixes https://github.com/servo/servo/issues/8473.
* Use a timer callback when re-establishing a connectionKeith Yeung2016-11-111-0/+3
|
* Rename Reflectable::global_scope to globalAnthony Ramine2016-10-061-2/+2
|
* Move timers to GlobalScopeAnthony Ramine2016-10-061-9/+9
|
* Move JS evaluation functions to GlobalScopeAnthony Ramine2016-10-061-3/+3
|
* Replace ScriptHelpers by GlobalRef methodsAnthony Ramine2016-10-031-3/+4
|
* Support an equivalent of Trusted<T> for Rc<Promise> objects named ↵Josh Matthews2016-09-221-0/+3
| | | | TrustedPromise.
* Auto merge of #11872 - eddyb:back-to-roots, r=Ms2gerbors-servo2016-07-041-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace return_address usage for rooting with stack guards and convenience macros. The existing `Rooted` and `RootedVec` users were migrated the the following two macros: ```rust let x = Rooted::new(cx, value); // Was changed to: rooted!(in(cx) let x = value); // Which expands to: let mut __root = Rooted::new_unrooted(value); let x = RootedGuard::new(cx, &mut __root); ``` ```rust let mut v = RootedVec::new(); v.extend(iterator); // Was changed to: rooted_vec!(let v <- iterator); // Which expands to: let mut __root = RootableVec::new(); let v = RootedVec::new(&mut __root, iterator); ``` The `rooted!` macro depends on servo/rust-mozjs#272. These APIs based on two types, a container to be rooted and a rooting guard, allow implementing both `Rooted`-style rooting and `Traceable`-based rooting in stable Rust, without abusing `return_address`. Such macros may have been tried before, but in 1.9 their hygiene is broken, they work only since 1.10. Sadly, `Rooted` is a FFI type and completely exposed, so I cannot prevent anyone from creating their own, although all fields but the value get overwritten by `RootedGuard::new` anyway. `RootableVec` OTOH is *guaranteed* to be empty when not rooted, which makes it harmless AFAICT. By fixing rust-lang/rust#34227, this PR enables Servo to build with `-Zorbit`. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix rust-lang/rust#34227 - [x] These changes do not require tests because they are not functional changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11872) <!-- Reviewable:end -->
| * Switch to using the new rooted!/RootedGuard API for rooting.Eduard Burtescu2016-07-041-2/+2
| |
* | Refactor `util::prefs` operations to be methods on static struct.Corey Farwell2016-07-021-2/+2
|/
* Auto merge of #10225 - jmr0:visibility_api, r=jdmbors-servo2016-06-161-4/+34
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement non-visible pipeline and iframe visibility methods This addresses #9566 and a good part of #9751, specifically: * Pipeline has a notion of visibility * IFrame setVisible/getVisible interface with IFrame's pipeline visibility * IFrame mozbrowservisibilitychange responds to changes in visibility * Pipeline visibility is used to limit animations (requestAnimationFrame does not tick animations when hidden) and to increase timer intervals (currently set to a minimum of 1 second while hidden) Absent for now are any changes to the Document API and general implementation of the Page Visibility API, since the more interesting parts require knowledge of whether the user agent is minimized, OS screen locked, etc. cc @paulrouget @jdm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10225) <!-- Reviewable:end -->
| * Implement non-visible pipeline and iframe visibility methodsjmr02016-06-151-4/+34
| |
* | Remove an invalid assertion in fire_timer.Ms2ger2016-06-101-1/+4
|/ | | | | | | It's not clear to me if this is something we should expect to happen, but it does indeed happen, so we should disable the assertion while we investigate. Fixes #9984.
* Remove empty lines following braces.Josh Matthews2016-05-271-2/+0
|
* Move DOMString back to scriptAnthony Ramine2016-05-241-1/+1
| | | | This entirely removes the 'non-geckolib' feature of the util crate.
* Removed unused importsPer Lundberg2016-05-151-2/+0
| | | | This fixes #11185.
* Use num-traits in script.Ms2ger2016-04-201-1/+1
|
* Clean up of script timer code.benshu2016-02-201-222/+315
| | | | | | | | | | | The code was split into the following two abstractions. - OneshotTimers can be used to schedule arbitrary oneshot timers, such as XHR-Timeouts. - JsTimers (`setTimeout` and `setInterval`) which use OneshotTimers to schedule individual callbacks. With this change the implementation (of JsTimers in particular) is in much closer alignment with the specification.
* Auto merge of #9471 - peterkort:patch-1, r=jdmbors-servo2016-02-061-0/+1
|\ | | | | | | | | | | | | | | fix #8461 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9471) <!-- Reviewable:end -->
| * resume fn should set suspended_since back to Nonepeterkort2016-01-311-0/+1
| |
* | Say farewell to in-tree HeapSizeOfAnthony Ramine2016-02-041-1/+1
|/
* Add global default method for Reflectable traitChad Kimes2016-01-111-2/+1
|
* task -> threadrohan.prinja2016-01-101-1/+1
|
* fix intermittent Option::unwrap in timersAleksandr Likhanov2015-12-041-8/+14
| | | | not allow to fire timers installed during another timer call
* Correct undisciplined rebase. (Closes #8583.)benshu2015-11-181-2/+0
|
* script: Make timer events e10s-safe.Patrick Walton2015-11-121-6/+6
| | | | Closes #8235.
* Clean up the conversion routinesAnthony Ramine2015-11-111-3/+2
| | | | | | | | Functions returning `Root<T>` are prefixed by "root_" and the ones returning `*const T` by "native_". Functions taking `*mut JSObject` are now suffixed by "_from_object" and the ones taking `&T` by "_from_reflector".
* XHR timeouts use same abstraction as scripts timers. (fixes #3396)benshu2015-11-111-12/+55
|
* Auto merge of #8175 - benschulz:set-timeout-panic, r=jdmbors-servo2015-11-091-4/+10
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed panic in ActiveTimers.set_timeout_or_interval. `ActiveTimers.set_timeout_or_interval` asserts that the pipeline is not currently frozen. Apparently that is too strict. When pending network requests complete after a pipeline is frozen, scripts may be executed and a timer scheduled. With these changes scheduling a timer while the pipeline is frozen behaves as if the timer was scheduled at the time the pipeline was frozen. To reproduce the panic 1. `./mach run -r http://google.com`, 2. immediately click on any link and 3. wait for the panic. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8175) <!-- Reviewable:end -->
| * Fixed panic in ActiveTimers.set_timeout_or_interval.benshu2015-10-241-4/+10
| |
* | merge from masterrohan.prinja2015-11-031-1/+1
|\ \
| * | Fix some rust-clippy violationsCorey Farwell2015-10-301-1/+1
| |/
* / more refactoringrohan.prinja2015-10-301-1/+1
|/
* Timers are scheduled by a dedicated per-constellation thread.benshu2015-10-211-201/+277
|
* Support the updated spidermonkey bindingsMichael Wu2015-10-141-1/+4
|
* sorted the extern crate, mod & use declarationsRavi Shankar2015-09-241-4/+3
|
* Fix reported test-tidy errors for unmerged import blocksBrandon Fairchild2015-09-191-8/+5
| | | | This merges import blocks that were reported by tidy as unmerged.