mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Aligning UIManager::startSurface and UIManager::stopSurface signatures
Summary: In the previous diff, we moved the destruction of a ShadowTree object from `UIManager::stopSurface` method. And the next logical step is to align `UIManager::startSurface` method with the symmetrical approach. Now `stopSurface` accepts a unique pointer to a ShadowTree and `stopSurface` returns it back to the caller; this way we can avoid returning a raw pointer from `startSurface`. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D27010533 fbshipit-source-id: b9211fb7e67763cc190d6b8c86cb866d20c6693d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
563b42bab4
commit
3dd92513c5
@@ -68,12 +68,16 @@ void SurfaceHandler::start() const noexcept {
|
||||
parameters = parameters_;
|
||||
}
|
||||
|
||||
link_.shadowTree = &link_.uiManager->startSurface(
|
||||
auto shadowTree = std::make_unique<ShadowTree>(
|
||||
parameters.surfaceId,
|
||||
parameters.moduleName,
|
||||
parameters.props,
|
||||
parameters.layoutConstraints,
|
||||
parameters.layoutContext);
|
||||
parameters.layoutContext,
|
||||
*link_.uiManager);
|
||||
|
||||
link_.shadowTree = shadowTree.get();
|
||||
|
||||
link_.uiManager->startSurface(
|
||||
std::move(shadowTree), parameters.moduleName, parameters.props);
|
||||
|
||||
link_.status = Status::Running;
|
||||
|
||||
|
||||
@@ -146,17 +146,13 @@ void UIManager::setIsJSResponder(
|
||||
}
|
||||
}
|
||||
|
||||
ShadowTree const &UIManager::startSurface(
|
||||
SurfaceId surfaceId,
|
||||
void UIManager::startSurface(
|
||||
ShadowTree::Unique &&shadowTree,
|
||||
std::string const &moduleName,
|
||||
folly::dynamic const &props,
|
||||
LayoutConstraints const &layoutConstraints,
|
||||
LayoutContext const &layoutContext) const {
|
||||
folly::dynamic const &props) const {
|
||||
SystraceSection s("UIManager::startSurface");
|
||||
|
||||
auto shadowTree = std::make_unique<ShadowTree>(
|
||||
surfaceId, layoutConstraints, layoutContext, *this);
|
||||
auto shadowTreePointer = shadowTree.get();
|
||||
auto surfaceId = shadowTree->getSurfaceId();
|
||||
shadowTreeRegistry_.add(std::move(shadowTree));
|
||||
|
||||
runtimeExecutor_([=](jsi::Runtime &runtime) {
|
||||
@@ -167,8 +163,6 @@ ShadowTree const &UIManager::startSurface(
|
||||
|
||||
uiManagerBinding->startSurface(runtime, surfaceId, moduleName, props);
|
||||
});
|
||||
|
||||
return *shadowTreePointer;
|
||||
}
|
||||
|
||||
ShadowTree::Unique UIManager::stopSurface(SurfaceId surfaceId) const {
|
||||
|
||||
@@ -85,12 +85,10 @@ class UIManager final : public ShadowTreeDelegate {
|
||||
|
||||
#pragma mark - Surface Start & Stop
|
||||
|
||||
ShadowTree const &startSurface(
|
||||
SurfaceId surfaceId,
|
||||
void startSurface(
|
||||
ShadowTree::Unique &&shadowTree,
|
||||
std::string const &moduleName,
|
||||
folly::dynamic const &props,
|
||||
LayoutConstraints const &layoutConstraints,
|
||||
LayoutContext const &layoutContext) const;
|
||||
folly::dynamic const &props) const;
|
||||
|
||||
ShadowTree::Unique stopSurface(SurfaceId surfaceId) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user