pub struct MobileSessionLifecycle { /* private fields */ }Expand description
Generation-stamped mobile host session lifecycle coordinator guarding same-process exit and re-entry races.
Implementations§
Source§impl MobileSessionLifecycle
Generation-stamped same-process session lifecycle helpers for MobileSessionLifecycle.
impl MobileSessionLifecycle
Generation-stamped same-process session lifecycle helpers for MobileSessionLifecycle.
Sourcepub fn begin_session(&mut self, owner_id: u64) -> u64
pub fn begin_session(&mut self, owner_id: u64) -> u64
Sourcepub fn activate_session(&mut self, owner_id: u64, session_gen: u64) -> bool
pub fn activate_session(&mut self, owner_id: u64, session_gen: u64) -> bool
Re-claims bridge ownership when owner_id resumes and is either the latest session or the previous owner cleared.
§Arguments
&Self- Mutable lifecycle coordinator.u64- Resuming host activity or scene identifier.u64- Generation originally assigned toowner_id.
§Returns
bool-truewhenowner_idholds active bridge ownership after the call.
Sourcepub fn end_session(&mut self, owner_id: u64, session_gen: u64) -> bool
pub fn end_session(&mut self, owner_id: u64, session_gen: u64) -> bool
Ends owner_id’s session only when (owner_id, session_gen) still owns the bridge, preventing delayed teardown races.
§Arguments
&Self- Mutable lifecycle coordinator.u64- Destroying host activity or scene identifier.u64- Generation originally assigned toowner_id.
§Returns
bool-truewhen ownership belonged toowner_idand was cleared;falsewhen a newer session already replaced it.
Sourcepub fn is_active_owner(&self, owner_id: u64, session_gen: u64) -> bool
pub fn is_active_owner(&self, owner_id: u64, session_gen: u64) -> bool
Returns true when (owner_id, session_gen) is currently the authoritative foreground bridge owner.
§Arguments
&Self- Lifecycle coordinator reference.u64- Host activity or scene identifier.u64- Generation assigned toowner_id.
§Returns
bool-truewhenowner_idmatches the active generation and owner.
Sourcepub fn active_session_generation(&self) -> u64
pub fn active_session_generation(&self) -> u64
Sourcepub fn active_owner_id(&self) -> u64
pub fn active_owner_id(&self) -> u64
Sourcepub fn loop_generation(&self) -> u64
pub fn loop_generation(&self) -> u64
Sourcepub fn is_loop_running(&self) -> bool
pub fn is_loop_running(&self) -> bool
Sourcepub fn is_surface_attached(&self) -> bool
pub fn is_surface_attached(&self) -> bool
Sourcepub fn should_recreate_handle(&self) -> bool
pub fn should_recreate_handle(&self) -> bool
Sourcepub fn on_surface_created(&mut self)
pub fn on_surface_created(&mut self)
Marks the active session’s surface attached and recreates the live running state if needed.
§Arguments
&Self- Mutable lifecycle coordinator.
Sourcepub fn on_surface_destroyed(&mut self, wid: WindowId) -> Vec<WindowEvent>
pub fn on_surface_destroyed(&mut self, wid: WindowId) -> Vec<WindowEvent>
Sourcepub fn on_pause(&mut self, wid: WindowId) -> Vec<WindowEvent>
pub fn on_pause(&mut self, wid: WindowId) -> Vec<WindowEvent>
Sourcepub fn on_background(&mut self)
pub fn on_background(&mut self)
Marks the active session background-frozen with the VSync loop halted.
§Arguments
&Self- Mutable lifecycle coordinator.
Sourcepub fn on_terminate(&mut self)
pub fn on_terminate(&mut self)
Records a double-back exit request or OS termination so subsequent re-entry recreates a fresh native handle.
§Arguments
&Self- Mutable lifecycle coordinator.