add sync behind a feature flag

This commit is contained in:
= committed 2022-12-11 17:31:15 -06:00
1 parent 0ac02cc893
commit 74e9d5977a
9 files changed
+137 -33

No files matched your search

+17 -2
View File
@@ -339,12 +339,12 @@ impl<S: State> RealDom<S> {
}
/// Update the state of the dom, after appling some mutations. This will keep the nodes in the dom up to date with their VNode counterparts.
pub fn update_state(
pub fn update_state_single_threaded(
&mut self,
nodes_updated: DirtyNodeStates,
ctx: SendAnyMap,
) -> FxDashSet<RealNodeId> {
S::update(nodes_updated, &mut self.tree, ctx)
S::update_single_threaded(nodes_updated, &mut self.tree, ctx)
}
/// Find all nodes that are listening for an event, sorted by there height in the dom progressing starting at the bottom and progressing up.
@@ -396,6 +396,21 @@ impl<S: State> RealDom<S> {
}
}
impl<S: State + Sync> RealDom<S>
where
Tree<Node<S>>: Sync,
{
/// Update the state of the dom, after appling some mutations. This will keep the nodes in the dom up to date with their VNode counterparts.
/// This will resolve the state in parallel
pub fn update_state(
&mut self,
nodes_updated: DirtyNodeStates,
ctx: SendAnyMap,
) -> FxDashSet<RealNodeId> {
S::update(nodes_updated, &mut self.tree, ctx)
}
}
impl<S: State> Deref for RealDom<S> {
type Target = Tree<Node<S>>;