mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-17 06:08:26 +00:00
chore: clean up scopes
This commit is contained in:
parent
a4ea0ba4fe
commit
9dda7b168b
2 changed files with 3 additions and 8 deletions
|
@ -213,9 +213,7 @@ impl ScopeArena {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn collect_garbage(&self, id: ElementId) {
|
pub fn collect_garbage(&self, id: ElementId) {
|
||||||
let node = self.nodes.borrow_mut().get(id.0).unwrap().clone();
|
self.nodes.borrow_mut().remove(id.0);
|
||||||
// let node = self.nodes.borrow_mut().remove(id.0);
|
|
||||||
// log::debug!("collecting garbage for {:?}, {:?}", id, unsafe { &*node });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This method cleans up any references to data held within our hook list. This prevents mutable aliasing from
|
/// This method cleans up any references to data held within our hook list. This prevents mutable aliasing from
|
||||||
|
@ -231,8 +229,6 @@ impl ScopeArena {
|
||||||
/// This also makes sure that drop order is consistent and predictable. All resources that rely on being dropped will
|
/// This also makes sure that drop order is consistent and predictable. All resources that rely on being dropped will
|
||||||
/// be dropped.
|
/// be dropped.
|
||||||
pub(crate) fn ensure_drop_safety(&self, scope_id: ScopeId) {
|
pub(crate) fn ensure_drop_safety(&self, scope_id: ScopeId) {
|
||||||
// log::trace!("Ensuring drop safety for scope {:?}", scope_id);
|
|
||||||
|
|
||||||
if let Some(scope) = self.get_scope(scope_id) {
|
if let Some(scope) = self.get_scope(scope_id) {
|
||||||
let mut items = scope.items.borrow_mut();
|
let mut items = scope.items.borrow_mut();
|
||||||
|
|
||||||
|
@ -243,7 +239,6 @@ impl ScopeArena {
|
||||||
if let Some(scope_id) = comp.scope.get() {
|
if let Some(scope_id) = comp.scope.get() {
|
||||||
self.ensure_drop_safety(scope_id);
|
self.ensure_drop_safety(scope_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
drop(comp.props.take());
|
drop(comp.props.take());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -449,6 +449,7 @@ impl VirtualDom {
|
||||||
/// apply_mutations(mutations);
|
/// apply_mutations(mutations);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[allow(unused)]
|
||||||
pub fn work_with_deadline(&mut self, mut deadline: impl FnMut() -> bool) -> Vec<Mutations> {
|
pub fn work_with_deadline(&mut self, mut deadline: impl FnMut() -> bool) -> Vec<Mutations> {
|
||||||
let mut committed_mutations = vec![];
|
let mut committed_mutations = vec![];
|
||||||
|
|
||||||
|
@ -487,13 +488,12 @@ impl VirtualDom {
|
||||||
|
|
||||||
committed_mutations.push(mutations);
|
committed_mutations.push(mutations);
|
||||||
|
|
||||||
|
// todo: pause the diff machine
|
||||||
// if diff_state.work(&mut deadline) {
|
// if diff_state.work(&mut deadline) {
|
||||||
// let DiffState { mutations, .. } = diff_state;
|
// let DiffState { mutations, .. } = diff_state;
|
||||||
|
|
||||||
// for scope in &mutations.dirty_scopes {
|
// for scope in &mutations.dirty_scopes {
|
||||||
// self.dirty_scopes.remove(scope);
|
// self.dirty_scopes.remove(scope);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// committed_mutations.push(mutations);
|
// committed_mutations.push(mutations);
|
||||||
// } else {
|
// } else {
|
||||||
// // leave the work in an incomplete state
|
// // leave the work in an incomplete state
|
||||||
|
|
Loading…
Add table
Reference in a new issue