diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h index 427f443e21d..3aec94a6f42 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h +++ b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h @@ -83,7 +83,7 @@ class LayoutableShadowNode : public virtual Sealable { /* * Clean or Dirty layout state: * Indicates whether all nodes (and possibly their subtrees) along the path - * to the root node should be re-layouted. + * to the root node should be re-laid out. */ virtual void cleanLayout() = 0; virtual void dirtyLayout() = 0; diff --git a/ReactCommon/fabric/mounting/MountingCoordinator.cpp b/ReactCommon/fabric/mounting/MountingCoordinator.cpp index 47ecf719f55..9cb77d049ce 100644 --- a/ReactCommon/fabric/mounting/MountingCoordinator.cpp +++ b/ReactCommon/fabric/mounting/MountingCoordinator.cpp @@ -44,6 +44,11 @@ void MountingCoordinator::push(ShadowTreeRevision &&revision) const { } } +void MountingCoordinator::revoke() const { + std::lock_guard lock(mutex_); + lastRevision_.reset(); +} + better::optional MountingCoordinator::pullTransaction() const { std::lock_guard lock(mutex_); diff --git a/ReactCommon/fabric/mounting/MountingCoordinator.h b/ReactCommon/fabric/mounting/MountingCoordinator.h index 4fe2bddf310..9bbdda13532 100644 --- a/ReactCommon/fabric/mounting/MountingCoordinator.h +++ b/ReactCommon/fabric/mounting/MountingCoordinator.h @@ -60,6 +60,15 @@ class MountingCoordinator final { */ void push(ShadowTreeRevision &&revision) const; + /* + * Revokes the last pushed `ShadowTreeRevision`. + * Generating a `MountingTransaction` requires some resources which the + * `MountingCoordinator` does not own (e.g. `ComponentDescriptor`s). Revoking + * committed revisions allows the owner (a Shadow Tree) to make sure that + * those resources will not be accessed (e.g. by the Mouting Layer). + */ + void revoke() const; + private: SurfaceId const surfaceId_; diff --git a/ReactCommon/fabric/mounting/ShadowTree.cpp b/ReactCommon/fabric/mounting/ShadowTree.cpp index af08afd792b..57221095f62 100644 --- a/ReactCommon/fabric/mounting/ShadowTree.cpp +++ b/ReactCommon/fabric/mounting/ShadowTree.cpp @@ -116,6 +116,7 @@ ShadowTree::~ShadowTree() { /* .children = */ ShadowNode::emptySharedShadowNodeSharedList(), }); }); + mountingCoordinator_->revoke(); } Tag ShadowTree::getSurfaceId() const {