Skip to content

Commit 6f9dbbe

Browse files
Replace ContextContainer::Shared with std::shared_ptr<const ContextContainer> (#14975)
* Replace ContextContainer::Shared with std::shared_ptr<const ContextContainer> This existing alias is deprecated now. See: : facebook/react-native#52889 * Change files * Fix change files * fix formatting --------- Co-authored-by: Jon Thysell <[email protected]>
1 parent 9690dfa commit 6f9dbbe

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Replace ContextContainer::Shared with std::shared_ptr<const ContextContainer>",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ FabricUIManager::~FabricUIManager() {
6666
void FabricUIManager::installFabricUIManager() noexcept {
6767
std::lock_guard<std::mutex> schedulerLock(m_schedulerMutex);
6868

69-
facebook::react::ContextContainer::Shared contextContainer = std::make_shared<facebook::react::ContextContainer>();
69+
std::shared_ptr<const facebook::react::ContextContainer> contextContainer =
70+
std::make_shared<facebook::react::ContextContainer>();
7071

7172
// This allows access to our ReactContext from the contextContainer thats passed around the fabric codebase
7273
contextContainer->insert("MSRN.ReactContext", m_context);
@@ -97,8 +98,9 @@ void FabricUIManager::installFabricUIManager() noexcept {
9798
};
9899

99100
toolbox.contextContainer = contextContainer;
100-
toolbox.componentRegistryFactory = [](facebook::react::EventDispatcher::Weak const &eventDispatcher,
101-
facebook::react::ContextContainer::Shared const &contextContainer)
101+
toolbox.componentRegistryFactory =
102+
[](facebook::react::EventDispatcher::Weak const &eventDispatcher,
103+
std::shared_ptr<const facebook::react::ContextContainer> const &contextContainer)
102104
-> facebook::react::ComponentDescriptorRegistry::Shared {
103105
auto providerRegistry =
104106
WindowsComponentDescriptorRegistry::FromProperties(

vnext/Microsoft.ReactNative/Fabric/ImageManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace facebook {
1010
namespace react {
1111

12-
ImageManager::ImageManager(ContextContainer::Shared const &contextContainer) {
12+
ImageManager::ImageManager(std::shared_ptr<const ContextContainer> const &contextContainer) {
1313
auto reactContext = *contextContainer->find<winrt::Microsoft::ReactNative::ReactContext>("MSRN.ReactContext");
1414
self_ = new Microsoft::ReactNative::WindowsImageManager(reactContext);
1515
}

vnext/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ class AttachmentInlineObject : public winrt::implements<AttachmentInlineObject,
6666
float m_height;
6767
};
6868

69-
TextLayoutManager::TextLayoutManager(const ContextContainer::Shared &contextContainer)
69+
TextLayoutManager::TextLayoutManager(const std::shared_ptr<const ContextContainer> &contextContainer)
7070
: contextContainer_(contextContainer), textMeasureCache_(kSimpleThreadSafeCacheSizeCap) {}
7171

72-
WindowsTextLayoutManager::WindowsTextLayoutManager(const ContextContainer::Shared &contextContainer)
72+
WindowsTextLayoutManager::WindowsTextLayoutManager(const std::shared_ptr<const ContextContainer> &contextContainer)
7373
: TextLayoutManager(contextContainer) {}
7474

7575
void WindowsTextLayoutManager::GetTextLayout(

vnext/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace facebook::react {
2020

2121
class WindowsTextLayoutManager : public TextLayoutManager {
2222
public:
23-
WindowsTextLayoutManager(const ContextContainer::Shared &contextContainer);
23+
WindowsTextLayoutManager(const std::shared_ptr<const ContextContainer> &contextContainer);
2424
virtual ~WindowsTextLayoutManager() = default;
2525

2626
/*

vnext/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace facebook::react {
2323
ComponentDescriptorRegistry::ComponentDescriptorRegistry(
2424
ComponentDescriptorParameters parameters,
2525
const ComponentDescriptorProviderRegistry& providerRegistry,
26-
ContextContainer::Shared contextContainer)
26+
std::shared_ptr<const ContextContainer> contextContainer)
2727
: parameters_(std::move(parameters)),
2828
providerRegistry_(providerRegistry),
2929
contextContainer_(std::move(contextContainer)) {}

0 commit comments

Comments
 (0)