Struct RefreshDriver

Source
pub(crate) struct RefreshDriver {
    pub(crate) constellation_sender: Sender<EmbedderToConstellationMessage>,
    pub(crate) animating: Cell<bool>,
    pub(crate) waiting_for_frame_timeout: Arc<AtomicBool>,
    timer_thread: TimerThread,
    event_loop_waker: Box<dyn EventLoopWaker>,
}
Expand description

The RefreshDriver is responsible for controlling updates to aall WebViews onscreen presentation. Currently, it only manages controlling animation update requests.

The implementation is very basic at the moment, only requesting new animation frames at a constant time after a repaint.

Fields§

§constellation_sender: Sender<EmbedderToConstellationMessage>

The channel on which messages can be sent to the Constellation.

§animating: Cell<bool>

Whether or not we are currently animating via a timer.

§waiting_for_frame_timeout: Arc<AtomicBool>

Whether or not we are waiting for our frame timeout to trigger

§timer_thread: TimerThread

A TimerThread which is used to schedule frame timeouts in the future.

§event_loop_waker: Box<dyn EventLoopWaker>

An EventLoopWaker to be used to wake up the embedder when it is time to paint a frame.

Implementations§

Source§

impl RefreshDriver

Source

pub(crate) fn new( constellation_sender: Sender<EmbedderToConstellationMessage>, event_loop_waker: Box<dyn EventLoopWaker>, ) -> Self

Source

fn timer_callback(&self) -> BoxedTimerCallback

Source

pub(crate) fn notify_will_paint( &self, webview_renderers: Values<'_, WebViewId, WebViewRenderer>, )

Notify the RefreshDriver that a paint is about to happen. This will trigger new animation frames for all active WebViews and schedule a new frame deadline.

Source

pub(crate) fn notify_animation_state_changed( &self, webview_renderer: &WebViewRenderer, )

Notify the RefreshDriver that the animation state of a particular WebView via its associated WebViewRenderer has changed. In the case that a WebView has started animating, the RefreshDriver will request a new frame from it immediately, but only render that frame at the next frame deadline.

Source

pub(crate) fn wait_to_paint(&self, repaint_reason: RepaintReason) -> bool

Whether or not the renderer should trigger a message to the embedder to request a repaint. This might be false if: we are animating and the repaint reason is just for a new frame. In that case, the renderer should wait until the frame timeout to ask the embedder to repaint.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> WasmNotSend for T
where T: Send,