Skip to content

Commit 2f489a5

Browse files
committed
Broken progress
1 parent f107f8b commit 2f489a5

File tree

9 files changed

+121
-52
lines changed

9 files changed

+121
-52
lines changed

vnext/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,15 @@ void FabricUIManager::installFabricUIManager() noexcept {
108108
facebook::react::ComponentDescriptorParameters{eventDispatcher, contextContainer, nullptr}));
109109
return registry;
110110
};
111-
toolbox.runtimeExecutor = runtimeExecutor;
111+
112+
if (auto runtimeScheduler = SchedulerSettings::RuntimeSchedulerFromProperties(m_context.Properties())) {
113+
toolbox.runtimeExecutor = [runtimeScheduler](std::function<void(facebook::jsi::Runtime & runtime)> &&callback) {
114+
runtimeScheduler->scheduleWork(std::move(callback));
115+
};
116+
} else {
117+
toolbox.runtimeExecutor = runtimeExecutor;
118+
}
119+
112120
toolbox.asynchronousEventBeatFactory = asynchronousBeatFactory;
113121
toolbox.backgroundExecutor = [context = m_context,
114122
dispatcher = Mso::DispatchQueue::MakeLooperQueue()](std::function<void()> &&callback) {

vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
#include <CreateModules.h>
9090
#include <Utils/Helpers.h>
9191
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
92-
#include <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>
9392
#include "CrashManager.h"
9493
#include "JsiApi.h"
9594
#include "ReactCoreInjection.h"
@@ -564,11 +563,15 @@ void ReactInstanceWin::Initialize() noexcept {
564563
devSettings->useWebSocketTurboModule = winrt::unbox_value_or(useWebSocketTurboModulePropValue, false);
565564
auto bundleRootPath = devSettings->bundleRootPath;
566565
auto jsiRuntimeHolder = devSettings->jsiRuntimeHolder;
566+
auto instance = strongThis->m_instance.Load();
567+
const auto runtimeExecutor = instance->getRuntimeExecutor();
568+
const auto runtimeScheduler = std::make_shared<facebook::react::RuntimeScheduler>(runtimeExecutor);
567569
auto instanceWrapper = facebook::react::CreateReactInstance(
568-
std::shared_ptr<facebook::react::Instance>(strongThis->m_instance.Load()),
570+
std::move(instance),
569571
std::move(bundleRootPath), // bundleRootPath
570572
std::move(cxxModules),
571573
m_options.TurboModuleProvider,
574+
runtimeScheduler,
572575
m_options.TurboModuleProvider->LongLivedObjectCollection(),
573576
std::make_unique<BridgeUIBatchInstanceCallback>(weakThis),
574577
m_jsMessageThread.Load(),
@@ -596,12 +599,6 @@ void ReactInstanceWin::Initialize() noexcept {
596599

597600
if (winrt::Microsoft::ReactNative::implementation::QuirkSettings::GetUseRuntimeScheduler(
598601
winrt::Microsoft::ReactNative::ReactPropertyBag(reactContext->Properties()))) {
599-
std::shared_ptr<facebook::react::RuntimeScheduler> runtimeScheduler =
600-
std::make_shared<facebook::react::RuntimeScheduler>(
601-
instanceWrapper->GetInstance()->getRuntimeExecutor());
602-
603-
facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(
604-
*jsiRuntimeHolder->getRuntime().get(), runtimeScheduler);
605602
Microsoft::ReactNative::SchedulerSettings::SetRuntimeScheduler(
606603
ReactPropertyBag(reactContext->Properties()), runtimeScheduler);
607604
}

vnext/Microsoft.ReactNative/packages.lock.json

Lines changed: 68 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@
2424
"Microsoft.SourceLink.Common": "1.1.1"
2525
}
2626
},
27-
"Microsoft.UI.Xaml": {
28-
"type": "Direct",
29-
"requested": "[2.8.0, )",
30-
"resolved": "2.8.0",
31-
"contentHash": "vxdHxTr63s5KVtNddMFpgvjBjUH50z7seq/5jLWmmSuf8poxg+sXrywkofUdE8ZstbpO9y3FL/IXXUcPYbeesA==",
32-
"dependencies": {
33-
"Microsoft.Web.WebView2": "1.0.1264.42"
34-
}
35-
},
3627
"Microsoft.Windows.CppWinRT": {
3728
"type": "Direct",
3829
"requested": "[2.0.211028.7, )",
3930
"resolved": "2.0.211028.7",
4031
"contentHash": "JBGI0c3WLoU6aYJRy9Qo0MLDQfObEp+d4nrhR95iyzf7+HOgjRunHDp/6eGFREd7xq3OI1mll9ecJrMfzBvlyg=="
4132
},
33+
"Microsoft.WindowsAppSDK": {
34+
"type": "Direct",
35+
"requested": "[1.4.230913002, )",
36+
"resolved": "1.4.230913002",
37+
"contentHash": "l+9RshN4TsTuxL0ijFp5smbs3Y07RO7CxKBHNM/RsrsGtWvuk6edITMp4oqL9C3ufEAmpYk3dqOZRSf+sFH4Zg==",
38+
"dependencies": {
39+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.1"
40+
}
41+
},
4242
"Microsoft.Build.Tasks.Git": {
4343
"type": "Transitive",
4444
"resolved": "1.1.1",
@@ -49,10 +49,10 @@
4949
"resolved": "1.1.1",
5050
"contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg=="
5151
},
52-
"Microsoft.Web.WebView2": {
52+
"Microsoft.Windows.SDK.BuildTools": {
5353
"type": "Transitive",
54-
"resolved": "1.0.1264.42",
55-
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
54+
"resolved": "10.0.22621.1",
55+
"contentHash": "Sp1DkYvg7yxuhamwxv+qFC66KC3paKQpwK8Q1J6XuAh6nzXIInmsDcpJ3szr0XGud4ysXojqwTfGdW01gvZ/0g=="
5656
},
5757
"common": {
5858
"type": "Project"
@@ -76,52 +76,80 @@
7676
}
7777
},
7878
"native,Version=v0.0/win10-arm": {
79-
"Microsoft.Web.WebView2": {
80-
"type": "Transitive",
81-
"resolved": "1.0.1264.42",
82-
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
79+
"Microsoft.WindowsAppSDK": {
80+
"type": "Direct",
81+
"requested": "[1.4.230913002, )",
82+
"resolved": "1.4.230913002",
83+
"contentHash": "l+9RshN4TsTuxL0ijFp5smbs3Y07RO7CxKBHNM/RsrsGtWvuk6edITMp4oqL9C3ufEAmpYk3dqOZRSf+sFH4Zg==",
84+
"dependencies": {
85+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.1"
86+
}
8387
}
8488
},
8589
"native,Version=v0.0/win10-arm-aot": {
86-
"Microsoft.Web.WebView2": {
87-
"type": "Transitive",
88-
"resolved": "1.0.1264.42",
89-
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
90+
"Microsoft.WindowsAppSDK": {
91+
"type": "Direct",
92+
"requested": "[1.4.230913002, )",
93+
"resolved": "1.4.230913002",
94+
"contentHash": "l+9RshN4TsTuxL0ijFp5smbs3Y07RO7CxKBHNM/RsrsGtWvuk6edITMp4oqL9C3ufEAmpYk3dqOZRSf+sFH4Zg==",
95+
"dependencies": {
96+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.1"
97+
}
9098
}
9199
},
92100
"native,Version=v0.0/win10-arm64-aot": {
93-
"Microsoft.Web.WebView2": {
94-
"type": "Transitive",
95-
"resolved": "1.0.1264.42",
96-
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
101+
"Microsoft.WindowsAppSDK": {
102+
"type": "Direct",
103+
"requested": "[1.4.230913002, )",
104+
"resolved": "1.4.230913002",
105+
"contentHash": "l+9RshN4TsTuxL0ijFp5smbs3Y07RO7CxKBHNM/RsrsGtWvuk6edITMp4oqL9C3ufEAmpYk3dqOZRSf+sFH4Zg==",
106+
"dependencies": {
107+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.1"
108+
}
97109
}
98110
},
99111
"native,Version=v0.0/win10-x64": {
100-
"Microsoft.Web.WebView2": {
101-
"type": "Transitive",
102-
"resolved": "1.0.1264.42",
103-
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
112+
"Microsoft.WindowsAppSDK": {
113+
"type": "Direct",
114+
"requested": "[1.4.230913002, )",
115+
"resolved": "1.4.230913002",
116+
"contentHash": "l+9RshN4TsTuxL0ijFp5smbs3Y07RO7CxKBHNM/RsrsGtWvuk6edITMp4oqL9C3ufEAmpYk3dqOZRSf+sFH4Zg==",
117+
"dependencies": {
118+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.1"
119+
}
104120
}
105121
},
106122
"native,Version=v0.0/win10-x64-aot": {
107-
"Microsoft.Web.WebView2": {
108-
"type": "Transitive",
109-
"resolved": "1.0.1264.42",
110-
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
123+
"Microsoft.WindowsAppSDK": {
124+
"type": "Direct",
125+
"requested": "[1.4.230913002, )",
126+
"resolved": "1.4.230913002",
127+
"contentHash": "l+9RshN4TsTuxL0ijFp5smbs3Y07RO7CxKBHNM/RsrsGtWvuk6edITMp4oqL9C3ufEAmpYk3dqOZRSf+sFH4Zg==",
128+
"dependencies": {
129+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.1"
130+
}
111131
}
112132
},
113133
"native,Version=v0.0/win10-x86": {
114-
"Microsoft.Web.WebView2": {
115-
"type": "Transitive",
116-
"resolved": "1.0.1264.42",
117-
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
134+
"Microsoft.WindowsAppSDK": {
135+
"type": "Direct",
136+
"requested": "[1.4.230913002, )",
137+
"resolved": "1.4.230913002",
138+
"contentHash": "l+9RshN4TsTuxL0ijFp5smbs3Y07RO7CxKBHNM/RsrsGtWvuk6edITMp4oqL9C3ufEAmpYk3dqOZRSf+sFH4Zg==",
139+
"dependencies": {
140+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.1"
141+
}
118142
}
119143
},
120144
"native,Version=v0.0/win10-x86-aot": {
121-
"Microsoft.Web.WebView2": {
122-
"type": "Transitive",
123-
"resolved": "1.0.1264.42",
124-
"contentHash": "7OBUTkzQ5VI/3gb0ufi5U4zjuCowAJwQg2li0zXXzqkM+S1kmOlivTy1R4jAW+gY5Vyg510M+qMAESCQUjrfgA=="
145+
"Microsoft.WindowsAppSDK": {
146+
"type": "Direct",
147+
"requested": "[1.4.230913002, )",
148+
"resolved": "1.4.230913002",
149+
"contentHash": "l+9RshN4TsTuxL0ijFp5smbs3Y07RO7CxKBHNM/RsrsGtWvuk6edITMp4oqL9C3ufEAmpYk3dqOZRSf+sFH4Zg==",
150+
"dependencies": {
151+
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.1"
152+
}
125153
}
126154
}
127155
}

vnext/Shared/InstanceManager.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
3131
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
3232
&&cxxModules,
3333
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
34+
std::shared_ptr<RuntimeScheduler> runtimeScheduler,
3435
std::unique_ptr<InstanceCallback> &&callback,
3536
std::shared_ptr<MessageQueueThread> jsQueue,
3637
std::shared_ptr<MessageQueueThread> nativeQueue,
@@ -41,6 +42,7 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
4142
std::move(jsBundleBasePath),
4243
std::move(cxxModules),
4344
std::move(turboModuleRegistry),
45+
std::move(runtimeScheduler),
4446
nullptr,
4547
std::move(callback),
4648
std::move(jsQueue),
@@ -58,6 +60,7 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
5860
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
5961
&&cxxModules,
6062
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
63+
std::shared_ptr<RuntimeScheduler> runtimeScheduler,
6164
std::shared_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
6265
std::unique_ptr<InstanceCallback> &&callback,
6366
std::shared_ptr<MessageQueueThread> jsQueue,
@@ -69,6 +72,7 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
6972
std::move(jsBundleBasePath),
7073
std::move(cxxModules),
7174
std::move(turboModuleRegistry),
75+
std::move(runtimeScheduler),
7276
std::move(longLivedObjectCollection),
7377
std::move(callback),
7478
std::move(jsQueue),
@@ -87,6 +91,7 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
8791
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
8892
&&cxxModules,
8993
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
94+
std::shared_ptr<RuntimeScheduler> runtimeScheduler,
9095
std::unique_ptr<InstanceCallback> &&callback,
9196
std::shared_ptr<MessageQueueThread> jsQueue,
9297
std::shared_ptr<MessageQueueThread> nativeQueue,
@@ -98,6 +103,7 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
98103
std::move(jsBundleRelativePath),
99104
std::move(cxxModules),
100105
std::move(turboModuleRegistry),
106+
std::move(runtimeScheduler),
101107
std::move(callback),
102108
std::move(jsQueue),
103109
std::move(nativeQueue),

vnext/Shared/InstanceManager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class MessageQueueThread;
2828
class ModuleRegistry;
2929
class IUIManager;
3030
class TurboModuleRegistry;
31+
class RuntimeScheduler;
3132

3233
struct InstanceWrapper {
3334
virtual const std::shared_ptr<Instance> &GetInstance() const noexcept = 0;
@@ -47,6 +48,7 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
4748
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
4849
&&cxxModules,
4950
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
51+
std::shared_ptr<RuntimeScheduler> runtimeScheduler,
5052
std::unique_ptr<InstanceCallback> &&callback,
5153
std::shared_ptr<MessageQueueThread> jsQueue,
5254
std::shared_ptr<MessageQueueThread> nativeQueue,
@@ -59,6 +61,7 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
5961
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
6062
&&cxxModules,
6163
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
64+
std::shared_ptr<RuntimeScheduler> runtimeScheduler,
6265
std::shared_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
6366
std::unique_ptr<InstanceCallback> &&callback,
6467
std::shared_ptr<MessageQueueThread> jsQueue,
@@ -73,6 +76,7 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
7376
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
7477
&&cxxModules,
7578
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
79+
std::shared_ptr<RuntimeScheduler> runtimeScheduler,
7680
std::unique_ptr<InstanceCallback> &&callback,
7781
std::shared_ptr<MessageQueueThread> jsQueue,
7882
std::shared_ptr<MessageQueueThread> nativeQueue,

0 commit comments

Comments
 (0)