mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove unique_ptr for globalRootComponentDescriptor (#50391)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50391 No need for the indirection here of a heap allocated pointer. Since we have the RootComponentDescriptor we generally don't need it in any other component registry. Changelog: [Internal] Reviewed By: philIip Differential Revision: D72058916 fbshipit-source-id: 0c29f26f4c56c4353eda251fe06a475e3b6085da
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f13c8a7417
commit
fdf396b964
@@ -167,10 +167,9 @@ ShadowTree::ShadowTree(
|
||||
const ShadowTreeDelegate& delegate,
|
||||
const ContextContainer& contextContainer)
|
||||
: surfaceId_(surfaceId), delegate_(delegate) {
|
||||
static auto globalRootComponentDescriptor =
|
||||
std::make_unique<const RootComponentDescriptor>(
|
||||
ComponentDescriptorParameters{
|
||||
EventDispatcher::Shared{}, nullptr, nullptr});
|
||||
static RootComponentDescriptor globalRootComponentDescriptor(
|
||||
ComponentDescriptorParameters{
|
||||
EventDispatcher::Shared{}, nullptr, nullptr});
|
||||
|
||||
const auto props = std::make_shared<const RootProps>(
|
||||
PropsParserContext{surfaceId, contextContainer},
|
||||
@@ -178,11 +177,11 @@ ShadowTree::ShadowTree(
|
||||
layoutConstraints,
|
||||
layoutContext);
|
||||
|
||||
auto family = globalRootComponentDescriptor->createFamily(
|
||||
auto family = globalRootComponentDescriptor.createFamily(
|
||||
{surfaceId, surfaceId, nullptr});
|
||||
|
||||
auto rootShadowNode = std::static_pointer_cast<const RootShadowNode>(
|
||||
globalRootComponentDescriptor->createShadowNode(
|
||||
globalRootComponentDescriptor.createShadowNode(
|
||||
ShadowNodeFragment{
|
||||
/* .props = */ props,
|
||||
},
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <react/renderer/components/root/RootComponentDescriptor.h>
|
||||
#include <react/renderer/components/root/RootShadowNode.h>
|
||||
#include <react/renderer/core/LayoutConstraints.h>
|
||||
#include <react/renderer/core/ReactPrimitives.h>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <ReactCommon/RuntimeExecutor.h>
|
||||
#include <react/performance/timeline/PerformanceEntryReporter.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
|
||||
#include <react/renderer/components/root/RootComponentDescriptor.h>
|
||||
#include <react/renderer/core/ComponentDescriptor.h>
|
||||
#include <react/renderer/core/EventEmitter.h>
|
||||
#include <react/renderer/core/EventListener.h>
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
#include <react/renderer/mounting/Differentiator.h>
|
||||
#include <react/renderer/mounting/stubs/stubs.h>
|
||||
|
||||
#include <react/renderer/components/root/RootComponentDescriptor.h>
|
||||
#include <react/renderer/components/view/ViewComponentDescriptor.h>
|
||||
|
||||
#include "Entropy.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
Reference in New Issue
Block a user