perf(web-surface): avoid snapshot clones on live ticks
This commit is contained in:
@@ -94,6 +94,14 @@ impl BrowserCore {
|
||||
self.set_active_profile_download_policy(DownloadPolicy::ask_every_time())
|
||||
}
|
||||
|
||||
pub fn profile_kind_for(&self, profile_id: &ProfileId) -> Result<ProfileKind, CoreError> {
|
||||
self.profiles
|
||||
.iter()
|
||||
.find(|profile| profile.id() == profile_id)
|
||||
.map(|profile| profile.kind().clone())
|
||||
.ok_or_else(|| CoreError::ProfileNotFound { id: profile_id.clone() })
|
||||
}
|
||||
|
||||
pub fn set_profile_sync_policy(
|
||||
&mut self,
|
||||
profile_id: &ProfileId,
|
||||
|
||||
@@ -50,6 +50,18 @@ impl BrowserCore {
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn site_permissions_for_profile_origin(
|
||||
&self,
|
||||
profile_id: &ProfileId,
|
||||
origin: &SiteOrigin,
|
||||
) -> Vec<SitePermissionEntry> {
|
||||
self.site_permissions
|
||||
.iter()
|
||||
.filter(|entry| entry.profile_id() == profile_id && entry.origin() == origin)
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(super) fn visible_site_permission_audit_events(&self) -> Vec<SitePermissionAuditEvent> {
|
||||
self.site_permission_audit_events
|
||||
.iter()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use ely_domain::BrowserTab;
|
||||
use ely_domain::TabId;
|
||||
|
||||
use super::BrowserCore;
|
||||
@@ -23,4 +24,13 @@ impl BrowserCore {
|
||||
}
|
||||
Ok(layout.panes().iter().map(|pane| pane.tab_id().clone()).collect())
|
||||
}
|
||||
|
||||
pub fn visible_content_tabs(&self) -> Result<Vec<BrowserTab>, CoreError> {
|
||||
let ids = self.visible_content_tab_ids()?;
|
||||
Ok(ids
|
||||
.iter()
|
||||
.filter_map(|id| self.tabs.iter().find(|tab| tab.id() == id))
|
||||
.cloned()
|
||||
.collect())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user