aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/devtools
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-09-11 00:09:56 -0700
committerGitHub <noreply@github.com>2024-09-11 07:09:56 +0000
commitbc8d8b62c3017dbdb413a636b80bc3a2df0172d6 (patch)
tree2f4de6402a0bfc56af023b4611bfe14fc59f8fa8 /components/shared/devtools
parent095590e2247517cf22e4aea7956f341a9a38b206 (diff)
downloadservo-bc8d8b62c3017dbdb413a636b80bc3a2df0172d6.tar.gz
servo-bc8d8b62c3017dbdb413a636b80bc3a2df0172d6.zip
Stop using `time@0.1` in Servo (#33394)
This removes the last few uses of `time@0.1` in Servo. There are still dependencies from `style` and `webrender`, but they will be removed soon as well. The uses of this version of `time` are replaced with `std::time` types and `time@0.3` when negative `Duration` is necessary. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/shared/devtools')
-rw-r--r--components/shared/devtools/Cargo.toml1
-rw-r--r--components/shared/devtools/lib.rs31
2 files changed, 6 insertions, 26 deletions
diff --git a/components/shared/devtools/Cargo.toml b/components/shared/devtools/Cargo.toml
index cc54bbb2765..08448dd1e9f 100644
--- a/components/shared/devtools/Cargo.toml
+++ b/components/shared/devtools/Cargo.toml
@@ -19,5 +19,4 @@ malloc_size_of = { workspace = true }
malloc_size_of_derive = { workspace = true }
serde = { workspace = true }
servo_url = { path = "../../url" }
-time = { workspace = true }
uuid = { workspace = true, features = ["serde"] }
diff --git a/components/shared/devtools/lib.rs b/components/shared/devtools/lib.rs
index 82a621966d7..6e196cbac52 100644
--- a/components/shared/devtools/lib.rs
+++ b/components/shared/devtools/lib.rs
@@ -14,6 +14,7 @@ use std::collections::HashMap;
use std::net::TcpStream;
use std::time::{Duration, SystemTime};
+use base::cross_process_instant::CrossProcessInstant;
use base::id::{BrowsingContextId, PipelineId};
use bitflags::bitflags;
use http::{HeaderMap, Method};
@@ -134,16 +135,16 @@ pub struct NodeInfo {
pub struct StartedTimelineMarker {
name: String,
- start_time: PreciseTime,
+ start_time: CrossProcessInstant,
start_stack: Option<Vec<()>>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct TimelineMarker {
pub name: String,
- pub start_time: PreciseTime,
+ pub start_time: CrossProcessInstant,
pub start_stack: Option<Vec<()>>,
- pub end_time: PreciseTime,
+ pub end_time: CrossProcessInstant,
pub end_stack: Option<Vec<()>>,
}
@@ -364,7 +365,7 @@ impl TimelineMarker {
pub fn start(name: String) -> StartedTimelineMarker {
StartedTimelineMarker {
name,
- start_time: PreciseTime::now(),
+ start_time: CrossProcessInstant::now(),
start_stack: None,
}
}
@@ -376,31 +377,11 @@ impl StartedTimelineMarker {
name: self.name,
start_time: self.start_time,
start_stack: self.start_stack,
- end_time: PreciseTime::now(),
+ end_time: CrossProcessInstant::now(),
end_stack: None,
}
}
}
-
-/// A replacement for `time::PreciseTime` that isn't opaque, so we can serialize it.
-///
-/// The reason why this doesn't go upstream is that `time` is slated to be part of Rust's standard
-/// library, which definitely can't have any dependencies on `serde`. But `serde` can't implement
-/// `Deserialize` and `Serialize` itself, because `time::PreciseTime` is opaque! A Catch-22. So I'm
-/// duplicating the definition here.
-#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
-pub struct PreciseTime(u64);
-
-impl PreciseTime {
- pub fn now() -> PreciseTime {
- PreciseTime(time::precise_time_ns())
- }
-
- pub fn to(&self, later: PreciseTime) -> Duration {
- Duration::from_nanos(later.0 - self.0)
- }
-}
-
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct WorkerId(pub Uuid);