Wip: pre-diffmachine merge fork

This commit is contained in:
Jonathan Kelley committed 2021-06-03 13:57:41 -04:00
1 parent 69f5cc3802
commit 424a18137f
8 files changed
+67 -231

No files matched your search

-135
View File
@@ -1007,138 +1007,3 @@ enum KeyedPrefixResult {
// the beginning of `new` and `old` we already processed.
MoreWorkToDo(usize),
}
mod support {
// // Get or create the template.
// //
// // Upon entering this function the change list stack may be in any shape:
// //
// // [...]
// //
// // When this function returns, it leaves a freshly cloned copy of the template
// // on the top of the change list stack:
// //
// // [... template]
// #[inline]
// pub fn get_or_create_template<'a>(// cached_set: &'a CachedSet,
// // change_list: &mut ChangeListBuilder,
// // registry: &mut EventsRegistry,
// // cached_roots: &mut FxHashSet<CacheId>,
// // template_id: CacheId,
// ) -> (&'a Node<'a>, bool) {
// let (template, template_template) = cached_set.get(template_id);
// debug_assert!(
// template_template.is_none(),
// "templates should not be templated themselves"
// );
// // If we haven't already created and saved the physical DOM subtree for this
// // template, do that now.
// if change_list.has_template(template_id) {
// // Clone the template and push it onto the stack.
// //
// // [...]
// change_list.push_template(template_id);
// // [... template]
// (template, true)
// } else {
// // [...]
// create(cached_set, change_list, registry, template, cached_roots);
// // [... template]
// change_list.save_template(template_id);
// // [... template]
// (template, false)
// }
// }
// pub fn create_and_replace(
// cached_set: &CachedSet,
// change_list: &mut ChangeListBuilder,
// registry: &mut EventsRegistry,
// new_template: Option<CacheId>,
// old: &Node,
// new: &Node,
// cached_roots: &mut FxHashSet<CacheId>,
// ) {
// debug_assert!(change_list.traversal_is_committed());
// if let Some(template_id) = new_template {
// let (template, needs_listeners) = get_or_create_template(
// cached_set,
// change_list,
// registry,
// cached_roots,
// template_id,
// );
// change_list.replace_with();
// let mut old_forcing = None;
// if needs_listeners {
// old_forcing = Some(change_list.push_force_new_listeners());
// }
// diff(
// cached_set,
// change_list,
// registry,
// template,
// new,
// cached_roots,
// );
// if let Some(old) = old_forcing {
// change_list.pop_force_new_listeners(old);
// }
// change_list.commit_traversal();
// } else {
// create(cached_set, change_list, registry, new, cached_roots);
// change_list.replace_with();
// }
// registry.remove_subtree(old);
// }
// pub fn create_with_template(
// cached_set: &CachedSet,
// change_list: &mut ChangeListBuilder,
// registry: &mut EventsRegistry,
// template_id: CacheId,
// node: &Node,
// cached_roots: &mut FxHashSet<CacheId>,
// ) {
// debug_assert!(change_list.traversal_is_committed());
// // [...]
// let (template, needs_listeners) =
// get_or_create_template(cached_set, change_list, registry, cached_roots, template_id);
// // [... template]
// // Now diff the node with its template.
// //
// // We must force adding new listeners instead of updating existing ones,
// // since listeners don't get cloned in `cloneNode`.
// let mut old_forcing = None;
// if needs_listeners {
// old_forcing = Some(change_list.push_force_new_listeners());
// }
// diff(
// cached_set,
// change_list,
// registry,
// template,
// node,
// cached_roots,
// );
// if let Some(old) = old_forcing {
// change_list.pop_force_new_listeners(old);
// }
// // Make sure that we come back up to the level we were at originally.
// change_list.commit_traversal();
// }
}