pub struct ProcessIsolation { /* private fields */ }Expand description
Manages all tab processes and their isolation
Implementations§
Source§impl ProcessIsolation
impl ProcessIsolation
pub fn new() -> Self
Sourcepub fn spawn_tab_process(&mut self, tab_id: TabId) -> Result<(), TabError>
pub fn spawn_tab_process(&mut self, tab_id: TabId) -> Result<(), TabError>
Spawn a new tab process
Sourcepub fn spawn_with_capabilities(
&mut self,
tab_id: TabId,
capabilities: TabCapabilities,
) -> Result<(), TabError>
pub fn spawn_with_capabilities( &mut self, tab_id: TabId, capabilities: TabCapabilities, ) -> Result<(), TabError>
Spawn with custom capabilities
Sourcepub fn kill_tab_process(&mut self, tab_id: TabId) -> bool
pub fn kill_tab_process(&mut self, tab_id: TabId) -> bool
Kill a tab process
Sourcepub fn recover_from_crash(&mut self, tab_id: TabId) -> Result<(), TabError>
pub fn recover_from_crash(&mut self, tab_id: TabId) -> Result<(), TabError>
Recover a crashed tab process (recreate its context)
Sourcepub fn restrict_capabilities(
&mut self,
tab_id: TabId,
capabilities: TabCapabilities,
) -> bool
pub fn restrict_capabilities( &mut self, tab_id: TabId, capabilities: TabCapabilities, ) -> bool
Restrict capabilities for a tab
Sourcepub fn get_process(&self, tab_id: TabId) -> Option<&TabProcess>
pub fn get_process(&self, tab_id: TabId) -> Option<&TabProcess>
Get a tab process
Sourcepub fn get_process_mut(&mut self, tab_id: TabId) -> Option<&mut TabProcess>
pub fn get_process_mut(&mut self, tab_id: TabId) -> Option<&mut TabProcess>
Get a tab process mutably
Sourcepub fn post_message(
&mut self,
source: TabId,
target: TabId,
data: &str,
) -> Result<(), TabError>
pub fn post_message( &mut self, source: TabId, target: TabId, data: &str, ) -> Result<(), TabError>
Send postMessage from one tab to another
Sourcepub fn subscribe_broadcast(&mut self, tab_id: TabId, channel: &str) -> bool
pub fn subscribe_broadcast(&mut self, tab_id: TabId, channel: &str) -> bool
Subscribe a tab to a broadcast channel
Sourcepub fn unsubscribe_broadcast(&mut self, tab_id: TabId, channel: &str)
pub fn unsubscribe_broadcast(&mut self, tab_id: TabId, channel: &str)
Unsubscribe a tab from a broadcast channel
Sourcepub fn broadcast_message(
&mut self,
source: TabId,
channel: &str,
data: &str,
) -> usize
pub fn broadcast_message( &mut self, source: TabId, channel: &str, data: &str, ) -> usize
Send a broadcast message to all subscribers of a channel
Sourcepub fn storage_set(&mut self, origin: &str, key: &str, value: &str)
pub fn storage_set(&mut self, origin: &str, key: &str, value: &str)
Set a value in shared storage for an origin
Sourcepub fn storage_get(&self, origin: &str, key: &str) -> Option<&String>
pub fn storage_get(&self, origin: &str, key: &str) -> Option<&String>
Get a value from shared storage
Sourcepub fn storage_remove(&mut self, origin: &str, key: &str) -> Option<String>
pub fn storage_remove(&mut self, origin: &str, key: &str) -> Option<String>
Remove a value from shared storage
Sourcepub fn suspend_background_tabs(&mut self, active_tab: TabId)
pub fn suspend_background_tabs(&mut self, active_tab: TabId)
Suspend all background tab processes
Sourcepub fn resume_tab(&mut self, tab_id: TabId) -> bool
pub fn resume_tab(&mut self, tab_id: TabId) -> bool
Resume a specific tab process
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Number of active processes
Sourcepub fn total_count(&self) -> usize
pub fn total_count(&self) -> usize
Total number of processes
Sourcepub fn total_crashes(&self) -> usize
pub fn total_crashes(&self) -> usize
Total crashes across all tabs
Sourcepub fn resource_usage(&self, tab_id: TabId) -> Option<&ResourceUsage>
pub fn resource_usage(&self, tab_id: TabId) -> Option<&ResourceUsage>
Get resource usage for a tab
Sourcepub fn aggregate_usage(&self) -> ResourceUsage
pub fn aggregate_usage(&self) -> ResourceUsage
Get aggregate resource usage across all tabs