mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Add connectStart in PerformanceResourceTiming
This commit is contained in:
parent
1409c767e4
commit
a11684460d
4 changed files with 17 additions and 3 deletions
|
@ -381,6 +381,12 @@ fn obtain_response(
|
||||||
// TODO(#21261) connect_start: set if a persistent connection is *not* used and the last non-redirected
|
// TODO(#21261) connect_start: set if a persistent connection is *not* used and the last non-redirected
|
||||||
// fetch passes the timing allow check
|
// fetch passes the timing allow check
|
||||||
let connect_start = precise_time_ms();
|
let connect_start = precise_time_ms();
|
||||||
|
context
|
||||||
|
.timing
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.set_attribute(ResourceAttribute::ConnectStart(connect_start));
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#percent-encoded-bytes
|
// https://url.spec.whatwg.org/#percent-encoded-bytes
|
||||||
let request = HyperRequest::builder()
|
let request = HyperRequest::builder()
|
||||||
.method(method)
|
.method(method)
|
||||||
|
|
|
@ -452,7 +452,7 @@ pub struct ResourceFetchTiming {
|
||||||
pub response_end: u64,
|
pub response_end: u64,
|
||||||
pub redirect_start: u64,
|
pub redirect_start: u64,
|
||||||
// pub redirect_end: u64,
|
// pub redirect_end: u64,
|
||||||
// pub connect_start: u64,
|
pub connect_start: u64,
|
||||||
pub connect_end: u64,
|
pub connect_end: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,6 +468,7 @@ pub enum ResourceAttribute {
|
||||||
ResponseStart,
|
ResponseStart,
|
||||||
RedirectStart(RedirectStartValue),
|
RedirectStart(RedirectStartValue),
|
||||||
FetchStart,
|
FetchStart,
|
||||||
|
ConnectStart(u64),
|
||||||
ConnectEnd(u64),
|
ConnectEnd(u64),
|
||||||
ResponseEnd,
|
ResponseEnd,
|
||||||
}
|
}
|
||||||
|
@ -489,6 +490,7 @@ impl ResourceFetchTiming {
|
||||||
response_start: 0,
|
response_start: 0,
|
||||||
fetch_start: 0,
|
fetch_start: 0,
|
||||||
redirect_start: 0,
|
redirect_start: 0,
|
||||||
|
connect_start: 0,
|
||||||
connect_end: 0,
|
connect_end: 0,
|
||||||
response_end: 0,
|
response_end: 0,
|
||||||
}
|
}
|
||||||
|
@ -510,6 +512,7 @@ impl ResourceFetchTiming {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ResourceAttribute::FetchStart => self.fetch_start = precise_time_ns(),
|
ResourceAttribute::FetchStart => self.fetch_start = precise_time_ns(),
|
||||||
|
ResourceAttribute::ConnectStart(val) => self.connect_start = val,
|
||||||
ResourceAttribute::ConnectEnd(val) => self.connect_end = val,
|
ResourceAttribute::ConnectEnd(val) => self.connect_end = val,
|
||||||
ResourceAttribute::ResponseEnd => self.response_end = precise_time_ns(),
|
ResourceAttribute::ResponseEnd => self.response_end = precise_time_ns(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ impl PerformanceResourceTiming {
|
||||||
fetch_start: resource_timing.fetch_start as f64,
|
fetch_start: resource_timing.fetch_start as f64,
|
||||||
domain_lookup_start: 0.,
|
domain_lookup_start: 0.,
|
||||||
domain_lookup_end: 0.,
|
domain_lookup_end: 0.,
|
||||||
connect_start: 0.,
|
connect_start: resource_timing.connect_start as f64,
|
||||||
connect_end: resource_timing.connect_end as f64,
|
connect_end: resource_timing.connect_end as f64,
|
||||||
secure_connection_start: 0.,
|
secure_connection_start: 0.,
|
||||||
request_start: resource_timing.request_start as f64,
|
request_start: resource_timing.request_start as f64,
|
||||||
|
@ -192,6 +192,11 @@ impl PerformanceResourceTimingMethods for PerformanceResourceTiming {
|
||||||
Finite::wrap(self.fetch_start)
|
Finite::wrap(self.fetch_start)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-connectstart
|
||||||
|
fn ConnectStart(&self) -> DOMHighResTimeStamp {
|
||||||
|
Finite::wrap(self.connect_start)
|
||||||
|
}
|
||||||
|
|
||||||
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-connectend
|
// https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-connectend
|
||||||
fn ConnectEnd(&self) -> DOMHighResTimeStamp {
|
fn ConnectEnd(&self) -> DOMHighResTimeStamp {
|
||||||
Finite::wrap(self.connect_end)
|
Finite::wrap(self.connect_end)
|
||||||
|
|
|
@ -17,7 +17,7 @@ interface PerformanceResourceTiming : PerformanceEntry {
|
||||||
readonly attribute DOMHighResTimeStamp fetchStart;
|
readonly attribute DOMHighResTimeStamp fetchStart;
|
||||||
// readonly attribute DOMHighResTimeStamp domainLookupStart;
|
// readonly attribute DOMHighResTimeStamp domainLookupStart;
|
||||||
// readonly attribute DOMHighResTimeStamp domainLookupEnd;
|
// readonly attribute DOMHighResTimeStamp domainLookupEnd;
|
||||||
// readonly attribute DOMHighResTimeStamp connectStart;
|
readonly attribute DOMHighResTimeStamp connectStart;
|
||||||
readonly attribute DOMHighResTimeStamp connectEnd;
|
readonly attribute DOMHighResTimeStamp connectEnd;
|
||||||
// readonly attribute DOMHighResTimeStamp secureConnectionStart;
|
// readonly attribute DOMHighResTimeStamp secureConnectionStart;
|
||||||
readonly attribute DOMHighResTimeStamp requestStart;
|
readonly attribute DOMHighResTimeStamp requestStart;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue