pub struct ProgressiveWebMetrics {
pub(crate) frame_type: TimerMetadataFrameType,
pub(crate) navigation_start: Option<CrossProcessInstant>,
pub(crate) dom_content_loaded: Cell<Option<CrossProcessInstant>>,
pub(crate) main_thread_available: Cell<Option<CrossProcessInstant>>,
pub(crate) time_to_interactive: Cell<Option<CrossProcessInstant>>,
pub(crate) first_paint: Cell<Option<CrossProcessInstant>>,
pub(crate) first_contentful_paint: Cell<Option<CrossProcessInstant>>,
pub(crate) time_profiler_chan: ProfilerChan,
pub(crate) url: ServoUrl,
}
Expand description
A data structure to track web metrics dfined in various specifications:
- https://w3c.github.io/paint-timing/
- https://github.com/WICG/time-to-interactive / https://github.com/GoogleChrome/lighthouse/issues/27
We can look at three different metrics here:
- navigation start -> visually ready (dom content loaded)
- navigation start -> thread ready (main thread available)
- visually ready -> thread ready
Fields§
§frame_type: TimerMetadataFrameType
Whether or not this metric is for an <iframe>
or a top level frame.
when we navigated to the page
dom_content_loaded: Cell<Option<CrossProcessInstant>>
indicates if the page is visually ready
main_thread_available: Cell<Option<CrossProcessInstant>>
main thread is available – there’s been a 10s window with no tasks longer than 50ms
time_to_interactive: Cell<Option<CrossProcessInstant>>
§first_paint: Cell<Option<CrossProcessInstant>>
The first paint of a particular document. TODO(mrobinson): It’s unclear if this particular metric is reflected in the specification.
See https://w3c.github.io/paint-timing/#sec-reporting-paint-timing.
first_contentful_paint: Cell<Option<CrossProcessInstant>>
The first “contentful” paint of a particular document.
See https://w3c.github.io/paint-timing/#first-contentful-paint
time_profiler_chan: ProfilerChan
§url: ServoUrl
Implementations§
Source§impl ProgressiveWebMetrics
impl ProgressiveWebMetrics
pub fn new( time_profiler_chan: ProfilerChan, url: ServoUrl, frame_type: TimerMetadataFrameType, ) -> ProgressiveWebMetrics
pub(crate) fn make_metadata(&self, first_reflow: bool) -> TimerMetadata
pub fn set_dom_content_loaded(&self)
pub fn set_main_thread_available(&self, time: CrossProcessInstant)
pub fn dom_content_loaded(&self) -> Option<CrossProcessInstant>
pub fn first_paint(&self) -> Option<CrossProcessInstant>
pub fn first_contentful_paint(&self) -> Option<CrossProcessInstant>
pub fn main_thread_available(&self) -> Option<CrossProcessInstant>
pub fn set_first_paint( &self, paint_time: CrossProcessInstant, first_reflow: bool, )
pub fn set_first_contentful_paint( &self, paint_time: CrossProcessInstant, first_reflow: bool, )
pub fn maybe_set_tti(&self, metric: InteractiveFlag)
pub fn get_tti(&self) -> Option<CrossProcessInstant>
pub fn needs_tti(&self) -> bool
pub fn time_profiler_chan(&self) -> &ProfilerChan
Trait Implementations§
Source§impl MallocSizeOf for ProgressiveWebMetrics
impl MallocSizeOf for ProgressiveWebMetrics
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Auto Trait Implementations§
impl !Freeze for ProgressiveWebMetrics
impl !RefUnwindSafe for ProgressiveWebMetrics
impl Send for ProgressiveWebMetrics
impl !Sync for ProgressiveWebMetrics
impl Unpin for ProgressiveWebMetrics
impl UnwindSafe for ProgressiveWebMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert