react-native-windows 0.69.4 → 0.69.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Microsoft.ReactNative/IReactNotificationService.cpp +197 -70
- package/Microsoft.ReactNative/IReactNotificationService.h +11 -30
- package/Microsoft.ReactNative/JSDispatcherWriter.cpp +60 -22
- package/Microsoft.ReactNative/JSDispatcherWriter.h +5 -3
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +3 -1
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +146 -84
- package/Microsoft.ReactNative/TurboModulesProvider.h +5 -0
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +13 -8
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +1 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +4 -2
- package/Microsoft.ReactNative.Cxx/JSI/LongLivedJsiValue.h +84 -0
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +1 -0
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +3 -0
- package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +6 -1
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/Shared/InstanceManager.cpp +29 -0
- package/Shared/InstanceManager.h +14 -0
- package/Shared/OInstance.cpp +13 -1
- package/Shared/OInstance.h +4 -13
- package/Shared/Threading/BatchingQueueThread.cpp +18 -12
- package/package.json +5 -5
package/Shared/InstanceManager.h
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#pragma once
|
|
5
5
|
|
|
6
6
|
#include <Logging.h>
|
|
7
|
+
#include <ReactCommon/LongLivedObject.h>
|
|
7
8
|
#include <cxxreact/CxxModule.h>
|
|
8
9
|
#include <cxxreact/JSBigString.h>
|
|
9
10
|
#include <map>
|
|
@@ -51,6 +52,19 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
|
|
|
51
52
|
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
52
53
|
std::shared_ptr<DevSettings> devSettings) noexcept;
|
|
53
54
|
|
|
55
|
+
std::shared_ptr<InstanceWrapper> CreateReactInstance(
|
|
56
|
+
std::shared_ptr<Instance> &&instance,
|
|
57
|
+
std::string &&jsBundleRelativePath,
|
|
58
|
+
std::vector<
|
|
59
|
+
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
|
|
60
|
+
&&cxxModules,
|
|
61
|
+
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
|
|
62
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
|
|
63
|
+
std::unique_ptr<InstanceCallback> &&callback,
|
|
64
|
+
std::shared_ptr<MessageQueueThread> jsQueue,
|
|
65
|
+
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
66
|
+
std::shared_ptr<DevSettings> devSettings) noexcept;
|
|
67
|
+
|
|
54
68
|
std::shared_ptr<InstanceWrapper> CreateReactInstance(
|
|
55
69
|
std::shared_ptr<Instance> &&instance,
|
|
56
70
|
std::string &&jsBundleBasePath,
|
package/Shared/OInstance.cpp
CHANGED
|
@@ -106,11 +106,13 @@ class OJSIExecutorFactory : public JSExecutorFactory {
|
|
|
106
106
|
auto turboModuleManager = std::make_shared<TurboModuleManager>(turboModuleRegistry_, jsCallInvoker_);
|
|
107
107
|
|
|
108
108
|
// TODO: The binding here should also add the proxys that convert cxxmodules into turbomodules
|
|
109
|
+
// [vmoroz] Note, that we must not use the RN TurboCxxModule.h code because it uses global LongLivedObjectCollection
|
|
110
|
+
// instance that prevents us from using multiple RN instance in the same process.
|
|
109
111
|
auto binding = [turboModuleManager](const std::string &name) -> std::shared_ptr<TurboModule> {
|
|
110
112
|
return turboModuleManager->getModule(name);
|
|
111
113
|
};
|
|
112
114
|
|
|
113
|
-
TurboModuleBinding::install(*runtimeHolder_->getRuntime(), std::function(binding));
|
|
115
|
+
TurboModuleBinding::install(*runtimeHolder_->getRuntime(), std::function(binding), longLivedObjectCollection_);
|
|
114
116
|
|
|
115
117
|
// init TurboModule
|
|
116
118
|
for (const auto &moduleName : turboModuleManager->getEagerInitModuleNames()) {
|
|
@@ -132,17 +134,20 @@ class OJSIExecutorFactory : public JSExecutorFactory {
|
|
|
132
134
|
std::shared_ptr<Microsoft::JSI::RuntimeHolderLazyInit> runtimeHolder,
|
|
133
135
|
NativeLoggingHook loggingHook,
|
|
134
136
|
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
|
|
137
|
+
std::shared_ptr<LongLivedObjectCollection> longLivedObjectCollection,
|
|
135
138
|
bool isProfilingEnabled,
|
|
136
139
|
std::shared_ptr<CallInvoker> jsCallInvoker) noexcept
|
|
137
140
|
: runtimeHolder_{std::move(runtimeHolder)},
|
|
138
141
|
loggingHook_{std::move(loggingHook)},
|
|
139
142
|
turboModuleRegistry_{std::move(turboModuleRegistry)},
|
|
143
|
+
longLivedObjectCollection_{std::move(longLivedObjectCollection)},
|
|
140
144
|
jsCallInvoker_{std::move(jsCallInvoker)},
|
|
141
145
|
isProfilingEnabled_{isProfilingEnabled} {}
|
|
142
146
|
|
|
143
147
|
private:
|
|
144
148
|
std::shared_ptr<Microsoft::JSI::RuntimeHolderLazyInit> runtimeHolder_;
|
|
145
149
|
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry_;
|
|
150
|
+
std::shared_ptr<LongLivedObjectCollection> longLivedObjectCollection_;
|
|
146
151
|
std::shared_ptr<CallInvoker> jsCallInvoker_;
|
|
147
152
|
NativeLoggingHook loggingHook_;
|
|
148
153
|
bool isProfilingEnabled_;
|
|
@@ -159,6 +164,7 @@ void logMarker(const facebook::react::ReactMarker::ReactMarkerId /*id*/, const c
|
|
|
159
164
|
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
|
|
160
165
|
&&cxxModules,
|
|
161
166
|
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
|
|
167
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
|
|
162
168
|
std::unique_ptr<InstanceCallback> &&callback,
|
|
163
169
|
std::shared_ptr<MessageQueueThread> jsQueue,
|
|
164
170
|
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
@@ -169,6 +175,7 @@ void logMarker(const facebook::react::ReactMarker::ReactMarkerId /*id*/, const c
|
|
|
169
175
|
std::move(jsBundleBasePath),
|
|
170
176
|
std::move(cxxModules),
|
|
171
177
|
std::move(turboModuleRegistry),
|
|
178
|
+
std::move(longLivedObjectCollection),
|
|
172
179
|
std::move(callback),
|
|
173
180
|
std::move(jsQueue),
|
|
174
181
|
std::move(nativeQueue),
|
|
@@ -198,6 +205,7 @@ void logMarker(const facebook::react::ReactMarker::ReactMarkerId /*id*/, const c
|
|
|
198
205
|
std::move(jsBundleBasePath),
|
|
199
206
|
std::move(cxxModules),
|
|
200
207
|
std::move(turboModuleRegistry),
|
|
208
|
+
nullptr,
|
|
201
209
|
std::move(callback),
|
|
202
210
|
std::move(jsQueue),
|
|
203
211
|
std::move(nativeQueue),
|
|
@@ -235,12 +243,14 @@ InstanceImpl::InstanceImpl(
|
|
|
235
243
|
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
|
|
236
244
|
&&cxxModules,
|
|
237
245
|
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
|
|
246
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
|
|
238
247
|
std::unique_ptr<InstanceCallback> &&callback,
|
|
239
248
|
std::shared_ptr<MessageQueueThread> jsQueue,
|
|
240
249
|
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
241
250
|
std::shared_ptr<DevSettings> devSettings,
|
|
242
251
|
std::shared_ptr<IDevSupportManager> devManager)
|
|
243
252
|
: m_turboModuleRegistry(std::move(turboModuleRegistry)),
|
|
253
|
+
m_longLivedObjectCollection(std::move(longLivedObjectCollection)),
|
|
244
254
|
m_jsThread(std::move(jsQueue)),
|
|
245
255
|
m_nativeQueue(nativeQueue),
|
|
246
256
|
m_jsBundleBasePath(std::move(jsBundleBasePath)),
|
|
@@ -301,6 +311,7 @@ InstanceImpl::InstanceImpl(
|
|
|
301
311
|
m_devSettings->jsiRuntimeHolder,
|
|
302
312
|
m_devSettings->loggingCallback,
|
|
303
313
|
m_turboModuleRegistry,
|
|
314
|
+
m_longLivedObjectCollection,
|
|
304
315
|
!m_devSettings->useFastRefresh,
|
|
305
316
|
m_innerInstance->getJSCallInvoker());
|
|
306
317
|
} else {
|
|
@@ -365,6 +376,7 @@ InstanceImpl::InstanceImpl(
|
|
|
365
376
|
m_devSettings->jsiRuntimeHolder,
|
|
366
377
|
m_devSettings->loggingCallback,
|
|
367
378
|
m_turboModuleRegistry,
|
|
379
|
+
m_longLivedObjectCollection,
|
|
368
380
|
!m_devSettings->useFastRefresh,
|
|
369
381
|
m_innerInstance->getJSCallInvoker());
|
|
370
382
|
}
|
package/Shared/OInstance.h
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#include "InstanceManager.h"
|
|
11
11
|
|
|
12
12
|
// React Native
|
|
13
|
+
#include <ReactCommon/LongLivedObject.h>
|
|
13
14
|
#include <cxxreact/Instance.h>
|
|
14
15
|
|
|
15
16
|
// Standard Libriary
|
|
@@ -32,6 +33,7 @@ class InstanceImpl final : public InstanceWrapper, private ::std::enable_shared_
|
|
|
32
33
|
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
|
|
33
34
|
&&cxxModules,
|
|
34
35
|
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
|
|
36
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
|
|
35
37
|
std::unique_ptr<InstanceCallback> &&callback,
|
|
36
38
|
std::shared_ptr<MessageQueueThread> jsQueue,
|
|
37
39
|
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
@@ -72,19 +74,7 @@ class InstanceImpl final : public InstanceWrapper, private ::std::enable_shared_
|
|
|
72
74
|
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
|
|
73
75
|
&&cxxModules,
|
|
74
76
|
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
|
|
75
|
-
std::
|
|
76
|
-
std::shared_ptr<MessageQueueThread> jsQueue,
|
|
77
|
-
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
78
|
-
std::shared_ptr<DevSettings> devSettings,
|
|
79
|
-
std::shared_ptr<IDevSupportManager> devManager);
|
|
80
|
-
|
|
81
|
-
InstanceImpl(
|
|
82
|
-
std::shared_ptr<Instance> &&instance,
|
|
83
|
-
std::string &&jsBundleBasePath,
|
|
84
|
-
std::string &&jsBundleRelativePath,
|
|
85
|
-
std::vector<
|
|
86
|
-
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
|
|
87
|
-
&&cxxModules,
|
|
77
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
|
|
88
78
|
std::unique_ptr<InstanceCallback> &&callback,
|
|
89
79
|
std::shared_ptr<MessageQueueThread> jsQueue,
|
|
90
80
|
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
@@ -102,6 +92,7 @@ class InstanceImpl final : public InstanceWrapper, private ::std::enable_shared_
|
|
|
102
92
|
std::string m_jsBundleBasePath;
|
|
103
93
|
std::shared_ptr<facebook::react::ModuleRegistry> m_moduleRegistry;
|
|
104
94
|
std::shared_ptr<TurboModuleRegistry> m_turboModuleRegistry;
|
|
95
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> m_longLivedObjectCollection;
|
|
105
96
|
std::shared_ptr<MessageQueueThread> m_jsThread;
|
|
106
97
|
std::shared_ptr<MessageQueueThread> m_nativeQueue;
|
|
107
98
|
|
|
@@ -69,19 +69,25 @@ BatchingQueueThread::BatchingQueueThread(
|
|
|
69
69
|
void BatchingQueueThread::decoratedNativeCallInvokerReady(
|
|
70
70
|
std::weak_ptr<facebook::react::Instance> wkInstance) noexcept {
|
|
71
71
|
std::scoped_lock lck(m_mutex);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
if (auto instance = wkInstance.lock()) {
|
|
73
|
+
// When items were queued in the undecoratedNativeCallInvoker it will not have called
|
|
74
|
+
// recordTurboModuleAsyncMethodCall. Calling invokeAsync on the decoratedNativeCallInvoker
|
|
75
|
+
// ensures that the queue is properly flushed, on the next batch complete
|
|
76
|
+
auto decoratedCallInvoker = instance->getDecoratedNativeCallInvoker(m_callInvoker);
|
|
77
|
+
decoratedCallInvoker->invokeAsync([decoratedCallInvoker, wkInstance, this] {
|
|
78
|
+
if (auto instance = wkInstance.lock()) {
|
|
79
|
+
std::scoped_lock lckQuitting(m_mutexQuitting);
|
|
80
|
+
|
|
81
|
+
// If we are shutting down, then then the mutex is being held in quitSynchronous
|
|
82
|
+
// Which is waiting for this task to complete, so we cannot take the mutex if quitSynchronous
|
|
83
|
+
// is running. -- and since we are shutting down anyway, we can just skip this work.
|
|
84
|
+
if (!m_quitting) {
|
|
85
|
+
std::scoped_lock lck(m_mutex);
|
|
86
|
+
m_callInvoker = decoratedCallInvoker;
|
|
87
|
+
}
|
|
82
88
|
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
BatchingQueueThread::~BatchingQueueThread() noexcept {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@react-native-community/cli": "^8.0.0",
|
|
27
27
|
"@react-native-community/cli-platform-android": "^8.0.0",
|
|
28
28
|
"@react-native-community/cli-platform-ios": "^8.0.0",
|
|
29
|
-
"@react-native-windows/cli": "0.69.
|
|
30
|
-
"@react-native-windows/virtualized-list": "0.69.
|
|
29
|
+
"@react-native-windows/cli": "0.69.3",
|
|
30
|
+
"@react-native-windows/virtualized-list": "0.69.1",
|
|
31
31
|
"@react-native/assets": "1.0.0",
|
|
32
32
|
"@react-native/normalize-color": "2.0.0",
|
|
33
33
|
"@react-native/polyfills": "2.0.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"ws": "^6.1.4"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@react-native-windows/codegen": "0.69.
|
|
64
|
+
"@react-native-windows/codegen": "0.69.1",
|
|
65
65
|
"@rnw-scripts/eslint-config": "1.1.12",
|
|
66
66
|
"@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.0.6",
|
|
67
67
|
"@rnw-scripts/metro-dev-config": "0.0.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"react-native": "^0.69.0"
|
|
89
89
|
},
|
|
90
90
|
"beachball": {
|
|
91
|
-
"defaultNpmTag": "
|
|
91
|
+
"defaultNpmTag": "v0.69-stable",
|
|
92
92
|
"gitTags": true,
|
|
93
93
|
"disallowedChangeTypes": [
|
|
94
94
|
"major",
|