servo/components/devtools/actors
Martin Robinson 312cf0df08
script: Create a CrossProcessInstant to enable serializable monotonic time (#33282)
Up until now, Servo was using a very old version of time to get a
cross-process monotonic timestamp (using `time::precise_time_ns()`).
This change replaces the usage of old time with a new serializable
monotonic time called `CrossProcessInstant` and uses it where `u64`
timestamps were stored before. The standard library doesn't provide this
functionality because it isn't something you can do reliably on all
platforms. The idea is that we do our best and then fall back
gracefully.

This is a big change, because Servo was using `u64` timestamps all over
the place some as raw values taken from `time::precise_time_ns()` and
some as relative offsets from the "navigation start," which is a concept
similar to DOM's `timeOrigin` (but not exactly the same). It's very
difficult to fix this situation without fixing it everywhere as the
`Instant` concept is supposed to be opaque. The good thing is that this
change clears up all ambiguity when passing times as a `time::Duration`
is unit agnostic and a `CrossProcessInstant` represents an absolute
moment in time.

The `time` version of `Duration` is used because it can both be negative
and is also serializable.

Good things:
 - No need too pass around `time` and `time_precise` any longer.
   `CrossProcessInstant` is also precise and monotonic.
 - The distinction between a time that is unset or at `0` (at some kind
   of timer epoch) is now gone.

There still a lot of work to do to clean up timing, but this is the
first step. In general, I've tried to preserve existing behavior, even
when not spec compliant, as much as possible. I plan to submit followup
PRs fixing some of the issues I've noticed.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-05 18:50:09 +00:00
..
inspector Fix several clippy warnings in components/devtools (#33227) 2024-08-28 16:36:43 +00:00
watcher DevTools: Show HTML tree (#32655) 2024-07-26 15:17:54 +00:00
browsing_context.rs DevTools: Inspect node styles (#33025) 2024-08-25 09:30:23 +00:00
console.rs DevTools: Display console messages and errors (#32727) 2024-07-09 18:27:47 +00:00
device.rs DevTools: Replace camel case variable names (#32726) 2024-07-08 11:18:35 +00:00
framerate.rs DevTools: Replace camel case variable names (#32726) 2024-07-08 11:18:35 +00:00
inspector.rs DevTools: Inspect node styles (#33025) 2024-08-25 09:30:23 +00:00
memory.rs DevTools: Replace camel case variable names (#32726) 2024-07-08 11:18:35 +00:00
network_event.rs script: Create a CrossProcessInstant to enable serializable monotonic time (#33282) 2024-09-05 18:50:09 +00:00
object.rs Fix warnings after latest rust upgrade (#33043) 2024-08-14 07:00:16 +00:00
performance.rs DevTools: Show HTML tree (#32655) 2024-07-26 15:17:54 +00:00
preference.rs Devtools device description: improve how Servo is advertised in Firefox's about:debugging (fixes #27528) (#32227) 2024-05-08 04:12:18 +00:00
process.rs DevTools: Implement watcher actor (#32509) 2024-06-21 16:06:55 +00:00
reflow.rs DevTools: Show HTML tree (#32655) 2024-07-26 15:17:54 +00:00
root.rs DevTools: Show HTML tree (#32655) 2024-07-26 15:17:54 +00:00
stylesheets.rs DevTools: Replace camel case variable names (#32726) 2024-07-08 11:18:35 +00:00
tab.rs clippy: Fix various clippy warnings throughout the code (#33003) 2024-08-13 05:16:47 +00:00
thread.rs DevTools: Show HTML tree (#32655) 2024-07-26 15:17:54 +00:00
timeline.rs DevTools: Show HTML tree (#32655) 2024-07-26 15:17:54 +00:00
watcher.rs DevTools: Inspect node styles (#33025) 2024-08-25 09:30:23 +00:00
worker.rs DevTools: Replace camel case variable names (#32726) 2024-07-08 11:18:35 +00:00