Firefox timeline integration #4957

This commit is contained in:
Guro Bokum 2015-03-28 23:27:54 +07:00
parent 1e45d025b3
commit 97714ec5ed
15 changed files with 761 additions and 14 deletions

View file

@ -17,6 +17,7 @@ extern crate msg;
extern crate "rustc-serialize" as rustc_serialize;
extern crate url;
extern crate util;
extern crate time;
use rustc_serialize::{Decodable, Decoder};
use msg::constellation_msg::{PipelineId, WorkerId};
@ -83,6 +84,28 @@ pub struct NodeInfo {
pub incompleteValue: bool,
}
#[derive(PartialEq, Eq)]
pub enum TracingMetadata {
Default,
IntervalStart,
IntervalEnd,
Event,
EventBacktrace,
}
pub struct TimelineMarker {
pub name: String,
pub metadata: TracingMetadata,
pub time: u64,
pub stack: Option<Vec<()>>,
}
#[derive(PartialEq, Eq, Hash, Clone)]
pub enum TimelineMarkerType {
Reflow,
DOMEvent,
}
/// Messages to process in a particular script task, as instructed by a devtools client.
pub enum DevtoolScriptControlMsg {
EvaluateJS(PipelineId, String, Sender<EvaluateJSReply>),
@ -92,6 +115,8 @@ pub enum DevtoolScriptControlMsg {
GetLayout(PipelineId, String, Sender<(f32, f32)>),
ModifyAttribute(PipelineId, String, Vec<Modification>),
WantsLiveNotifications(PipelineId, bool),
SetTimelineMarkers(PipelineId, Vec<TimelineMarkerType>, Sender<TimelineMarker>),
DropTimelineMarkers(PipelineId, Vec<TimelineMarkerType>),
}
/// Messages to instruct devtools server to update its state relating to a particular
@ -128,3 +153,14 @@ pub enum ConsoleMessage {
LogMessage(String, String, u32, u32),
//WarnMessage(String),
}
impl TimelineMarker {
pub fn new(name: String, metadata: TracingMetadata) -> TimelineMarker {
TimelineMarker {
name: name,
metadata: metadata,
time: time::precise_time_ns(),
stack: None,
}
}
}