File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
packages/react-native/ReactCommon/react/renderer/mounting Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,12 @@ ShadowTreeRevision ShadowTree::getCurrentRevision() const {
389389
390390void ShadowTree::mount (ShadowTreeRevision revision, bool mountSynchronously)
391391 const {
392+ std::unique_lock<std::shared_mutex> lock;
393+ bool shouldLock = ReactNativeFeatureFlags::shadowTreeLockMountPhase ();
394+ if (shouldLock) {
395+ // TODO: can a mount cause another mount, so we have to care about reentrancy?
396+ lock = std::unique_lock<std::shared_mutex>(mountMutex_);
397+ }
392398 mountingCoordinator_->push (std::move (revision));
393399 delegate_.shadowTreeDidFinishTransaction (
394400 mountingCoordinator_, mountSynchronously);
Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ class ShadowTree final {
151151
152152 const SurfaceId surfaceId_;
153153 const ShadowTreeDelegate& delegate_;
154+ mutable std::shared_mutex mountMutex_;
154155 mutable std::shared_mutex commitMutex_;
155156 mutable std::recursive_mutex commitMutexRecursive_;
156157 mutable CommitMode commitMode_{
You can’t perform that action at this time.
0 commit comments