mirror of
https://github.com/servo/servo.git
synced 2025-06-08 08:33:26 +00:00
* Remove script_plugins * Use crown instead of script_plugins * crown_is_not_used * Use crown in command base * bootstrap crown * tidy happy * disable sccache * Bring crown in tree * Install crown from tree * fix windows ci * fix warning * fix mac libscript_plugins.dylib is not available anymore * Update components/script/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> * Update for nightly-2023-03-18 Mostly just based off https://github.com/servo/servo/pull/30630 * Always install crown it's slow only when there is new version * Run crown test with `mach test-unit` * Small fixups; better trace_in_no_trace tests * Better doc * crown in config.toml * Fix tidy for real * no sccache on rustc_wrapper * document rustc overrides * fixup of compiletest * Make a few minor comment adjustments * Fix a typo in python/servo/platform/base.py Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com> * Proper test types * Ignore tidy on crown/tests --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
103 lines
3.4 KiB
Rust
103 lines
3.4 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
use crate::dom::bindings::codegen::Bindings::PerformanceTimingBinding;
|
|
use crate::dom::bindings::codegen::Bindings::PerformanceTimingBinding::PerformanceTimingMethods;
|
|
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
|
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
|
use crate::dom::document::Document;
|
|
use crate::dom::window::Window;
|
|
use dom_struct::dom_struct;
|
|
|
|
#[dom_struct]
|
|
pub struct PerformanceTiming {
|
|
reflector_: Reflector,
|
|
navigation_start: u64,
|
|
navigation_start_precise: u64,
|
|
document: Dom<Document>,
|
|
}
|
|
|
|
impl PerformanceTiming {
|
|
fn new_inherited(
|
|
nav_start: u64,
|
|
nav_start_precise: u64,
|
|
document: &Document,
|
|
) -> PerformanceTiming {
|
|
PerformanceTiming {
|
|
reflector_: Reflector::new(),
|
|
navigation_start: nav_start,
|
|
navigation_start_precise: nav_start_precise,
|
|
document: Dom::from_ref(document),
|
|
}
|
|
}
|
|
|
|
#[allow(crown::unrooted_must_root)]
|
|
pub fn new(
|
|
window: &Window,
|
|
navigation_start: u64,
|
|
navigation_start_precise: u64,
|
|
) -> DomRoot<PerformanceTiming> {
|
|
let timing = PerformanceTiming::new_inherited(
|
|
navigation_start,
|
|
navigation_start_precise,
|
|
&window.Document(),
|
|
);
|
|
reflect_dom_object(Box::new(timing), window)
|
|
}
|
|
}
|
|
|
|
impl PerformanceTimingMethods for PerformanceTiming {
|
|
// https://w3c.github.io/navigation-timing/#widl-PerformanceTiming-navigationStart
|
|
fn NavigationStart(&self) -> u64 {
|
|
self.navigation_start
|
|
}
|
|
|
|
// https://w3c.github.io/navigation-timing/#widl-PerformanceTiming-domLoading
|
|
fn DomLoading(&self) -> u64 {
|
|
self.document.get_dom_loading()
|
|
}
|
|
|
|
// https://w3c.github.io/navigation-timing/#widl-PerformanceTiming-domInteractive
|
|
fn DomInteractive(&self) -> u64 {
|
|
self.document.get_dom_interactive()
|
|
}
|
|
|
|
// https://w3c.github.io/navigation-timing/#widl-PerformanceTiming-domContentLoadedEventStart
|
|
fn DomContentLoadedEventStart(&self) -> u64 {
|
|
self.document.get_dom_content_loaded_event_start()
|
|
}
|
|
|
|
// https://w3c.github.io/navigation-timing/#widl-PerformanceTiming-domContentLoadedEventEnd
|
|
fn DomContentLoadedEventEnd(&self) -> u64 {
|
|
self.document.get_dom_content_loaded_event_end()
|
|
}
|
|
|
|
// https://w3c.github.io/navigation-timing/#widl-PerformanceTiming-domComplete
|
|
fn DomComplete(&self) -> u64 {
|
|
self.document.get_dom_complete()
|
|
}
|
|
|
|
// https://w3c.github.io/navigation-timing/#widl-PerformanceTiming-loadEventStart
|
|
fn LoadEventStart(&self) -> u64 {
|
|
self.document.get_load_event_start()
|
|
}
|
|
|
|
// https://w3c.github.io/navigation-timing/#widl-PerformanceTiming-loadEventEnd
|
|
fn LoadEventEnd(&self) -> u64 {
|
|
self.document.get_load_event_end()
|
|
}
|
|
|
|
// check-tidy: no specs after this line
|
|
// Servo-only timing for when top-level content (not iframes) is complete
|
|
fn TopLevelDomComplete(&self) -> u64 {
|
|
self.document.get_top_level_dom_complete()
|
|
}
|
|
}
|
|
|
|
impl PerformanceTiming {
|
|
pub fn navigation_start_precise(&self) -> u64 {
|
|
self.navigation_start_precise
|
|
}
|
|
}
|