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: TimerThreadA 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
impl RefreshDriver
pub(crate) fn new( constellation_sender: Sender<EmbedderToConstellationMessage>, event_loop_waker: Box<dyn EventLoopWaker>, ) -> Self
fn timer_callback(&self) -> BoxedTimerCallback
Sourcepub(crate) fn notify_will_paint(
&self,
webview_renderers: Values<'_, WebViewId, WebViewRenderer>,
)
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.
Sourcepub(crate) fn notify_animation_state_changed(
&self,
webview_renderer: &WebViewRenderer,
)
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.
Sourcepub(crate) fn wait_to_paint(&self, repaint_reason: RepaintReason) -> bool
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§
impl !Freeze for RefreshDriver
impl !RefUnwindSafe for RefreshDriver
impl Send for RefreshDriver
impl !Sync for RefreshDriver
impl Unpin for RefreshDriver
impl !UnwindSafe for RefreshDriver
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
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>
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>
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