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>
This commit is contained in:
Martin Robinson 2024-09-11 00:09:56 -07:00 committed by GitHub
parent 095590e224
commit bc8d8b62c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 88 additions and 103 deletions

View file

@ -12,9 +12,10 @@ use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
use base::cross_process_instant::CrossProcessInstant;
use base::id::PipelineId;
use devtools_traits::DevtoolScriptControlMsg::{DropTimelineMarkers, SetTimelineMarkers};
use devtools_traits::{DevtoolScriptControlMsg, PreciseTime, TimelineMarker, TimelineMarkerType};
use devtools_traits::{DevtoolScriptControlMsg, TimelineMarker, TimelineMarkerType};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use serde::{Serialize, Serializer};
use serde_json::{Map, Value};
@ -41,7 +42,7 @@ struct Emitter {
from: String,
stream: TcpStream,
registry: Arc<Mutex<ActorRegistry>>,
start_stamp: PreciseTime,
start_stamp: CrossProcessInstant,
framerate_actor: Option<String>,
memory_actor: Option<String>,
@ -110,8 +111,8 @@ struct FramerateEmitterReply {
pub struct HighResolutionStamp(f64);
impl HighResolutionStamp {
pub fn new(start_stamp: PreciseTime, time: PreciseTime) -> HighResolutionStamp {
let duration = start_stamp.to(time).as_micros();
pub fn new(start_stamp: CrossProcessInstant, time: CrossProcessInstant) -> HighResolutionStamp {
let duration = (time - start_stamp).whole_microseconds();
HighResolutionStamp(duration as f64 / 1000_f64)
}
@ -242,7 +243,10 @@ impl Actor for TimelineActor {
let msg = StartReply {
from: self.name(),
value: HighResolutionStamp::new(registry.start_stamp(), PreciseTime::now()),
value: HighResolutionStamp::new(
registry.start_stamp(),
CrossProcessInstant::now(),
),
};
let _ = stream.write_json_packet(&msg);
ActorMessageStatus::Processed
@ -251,7 +255,10 @@ impl Actor for TimelineActor {
"stop" => {
let msg = StopReply {
from: self.name(),
value: HighResolutionStamp::new(registry.start_stamp(), PreciseTime::now()),
value: HighResolutionStamp::new(
registry.start_stamp(),
CrossProcessInstant::now(),
),
};
let _ = stream.write_json_packet(&msg);
@ -295,7 +302,7 @@ impl Emitter {
pub fn new(
name: String,
registry: Arc<Mutex<ActorRegistry>>,
start_stamp: PreciseTime,
start_stamp: CrossProcessInstant,
stream: TcpStream,
memory_actor_name: Option<String>,
framerate_actor_name: Option<String>,
@ -322,7 +329,7 @@ impl Emitter {
}
fn send(&mut self, markers: Vec<TimelineMarkerReply>) -> Result<(), Box<dyn Error>> {
let end_time = PreciseTime::now();
let end_time = CrossProcessInstant::now();
let reply = MarkersEmitterReply {
type_: "markers".to_owned(),
markers,