react-native-windows 0.0.0-canary.708 → 0.0.0-canary.709
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/CompositionContext.idl +31 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +494 -182
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.h +37 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper_emptyimpl.cpp +48 -9
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHelpers.h +34 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +3 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +16 -17
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -2
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +3 -4
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +2 -0
- package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +121 -44
- package/PropertySheets/External/Microsoft.ReactNative.Composition.Common.props +12 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppApp.props +24 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.CppApp.targets +20 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.props +14 -0
- package/PropertySheets/External/Microsoft.ReactNative.Composition.Package.targets +18 -0
- package/PropertySheets/External/Microsoft.ReactNative.WindowsSdk.Default.props +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/package.json +2 -2
- package/templates/cpp-app/metro.config.js +51 -0
- package/templates/cpp-app/template.config.js +118 -0
- package/templates/cpp-app/windows/ExperimentalFeatures.props +12 -0
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +284 -0
- package/templates/cpp-app/windows/MyApp/MyApp.h +3 -0
- package/templates/cpp-app/windows/MyApp/MyApp.ico +0 -0
- package/templates/cpp-app/windows/MyApp/MyApp.rc +0 -0
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +142 -0
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj.filters +55 -0
- package/templates/cpp-app/windows/MyApp/_gitignore +1 -0
- package/templates/cpp-app/windows/MyApp/pch.cpp +1 -0
- package/templates/cpp-app/windows/MyApp/pch.h +35 -0
- package/templates/cpp-app/windows/MyApp/resource.h +18 -0
- package/templates/cpp-app/windows/MyApp/small.ico +0 -0
- package/templates/cpp-app/windows/MyApp/targetver.h +8 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/LockScreenLogo.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/SplashScreen.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/Square150x150Logo.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/Square44x44Logo.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/Square44x44Logo.targetsize-24_altform-unplated.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/StoreLogo.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/Images/Wide310x150Logo.scale-200.png +0 -0
- package/templates/cpp-app/windows/MyApp.Package/MyApp.Package.wapproj +78 -0
- package/templates/cpp-app/windows/MyApp.Package/Package.appxmanifest +49 -0
- package/templates/cpp-app/windows/MyApp.sln +176 -0
- package/templates/cpp-app/windows/_gitignore +41 -0
|
@@ -9,12 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
using namespace winrt;
|
|
11
11
|
using namespace Windows::Foundation;
|
|
12
|
-
#ifndef USE_WINUI3
|
|
13
12
|
#include "winrt/Windows.System.h"
|
|
14
|
-
|
|
15
|
-
#
|
|
13
|
+
|
|
14
|
+
#ifdef USE_WINUI3
|
|
16
15
|
#include "winrt/Microsoft.UI.Dispatching.h"
|
|
17
|
-
using namespace Microsoft::UI::Dispatching;
|
|
18
16
|
#endif
|
|
19
17
|
|
|
20
18
|
namespace Mso {
|
|
@@ -67,29 +65,68 @@ struct ThreadSafeMap {
|
|
|
67
65
|
|
|
68
66
|
} // namespace
|
|
69
67
|
|
|
68
|
+
template <typename TDispatcherTraits>
|
|
70
69
|
struct UISchedulerWinRT;
|
|
71
70
|
|
|
71
|
+
template <typename TDispatcherTraits>
|
|
72
|
+
struct DispatcherTraits {};
|
|
73
|
+
|
|
74
|
+
template <typename TDispatcherTraits>
|
|
75
|
+
struct TaskDispatcherHandler;
|
|
76
|
+
|
|
77
|
+
struct WindowsTypeTag;
|
|
78
|
+
using WindowsTaskDispatcherHandler = TaskDispatcherHandler<DispatcherTraits<WindowsTypeTag>>;
|
|
79
|
+
|
|
80
|
+
template <>
|
|
81
|
+
struct DispatcherTraits<WindowsTypeTag> {
|
|
82
|
+
using DispatcherQueueHandler = Windows::System::DispatcherQueueHandler;
|
|
83
|
+
using DispatcherQueue = Windows::System::DispatcherQueue;
|
|
84
|
+
using DispatcherQueue_ShutdownCompleted_revoker = Windows::System::DispatcherQueue::ShutdownCompleted_revoker;
|
|
85
|
+
using TaskDispatcherHandler = WindowsTaskDispatcherHandler;
|
|
86
|
+
};
|
|
87
|
+
using WindowsDispatcherTraits = DispatcherTraits<WindowsTypeTag>;
|
|
88
|
+
|
|
89
|
+
#ifdef USE_WINUI3
|
|
90
|
+
struct MicrosoftTypeTag;
|
|
91
|
+
using MicrosoftTaskDispatcherHandler = TaskDispatcherHandler<DispatcherTraits<MicrosoftTypeTag>>;
|
|
92
|
+
|
|
93
|
+
template <>
|
|
94
|
+
struct DispatcherTraits<MicrosoftTypeTag> {
|
|
95
|
+
using DispatcherQueueHandler = Microsoft::UI::Dispatching::DispatcherQueueHandler;
|
|
96
|
+
using DispatcherQueue = Microsoft::UI::Dispatching::DispatcherQueue;
|
|
97
|
+
using DispatcherQueue_ShutdownCompleted_revoker =
|
|
98
|
+
Microsoft::UI::Dispatching::DispatcherQueue::ShutdownCompleted_revoker;
|
|
99
|
+
using TaskDispatcherHandler = MicrosoftTaskDispatcherHandler;
|
|
100
|
+
};
|
|
101
|
+
using MicrosoftDispatcherTraits = DispatcherTraits<MicrosoftTypeTag>;
|
|
102
|
+
|
|
103
|
+
#endif
|
|
104
|
+
|
|
72
105
|
//! TaskDispatcherHandler is a DispatcherQueueHandler delegate that we pass to DispatcherQueue.
|
|
73
106
|
//! We use custom ref counting to avoid extra memory allocations and to handle reference to DispatchTask.
|
|
74
|
-
|
|
75
|
-
|
|
107
|
+
template <typename TDispatcherTraits>
|
|
108
|
+
struct TaskDispatcherHandler final : impl::abi_t<typename TDispatcherTraits::DispatcherQueueHandler> {
|
|
109
|
+
TaskDispatcherHandler(UISchedulerWinRT<TDispatcherTraits> *scheduler) noexcept;
|
|
76
110
|
int32_t __stdcall QueryInterface(guid const &id, void **result) noexcept final;
|
|
77
111
|
uint32_t __stdcall AddRef() noexcept final;
|
|
78
112
|
uint32_t __stdcall Release() noexcept final;
|
|
79
113
|
int32_t __stdcall Invoke() noexcept final;
|
|
80
114
|
|
|
81
115
|
private:
|
|
82
|
-
UISchedulerWinRT *m_scheduler;
|
|
116
|
+
UISchedulerWinRT<TDispatcherTraits> *m_scheduler;
|
|
83
117
|
};
|
|
84
118
|
|
|
119
|
+
using WindowsTaskDispatcherHandler = TaskDispatcherHandler<DispatcherTraits<WindowsTypeTag>>;
|
|
120
|
+
|
|
121
|
+
template <typename TDispatcherTraits>
|
|
85
122
|
struct UISchedulerWinRT : Mso::UnknownObject<Mso::RefCountStrategy::WeakRef, IDispatchQueueScheduler> {
|
|
86
|
-
UISchedulerWinRT(DispatcherQueue &&dispatcher) noexcept;
|
|
123
|
+
UISchedulerWinRT(typename TDispatcherTraits::DispatcherQueue &&dispatcher) noexcept;
|
|
87
124
|
~UISchedulerWinRT() noexcept override;
|
|
88
125
|
|
|
89
126
|
uint32_t AddHandlerRef() noexcept;
|
|
90
127
|
uint32_t ReleaseHandlerRef() noexcept;
|
|
91
128
|
|
|
92
|
-
DispatcherQueueHandler MakeDispatcherQueueHandler() noexcept;
|
|
129
|
+
typename TDispatcherTraits::DispatcherQueueHandler MakeDispatcherQueueHandler() noexcept;
|
|
93
130
|
bool TryTakeTask(Mso::CntPtr<IDispatchQueueService> &queue, DispatchTask &task) noexcept;
|
|
94
131
|
|
|
95
132
|
static DispatchQueue GetOrCreateUIThreadQueue() noexcept;
|
|
@@ -120,8 +157,8 @@ struct UISchedulerWinRT : Mso::UnknownObject<Mso::RefCountStrategy::WeakRef, IDi
|
|
|
120
157
|
};
|
|
121
158
|
|
|
122
159
|
private:
|
|
123
|
-
DispatcherQueue m_dispatcher{nullptr};
|
|
124
|
-
TaskDispatcherHandler m_dispatcherHandler{this};
|
|
160
|
+
typename TDispatcherTraits::DispatcherQueue m_dispatcher{nullptr};
|
|
161
|
+
typename TDispatcherTraits::TaskDispatcherHandler m_dispatcherHandler{this};
|
|
125
162
|
ManualResetEvent m_terminationEvent;
|
|
126
163
|
ThreadMutex m_mutex;
|
|
127
164
|
Mso::WeakPtr<IDispatchQueueService> m_queue;
|
|
@@ -130,19 +167,22 @@ struct UISchedulerWinRT : Mso::UnknownObject<Mso::RefCountStrategy::WeakRef, IDi
|
|
|
130
167
|
uint32_t m_taskCount{0};
|
|
131
168
|
bool m_isShutdown{false};
|
|
132
169
|
std::thread::id m_threadId{std::this_thread::get_id()};
|
|
133
|
-
|
|
170
|
+
typename TDispatcherTraits::DispatcherQueue_ShutdownCompleted_revoker m_shutdownCompletedRevoker;
|
|
134
171
|
};
|
|
135
172
|
|
|
136
173
|
//=============================================================================
|
|
137
174
|
// TaskDispatcherHandler implementation
|
|
138
175
|
//=============================================================================
|
|
139
176
|
|
|
140
|
-
|
|
177
|
+
template <typename TDispatcherTraits>
|
|
178
|
+
TaskDispatcherHandler<TDispatcherTraits>::TaskDispatcherHandler(UISchedulerWinRT<TDispatcherTraits> *scheduler) noexcept
|
|
179
|
+
: m_scheduler{scheduler} {}
|
|
141
180
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
181
|
+
template <typename TDispatcherTraits>
|
|
182
|
+
int32_t __stdcall TaskDispatcherHandler<TDispatcherTraits>::QueryInterface(guid const &id, void **result) noexcept {
|
|
183
|
+
if (is_guid_of<typename TDispatcherTraits::DispatcherQueueHandler>(id) ||
|
|
184
|
+
is_guid_of<Windows::Foundation::IUnknown>(id) || is_guid_of<IAgileObject>(id)) {
|
|
185
|
+
*result = static_cast<impl::abi_t<typename TDispatcherTraits::DispatcherQueueHandler> *>(this);
|
|
146
186
|
AddRef();
|
|
147
187
|
return impl::error_ok;
|
|
148
188
|
}
|
|
@@ -155,15 +195,18 @@ int32_t __stdcall TaskDispatcherHandler::QueryInterface(guid const &id, void **r
|
|
|
155
195
|
return impl::error_no_interface;
|
|
156
196
|
}
|
|
157
197
|
|
|
158
|
-
|
|
198
|
+
template <typename TDispatcherTraits>
|
|
199
|
+
uint32_t __stdcall TaskDispatcherHandler<TDispatcherTraits>::AddRef() noexcept {
|
|
159
200
|
return m_scheduler->AddHandlerRef();
|
|
160
201
|
}
|
|
161
202
|
|
|
162
|
-
|
|
203
|
+
template <typename TDispatcherTraits>
|
|
204
|
+
uint32_t __stdcall TaskDispatcherHandler<TDispatcherTraits>::Release() noexcept {
|
|
163
205
|
return m_scheduler->ReleaseHandlerRef();
|
|
164
206
|
}
|
|
165
207
|
|
|
166
|
-
|
|
208
|
+
template <typename TDispatcherTraits>
|
|
209
|
+
int32_t __stdcall TaskDispatcherHandler<TDispatcherTraits>::Invoke() noexcept {
|
|
167
210
|
Mso::CntPtr<IDispatchQueueService> queue;
|
|
168
211
|
DispatchTask task;
|
|
169
212
|
if (m_scheduler->TryTakeTask(queue, task)) {
|
|
@@ -177,24 +220,29 @@ int32_t __stdcall TaskDispatcherHandler::Invoke() noexcept {
|
|
|
177
220
|
// UISchedulerWinRT implementation
|
|
178
221
|
//=============================================================================
|
|
179
222
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
223
|
+
template <typename TDispatcherTraits>
|
|
224
|
+
UISchedulerWinRT<TDispatcherTraits>::UISchedulerWinRT(typename TDispatcherTraits::DispatcherQueue &&dispatcher) noexcept
|
|
225
|
+
: m_dispatcher{std::move(dispatcher)} {
|
|
226
|
+
m_shutdownCompletedRevoker = m_dispatcher.ShutdownCompleted(
|
|
227
|
+
winrt::auto_revoke, [](typename TDispatcherTraits::DispatcherQueue const &, IInspectable const &) noexcept {
|
|
183
228
|
GetDispatchQueueRegistry().Remove(std::this_thread::get_id());
|
|
184
229
|
});
|
|
185
230
|
}
|
|
186
231
|
|
|
187
|
-
|
|
232
|
+
template <typename TDispatcherTraits>
|
|
233
|
+
UISchedulerWinRT<TDispatcherTraits>::~UISchedulerWinRT() noexcept {
|
|
188
234
|
GetDispatchQueueRegistry().Remove(m_threadId);
|
|
189
235
|
AwaitTermination();
|
|
190
236
|
}
|
|
191
237
|
|
|
192
|
-
|
|
238
|
+
template <typename TDispatcherTraits>
|
|
239
|
+
uint32_t UISchedulerWinRT<TDispatcherTraits>::AddHandlerRef() noexcept {
|
|
193
240
|
std::lock_guard lock{m_mutex};
|
|
194
241
|
return ++m_handlerRefCount;
|
|
195
242
|
}
|
|
196
243
|
|
|
197
|
-
|
|
244
|
+
template <typename TDispatcherTraits>
|
|
245
|
+
uint32_t UISchedulerWinRT<TDispatcherTraits>::ReleaseHandlerRef() noexcept {
|
|
198
246
|
Mso::CntPtr<UISchedulerWinRT> self;
|
|
199
247
|
CleanupContext context{this};
|
|
200
248
|
|
|
@@ -213,7 +261,10 @@ uint32_t UISchedulerWinRT::ReleaseHandlerRef() noexcept {
|
|
|
213
261
|
}
|
|
214
262
|
}
|
|
215
263
|
|
|
216
|
-
|
|
264
|
+
template <typename TDispatcherTraits>
|
|
265
|
+
bool UISchedulerWinRT<TDispatcherTraits>::TryTakeTask(
|
|
266
|
+
Mso::CntPtr<IDispatchQueueService> &queue,
|
|
267
|
+
DispatchTask &task) noexcept {
|
|
217
268
|
{
|
|
218
269
|
std::lock_guard lock{m_mutex};
|
|
219
270
|
VerifyElseCrashSz(m_taskCount, "Task count cannot be negative");
|
|
@@ -227,7 +278,9 @@ bool UISchedulerWinRT::TryTakeTask(Mso::CntPtr<IDispatchQueueService> &queue, Di
|
|
|
227
278
|
return false;
|
|
228
279
|
}
|
|
229
280
|
|
|
230
|
-
|
|
281
|
+
template <typename TDispatcherTraits>
|
|
282
|
+
typename TDispatcherTraits::DispatcherQueueHandler
|
|
283
|
+
UISchedulerWinRT<TDispatcherTraits>::MakeDispatcherQueueHandler() noexcept {
|
|
231
284
|
VerifyElseCrash(m_mutex.IsLockedByMe());
|
|
232
285
|
|
|
233
286
|
if (m_handlerRefCount == 0) {
|
|
@@ -238,22 +291,26 @@ DispatcherQueueHandler UISchedulerWinRT::MakeDispatcherQueueHandler() noexcept {
|
|
|
238
291
|
return {static_cast<void *>(&m_dispatcherHandler), take_ownership_from_abi};
|
|
239
292
|
}
|
|
240
293
|
|
|
241
|
-
|
|
294
|
+
template <typename TDispatcherTraits>
|
|
295
|
+
void UISchedulerWinRT<TDispatcherTraits>::InitializeScheduler(Mso::WeakPtr<IDispatchQueueService> &&queue) noexcept {
|
|
242
296
|
m_queue = std::move(queue);
|
|
243
297
|
}
|
|
244
298
|
|
|
245
|
-
|
|
299
|
+
template <typename TDispatcherTraits>
|
|
300
|
+
bool UISchedulerWinRT<TDispatcherTraits>::HasThreadAccess() noexcept {
|
|
246
301
|
// m_dispatcher.HasThreadAccess() is implemented only in Windows 19H1.
|
|
247
302
|
// We must use an alternative implementation.
|
|
248
303
|
return m_threadId == std::this_thread::get_id();
|
|
249
304
|
}
|
|
250
305
|
|
|
251
|
-
|
|
306
|
+
template <typename TDispatcherTraits>
|
|
307
|
+
bool UISchedulerWinRT<TDispatcherTraits>::IsSerial() noexcept {
|
|
252
308
|
return true;
|
|
253
309
|
}
|
|
254
310
|
|
|
255
|
-
|
|
256
|
-
|
|
311
|
+
template <typename TDispatcherTraits>
|
|
312
|
+
void UISchedulerWinRT<TDispatcherTraits>::Post() noexcept {
|
|
313
|
+
typename TDispatcherTraits::DispatcherQueueHandler handler;
|
|
257
314
|
{
|
|
258
315
|
std::lock_guard lock{m_mutex};
|
|
259
316
|
if (!m_isShutdown) {
|
|
@@ -267,7 +324,8 @@ void UISchedulerWinRT::Post() noexcept {
|
|
|
267
324
|
}
|
|
268
325
|
}
|
|
269
326
|
|
|
270
|
-
|
|
327
|
+
template <typename TDispatcherTraits>
|
|
328
|
+
void UISchedulerWinRT<TDispatcherTraits>::Shutdown() noexcept {
|
|
271
329
|
CleanupContext context{this};
|
|
272
330
|
{
|
|
273
331
|
std::lock_guard lock{m_mutex};
|
|
@@ -276,12 +334,14 @@ void UISchedulerWinRT::Shutdown() noexcept {
|
|
|
276
334
|
}
|
|
277
335
|
}
|
|
278
336
|
|
|
279
|
-
|
|
337
|
+
template <typename TDispatcherTraits>
|
|
338
|
+
void UISchedulerWinRT<TDispatcherTraits>::AwaitTermination() noexcept {
|
|
280
339
|
Shutdown();
|
|
281
340
|
m_terminationEvent.Wait();
|
|
282
341
|
}
|
|
283
342
|
|
|
284
|
-
|
|
343
|
+
template <typename TDispatcherTraits>
|
|
344
|
+
/*static*/ DispatchQueue UISchedulerWinRT<TDispatcherTraits>::GetOrCreateUIThreadQueue() noexcept {
|
|
285
345
|
std::thread::id threadId{std::this_thread::get_id()};
|
|
286
346
|
std::optional<Mso::WeakPtr<IDispatchQueueService>> weakQueue = GetDispatchQueueRegistry().Get(threadId);
|
|
287
347
|
DispatchQueue queue{weakQueue.value_or(nullptr).GetStrongPtr()};
|
|
@@ -289,9 +349,9 @@ void UISchedulerWinRT::AwaitTermination() noexcept {
|
|
|
289
349
|
return queue;
|
|
290
350
|
}
|
|
291
351
|
|
|
292
|
-
decltype(DispatcherQueue::GetForCurrentThread()) dispatcher{nullptr};
|
|
352
|
+
decltype(TDispatcherTraits::DispatcherQueue::GetForCurrentThread()) dispatcher{nullptr};
|
|
293
353
|
try {
|
|
294
|
-
dispatcher = DispatcherQueue::GetForCurrentThread();
|
|
354
|
+
dispatcher = TDispatcherTraits::DispatcherQueue::GetForCurrentThread();
|
|
295
355
|
} catch (winrt::hresult_error const &) {
|
|
296
356
|
}
|
|
297
357
|
|
|
@@ -305,7 +365,9 @@ void UISchedulerWinRT::AwaitTermination() noexcept {
|
|
|
305
365
|
return queue;
|
|
306
366
|
}
|
|
307
367
|
|
|
308
|
-
|
|
368
|
+
template <typename TDispatcherTraits>
|
|
369
|
+
/*static*/ typename UISchedulerWinRT<TDispatcherTraits>::DispatchQueueRegistry &
|
|
370
|
+
UISchedulerWinRT<TDispatcherTraits>::GetDispatchQueueRegistry() noexcept {
|
|
309
371
|
static std::recursive_mutex mutex;
|
|
310
372
|
static DispatchQueueRegistry registry{mutex};
|
|
311
373
|
return registry;
|
|
@@ -315,9 +377,13 @@ void UISchedulerWinRT::AwaitTermination() noexcept {
|
|
|
315
377
|
// UISchedulerWinRT::CleanupContext implementation
|
|
316
378
|
//=============================================================================
|
|
317
379
|
|
|
318
|
-
|
|
380
|
+
template <typename TDispatcherTraits>
|
|
381
|
+
UISchedulerWinRT<TDispatcherTraits>::CleanupContext::CleanupContext(
|
|
382
|
+
UISchedulerWinRT<TDispatcherTraits> *scheduler) noexcept
|
|
383
|
+
: m_scheduler{scheduler} {}
|
|
319
384
|
|
|
320
|
-
|
|
385
|
+
template <typename TDispatcherTraits>
|
|
386
|
+
UISchedulerWinRT<TDispatcherTraits>::CleanupContext::~CleanupContext() noexcept {
|
|
321
387
|
if (m_isTerminated) {
|
|
322
388
|
m_scheduler->m_terminationEvent.Set();
|
|
323
389
|
}
|
|
@@ -329,7 +395,8 @@ UISchedulerWinRT::CleanupContext::~CleanupContext() noexcept {
|
|
|
329
395
|
}
|
|
330
396
|
}
|
|
331
397
|
|
|
332
|
-
|
|
398
|
+
template <typename TDispatcherTraits>
|
|
399
|
+
void UISchedulerWinRT<TDispatcherTraits>::CleanupContext::CheckShutdown() noexcept {
|
|
333
400
|
// See if dispatcher queue released all handlers without invoking them.
|
|
334
401
|
if (m_scheduler->m_taskCount != 0 && m_scheduler->m_handlerRefCount == 0) {
|
|
335
402
|
m_isShutdown = true;
|
|
@@ -338,7 +405,8 @@ void UISchedulerWinRT::CleanupContext::CheckShutdown() noexcept {
|
|
|
338
405
|
}
|
|
339
406
|
}
|
|
340
407
|
|
|
341
|
-
|
|
408
|
+
template <typename TDispatcherTraits>
|
|
409
|
+
void UISchedulerWinRT<TDispatcherTraits>::CleanupContext::CheckTermination() noexcept {
|
|
342
410
|
m_isTerminated = m_scheduler->m_isShutdown && (m_scheduler->m_handlerRefCount == 0);
|
|
343
411
|
}
|
|
344
412
|
|
|
@@ -347,7 +415,16 @@ void UISchedulerWinRT::CleanupContext::CheckTermination() noexcept {
|
|
|
347
415
|
//=============================================================================
|
|
348
416
|
|
|
349
417
|
DispatchQueue DispatchQueueStatic::GetCurrentUIThreadQueue() noexcept {
|
|
350
|
-
|
|
418
|
+
DispatchQueue queue{nullptr};
|
|
419
|
+
#if USE_WINUI3
|
|
420
|
+
queue = UISchedulerWinRT<MicrosoftDispatcherTraits>::GetOrCreateUIThreadQueue();
|
|
421
|
+
if (!queue) {
|
|
422
|
+
#endif
|
|
423
|
+
queue = UISchedulerWinRT<WindowsDispatcherTraits>::GetOrCreateUIThreadQueue();
|
|
424
|
+
#if USE_WINUI3
|
|
425
|
+
}
|
|
426
|
+
#endif
|
|
427
|
+
return queue;
|
|
351
428
|
}
|
|
352
429
|
|
|
353
430
|
} // namespace Mso
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
Licensed under the MIT License.
|
|
5
|
+
|
|
6
|
+
This file will be consumed by ALL Win32 app and module projects (both inside
|
|
7
|
+
and outside of this repo) that build on top of Microsoft.ReactNative.
|
|
8
|
+
Do not make any changes here unless it applies to ALL such projects.
|
|
9
|
+
-->
|
|
10
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
11
|
+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Common.props" />
|
|
12
|
+
</Project>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
Licensed under the MIT License.
|
|
5
|
+
|
|
6
|
+
This file will be consumed by ALL Win32 C++ app projects (both inside
|
|
7
|
+
and outside of this repo) that build on top of Microsoft.ReactNative.
|
|
8
|
+
Do not make any changes here unless it applies to ALL such projects.
|
|
9
|
+
-->
|
|
10
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
11
|
+
<!-- Keeping this at the top of the imports ensures we can use the autolinking
|
|
12
|
+
process to set properties without having to edit the project file -->
|
|
13
|
+
<Import Project="$(ProjectDir)\AutolinkedNativeModules.g.props"
|
|
14
|
+
Condition="Exists('$(ProjectDir)\AutolinkedNativeModules.g.props')" />
|
|
15
|
+
|
|
16
|
+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Composition.Common.props" />
|
|
17
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Appx.props" />
|
|
18
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Autolink.props" />
|
|
19
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\Codegen.props" />
|
|
20
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.Cpp.props" />
|
|
21
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
|
|
22
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\CppAppConsumeCSharpModule.props" />
|
|
23
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\PackageVersionDefinitions.props" />
|
|
24
|
+
</Project>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
Licensed under the MIT License.
|
|
5
|
+
|
|
6
|
+
This file will be consumed by ALL Win32 C++ app projects (both inside
|
|
7
|
+
and outside of this repo) that build on top of Microsoft.ReactNative.
|
|
8
|
+
Do not make any changes here unless it applies to ALL such projects.
|
|
9
|
+
-->
|
|
10
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
11
|
+
<!-- Starting with the base of the UWP Cpp targets for now (until we need to start differentiating). -->
|
|
12
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppApp.targets" />
|
|
13
|
+
|
|
14
|
+
<ItemGroup>
|
|
15
|
+
<PackageReference Include="boost" Version="1.76.0.0" />
|
|
16
|
+
<PackageReference Include="Microsoft.Toolkit.Win32.UI.XamlApplication" Version="6.1.3" />
|
|
17
|
+
<PackageReference Include="Microsoft.VCRTForwarders.140" Version="1.0.2-rc" />
|
|
18
|
+
</ItemGroup>
|
|
19
|
+
|
|
20
|
+
</Project>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
Licensed under the MIT License.
|
|
5
|
+
|
|
6
|
+
This file will be consumed by ALL Win32 app and module projects (both inside
|
|
7
|
+
and outside of this repo) that build on top of Microsoft.ReactNative.
|
|
8
|
+
Do not make any changes here unless it applies to ALL such projects.
|
|
9
|
+
-->
|
|
10
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
11
|
+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Common.props" />
|
|
12
|
+
<!-- Fixes NuGet restore issues: -->
|
|
13
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.CSharp.props" />
|
|
14
|
+
</Project>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
Licensed under the MIT License.
|
|
5
|
+
|
|
6
|
+
This file will be consumed by ALL Win32 app and module projects (both inside
|
|
7
|
+
and outside of this repo) that build on top of Microsoft.ReactNative.
|
|
8
|
+
Do not make any changes here unless it applies to ALL such projects.
|
|
9
|
+
-->
|
|
10
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
11
|
+
|
|
12
|
+
<ItemGroup>
|
|
13
|
+
<SDKReference Include="Microsoft.VCLibs.Desktop, Version=14.0" />
|
|
14
|
+
<!-- Needed for ucrtbased.dll when running a debug build. -->
|
|
15
|
+
<SDKReference Include="Microsoft.VCLibs, Version=14.0" Condition="'$(Configuration)' == 'Debug'" />
|
|
16
|
+
</ItemGroup>
|
|
17
|
+
|
|
18
|
+
</Project>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<WindowsTargetPlatformMinVersion Condition="'$(UseWinUI3)'=='true' And $([MSBuild]::VersionLessThan('$(WindowsTargetPlatformMinVersion)', '10.0.17763.0'))">10.0.17763.0</WindowsTargetPlatformMinVersion>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
|
|
21
|
-
<PropertyGroup Label="Globals" Condition="'$(MSBuildProjectExtension)' == '.csproj'">
|
|
21
|
+
<PropertyGroup Label="Globals" Condition="'$(MSBuildProjectExtension)' == '.csproj' Or '$(MSBuildProjectExtension)' == '.wapproj'">
|
|
22
22
|
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)'==''">10.0.19041.0</TargetPlatformVersion>
|
|
23
23
|
<TargetPlatformMinVersion Condition="'$(TargetPlatformMinVersion)'==''">10.0.17763.0</TargetPlatformMinVersion>
|
|
24
24
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.0.0-canary.
|
|
13
|
+
<ReactNativeWindowsVersion>0.0.0-canary.709</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>true</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>c7282e51f9afec33ecc18ad836b02d84bcc17379</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
|
-
"version": "0.0.0-canary.
|
|
3
|
+
"version": "0.0.0-canary.709",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@react-native-community/cli": "12.0.0-alpha.7",
|
|
27
27
|
"@react-native-community/cli-platform-android": "12.0.0-alpha.7",
|
|
28
28
|
"@react-native-community/cli-platform-ios": "12.0.0-alpha.7",
|
|
29
|
-
"@react-native-windows/cli": "0.0.0-canary.
|
|
29
|
+
"@react-native-windows/cli": "0.0.0-canary.189",
|
|
30
30
|
"@react-native/assets": "1.0.0",
|
|
31
31
|
"@react-native/assets-registry": "0.73.0-nightly-20230622-0201e51bb",
|
|
32
32
|
"@react-native/codegen": "0.73.0-nightly-20230711-f396067cc",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metro configuration for React Native
|
|
3
|
+
* https://github.com/facebook/react-native
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const exclusionList = require('metro-config/src/defaults/exclusionList');
|
|
10
|
+
|
|
11
|
+
const rnwPath = fs.realpathSync(
|
|
12
|
+
path.resolve(require.resolve('react-native-windows/package.json'), '..'),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
//{{#devMode}} [devMode
|
|
16
|
+
const rnwRootNodeModules = path.resolve(rnwPath, '..', 'node_modules');
|
|
17
|
+
const rnwPackages = path.resolve(rnwPath, '..', 'packages');
|
|
18
|
+
// devMode]{{/devMode}}
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
//{{#devMode}} [devMode
|
|
22
|
+
watchFolders: [rnwPath, rnwRootNodeModules, rnwPackages],
|
|
23
|
+
// devMode]{{/devMode}}
|
|
24
|
+
resolver: {
|
|
25
|
+
blockList: exclusionList([
|
|
26
|
+
// This stops "react-native run-windows" from causing the metro server to crash if its already running
|
|
27
|
+
new RegExp(
|
|
28
|
+
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
|
|
29
|
+
),
|
|
30
|
+
// This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip or other files produced by msbuild
|
|
31
|
+
new RegExp(`${rnwPath}/build/.*`),
|
|
32
|
+
new RegExp(`${rnwPath}/target/.*`),
|
|
33
|
+
/.*\.ProjectImports\.zip/,
|
|
34
|
+
]),
|
|
35
|
+
//{{#devMode}} [devMode
|
|
36
|
+
extraNodeModules: {
|
|
37
|
+
'react-native-windows': rnwPath,
|
|
38
|
+
},
|
|
39
|
+
// devMode]{{/devMode}}
|
|
40
|
+
},
|
|
41
|
+
transformer: {
|
|
42
|
+
getTransformOptions: async () => ({
|
|
43
|
+
transform: {
|
|
44
|
+
experimentalImportSupport: false,
|
|
45
|
+
inlineRequires: true,
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
// This fixes the 'missing-asset-registry-path` error (see https://github.com/microsoft/react-native-windows/issues/11437)
|
|
49
|
+
assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* @ts check
|
|
6
|
+
* @format
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const chalk = require('chalk');
|
|
10
|
+
const existsSync = require('fs').existsSync;
|
|
11
|
+
const fs = require('fs').promises;
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const username = require('username');
|
|
14
|
+
const uuid = require('uuid');
|
|
15
|
+
|
|
16
|
+
async function preInstall(config = {}, options = {}) {}
|
|
17
|
+
|
|
18
|
+
async function getFileMappings(config = {}, options = {}) {
|
|
19
|
+
const rnwPath = path.dirname(
|
|
20
|
+
require.resolve('react-native-windows', [config.root]),
|
|
21
|
+
);
|
|
22
|
+
const rnwVersion = require(path.join(rnwPath, 'package.json')).version;
|
|
23
|
+
|
|
24
|
+
const devMode = await existsSync(path.join(rnwPath, 'src'));
|
|
25
|
+
|
|
26
|
+
const projectName =
|
|
27
|
+
config?.project?.windows?.project?.projectName ?? options?.name ?? 'MyApp';
|
|
28
|
+
const namespace = options?.namespace ?? projectName;
|
|
29
|
+
const namespaceCpp = namespace.replace(/\./g, '::');
|
|
30
|
+
const projectGuid =
|
|
31
|
+
config?.project?.windows?.project?.projectGuid
|
|
32
|
+
?.replace('{', '')
|
|
33
|
+
.replace('}', '') ?? uuid.v4();
|
|
34
|
+
const packageGuid = uuid.v4();
|
|
35
|
+
const currentUser = username.sync(); // Gets the current username depending on the platform.
|
|
36
|
+
|
|
37
|
+
const cppNugetPackages = [];
|
|
38
|
+
|
|
39
|
+
const replacements = {
|
|
40
|
+
useMustache: true,
|
|
41
|
+
regExpPatternsToRemove: [],
|
|
42
|
+
|
|
43
|
+
name: projectName,
|
|
44
|
+
namespace: namespace,
|
|
45
|
+
namespaceCpp: namespaceCpp,
|
|
46
|
+
|
|
47
|
+
rnwVersion: rnwVersion,
|
|
48
|
+
|
|
49
|
+
mainComponentName: projectName, // TODO: replace with app.json name
|
|
50
|
+
|
|
51
|
+
// Visual Studio is very picky about the casing of the guids for projects, project references and the solution
|
|
52
|
+
// https://www.bing.com/search?q=visual+studio+project+guid+casing&cvid=311a5ad7f9fc41089507b24600d23ee7&FORM=ANAB01&PC=U531
|
|
53
|
+
// we therefore have to precariously use the right casing in the right place or risk building in VS breaking.
|
|
54
|
+
projectGuidLower: `{${projectGuid.toLowerCase()}}`,
|
|
55
|
+
projectGuidUpper: `{${projectGuid.toUpperCase()}}`,
|
|
56
|
+
|
|
57
|
+
// packaging and signing variables:
|
|
58
|
+
packageGuidLower: `{${packageGuid.toLowerCase()}}`,
|
|
59
|
+
packageGuidUpper: `{${packageGuid.toUpperCase()}}`,
|
|
60
|
+
currentUser: currentUser,
|
|
61
|
+
|
|
62
|
+
devMode,
|
|
63
|
+
|
|
64
|
+
cppNugetPackages,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
let fileMappings = [];
|
|
68
|
+
|
|
69
|
+
const templateFiles = await fs.readdir(__dirname, {recursive: true});
|
|
70
|
+
|
|
71
|
+
for (const file of templateFiles) {
|
|
72
|
+
const fileMapping = {
|
|
73
|
+
from: path.resolve(__dirname, file),
|
|
74
|
+
to: file,
|
|
75
|
+
replacements,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Don't include this file nor directories
|
|
79
|
+
if (
|
|
80
|
+
file === 'template.config.js' ||
|
|
81
|
+
(await fs.stat(fileMapping.from)).isDirectory()
|
|
82
|
+
) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Perform simple file renames
|
|
87
|
+
const fileName = path.basename(fileMapping.to);
|
|
88
|
+
switch (fileName) {
|
|
89
|
+
case '_gitignore':
|
|
90
|
+
fileMapping.to = path.join(path.dirname(file), '.gitignore');
|
|
91
|
+
break;
|
|
92
|
+
case 'NuGet_Config':
|
|
93
|
+
fileMapping.to = path.join(path.dirname(file), 'NuGet.config');
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Rename files with MyApp in the name
|
|
98
|
+
fileMapping.to = fileMapping.to.replace(/MyApp/g, projectName);
|
|
99
|
+
|
|
100
|
+
fileMappings.push(fileMapping);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return fileMappings;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function postInstall(config = {}, options = {}) {
|
|
107
|
+
console.log(chalk.white.bold('To run your app on UWP:'));
|
|
108
|
+
console.log(chalk.white(' npx react-native run-windows'));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = {
|
|
112
|
+
name: 'React Native Windows Application (New Arch, C++, Win32, Hermes)',
|
|
113
|
+
description:
|
|
114
|
+
"[Experimental] A RNW app targeting RN's new architecture, with the Hermes JS engine.",
|
|
115
|
+
preInstall,
|
|
116
|
+
getFileMappings,
|
|
117
|
+
postInstall,
|
|
118
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
|
|
4
|
+
<PropertyGroup Label="Microsoft.ReactNative Experimental Features">
|
|
5
|
+
<UseHermes>true</UseHermes>
|
|
6
|
+
<UseFabric>true</UseFabric>
|
|
7
|
+
<UseWinUI3>false</UseWinUI3>
|
|
8
|
+
|
|
9
|
+
<ReactExperimentalFeaturesSet>true</ReactExperimentalFeaturesSet>
|
|
10
|
+
</PropertyGroup>
|
|
11
|
+
|
|
12
|
+
</Project>
|