react-native-windows 0.67.6 → 0.67.9

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/CHANGELOG.json CHANGED
@@ -1,6 +1,156 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
3
  "entries": [
4
+ {
5
+ "date": "Mon, 02 May 2022 15:10:43 GMT",
6
+ "tag": "react-native-windows_v0.67.9",
7
+ "version": "0.67.9",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "53799235+ZihanChen-MSFT@users.noreply.github.com",
12
+ "package": "react-native-windows",
13
+ "commit": "9458dad1646fa2a8a5afea7383133eeca144fb88",
14
+ "comment": "Fix clang-check errors in NativeModules.h"
15
+ },
16
+ {
17
+ "author": "vmorozov@microsoft.com",
18
+ "package": "react-native-windows",
19
+ "commit": "38c0547235927e51c08bd17b08b2f6be878fd0a5",
20
+ "comment": "Fix JSI for Node-API and update V8 to 0.65.11"
21
+ },
22
+ {
23
+ "author": "julio.rocha@microsoft.com",
24
+ "package": "react-native-windows",
25
+ "commit": "e3ef52d578991181c00a6487c902ce4c31cc702a",
26
+ "comment": "Handle abrupt WebSocket connection interruption (#9829)"
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "date": "Mon, 25 Apr 2022 15:11:36 GMT",
33
+ "tag": "react-native-windows_v0.67.8",
34
+ "version": "0.67.8",
35
+ "comments": {
36
+ "patch": [
37
+ {
38
+ "author": "vmorozov@microsoft.com",
39
+ "package": "react-native-windows",
40
+ "commit": "not available",
41
+ "comment": "Fix Sequential DispatchQueue deadlock on shutdown"
42
+ }
43
+ ]
44
+ }
45
+ },
46
+ {
47
+ "date": "Mon, 25 Apr 2022 15:11:22 GMT",
48
+ "tag": "react-native-windows_v0.67.8",
49
+ "version": "0.67.8",
50
+ "comments": {
51
+ "patch": [
52
+ {
53
+ "author": "vmorozov@microsoft.com",
54
+ "package": "react-native-windows",
55
+ "commit": "d317482299129e89a8bdf57a8ccefe6238e0a541",
56
+ "comment": "Fix Sequential DispatchQueue deadlock on shutdown"
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "date": "Mon, 04 Apr 2022 15:13:28 GMT",
63
+ "tag": "react-native-windows_v0.67.7",
64
+ "version": "0.67.7",
65
+ "comments": {
66
+ "patch": [
67
+ {
68
+ "author": "asklar@microsoft.com",
69
+ "package": "react-native-windows",
70
+ "commit": "not available",
71
+ "comment": "MustBeNoExceptVoidFunctor should depend on the template type parameter to avoid being evaluated too early (#9609)"
72
+ },
73
+ {
74
+ "author": "34109996+chiaramooney@users.noreply.github.com",
75
+ "package": "react-native-windows",
76
+ "commit": "not available",
77
+ "comment": "Promote 0.67 to legacy"
78
+ },
79
+ {
80
+ "author": "beachball",
81
+ "package": "react-native-windows",
82
+ "comment": "Bump @react-native-windows/cli to v0.67.2",
83
+ "commit": "4d4f19bef79e0fb2f6198b18c9e77d0da98a6938"
84
+ },
85
+ {
86
+ "author": "beachball",
87
+ "package": "react-native-windows",
88
+ "comment": "Bump @react-native-windows/virtualized-list to v0.67.1",
89
+ "commit": "4d4f19bef79e0fb2f6198b18c9e77d0da98a6938"
90
+ },
91
+ {
92
+ "author": "beachball",
93
+ "package": "react-native-windows",
94
+ "comment": "Bump @react-native-windows/codegen to v0.67.1",
95
+ "commit": "4d4f19bef79e0fb2f6198b18c9e77d0da98a6938"
96
+ }
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ "date": "Mon, 04 Apr 2022 15:12:55 GMT",
102
+ "tag": "react-native-windows_v0.67.7",
103
+ "version": "0.67.7",
104
+ "comments": {
105
+ "patch": [
106
+ {
107
+ "author": "asklar@microsoft.com",
108
+ "package": "react-native-windows",
109
+ "commit": "e92602643cb768e9ce34430e9800d76769a31a2a",
110
+ "comment": "MustBeNoExceptVoidFunctor should depend on the template type parameter to avoid being evaluated too early (#9609)"
111
+ },
112
+ {
113
+ "author": "34109996+chiaramooney@users.noreply.github.com",
114
+ "package": "react-native-windows",
115
+ "commit": "f4f970be35618e9942c5c96e6c15c88f8426c91c",
116
+ "comment": "Promote 0.67 to legacy"
117
+ },
118
+ {
119
+ "author": "beachball",
120
+ "package": "react-native-windows",
121
+ "comment": "Bump @react-native-windows/cli to v0.67.2",
122
+ "commit": "e92602643cb768e9ce34430e9800d76769a31a2a"
123
+ },
124
+ {
125
+ "author": "beachball",
126
+ "package": "react-native-windows",
127
+ "comment": "Bump @react-native-windows/virtualized-list to v0.67.1",
128
+ "commit": "e92602643cb768e9ce34430e9800d76769a31a2a"
129
+ },
130
+ {
131
+ "author": "beachball",
132
+ "package": "react-native-windows",
133
+ "comment": "Bump @react-native-windows/codegen to v0.67.1",
134
+ "commit": "e92602643cb768e9ce34430e9800d76769a31a2a"
135
+ }
136
+ ]
137
+ }
138
+ },
139
+ {
140
+ "date": "Tue, 29 Mar 2022 17:35:30 GMT",
141
+ "tag": "react-native-windows_v0.67.6",
142
+ "version": "0.67.6",
143
+ "comments": {
144
+ "patch": [
145
+ {
146
+ "author": "asklar@microsoft.com",
147
+ "package": "react-native-windows",
148
+ "commit": "not available",
149
+ "comment": "Guard against crashes due to cancelations and other errors from BitmapSource/SvgImageSource SetSourceAsync"
150
+ }
151
+ ]
152
+ }
153
+ },
4
154
  {
5
155
  "date": "Tue, 29 Mar 2022 17:35:16 GMT",
6
156
  "tag": "react-native-windows_v0.67.6",
package/CHANGELOG.md CHANGED
@@ -1,17 +1,75 @@
1
1
  # Change Log - react-native-windows
2
2
 
3
- This log was last generated on Tue, 29 Mar 2022 17:35:16 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 02 May 2022 15:10:43 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.67.6
7
+ ## 0.67.9
8
8
 
9
- Tue, 29 Mar 2022 17:35:16 GMT
9
+ Mon, 02 May 2022 15:10:43 GMT
10
10
 
11
11
  ### Patches
12
12
 
13
- - Guard against crashes due to cancelations and other errors from BitmapSource/SvgImageSource SetSourceAsync (asklar@microsoft.com)
13
+ - Fix clang-check errors in NativeModules.h (53799235+ZihanChen-MSFT@users.noreply.github.com)
14
+ - Fix JSI for Node-API and update V8 to 0.65.11 (vmorozov@microsoft.com)
15
+ - Handle abrupt WebSocket connection interruption (#9829) (julio.rocha@microsoft.com)
14
16
 
17
+ ## 0.67.8
18
+
19
+ Mon, 25 Apr 2022 15:11:36 GMT
20
+
21
+ ### Patches
22
+
23
+ - Fix Sequential DispatchQueue deadlock on shutdown (vmorozov@microsoft.com)
24
+
25
+ ## 0.67.8
26
+
27
+ Mon, 25 Apr 2022 15:11:22 GMT
28
+
29
+ ### Patches
30
+
31
+ - Fix Sequential DispatchQueue deadlock on shutdown (vmorozov@microsoft.com)
32
+
33
+ ## 0.67.7
34
+
35
+ Mon, 04 Apr 2022 15:13:28 GMT
36
+
37
+ ### Patches
38
+
39
+ - MustBeNoExceptVoidFunctor should depend on the template type parameter to avoid being evaluated too early (#9609) (asklar@microsoft.com)
40
+ - Promote 0.67 to legacy (34109996+chiaramooney@users.noreply.github.com)
41
+ - Bump @react-native-windows/cli to v0.67.2
42
+ - Bump @react-native-windows/virtualized-list to v0.67.1
43
+ - Bump @react-native-windows/codegen to v0.67.1
44
+
45
+ ## 0.67.7
46
+
47
+ Mon, 04 Apr 2022 15:12:55 GMT
48
+
49
+ ### Patches
50
+
51
+ - MustBeNoExceptVoidFunctor should depend on the template type parameter to avoid being evaluated too early (#9609) (asklar@microsoft.com)
52
+ - Promote 0.67 to legacy (34109996+chiaramooney@users.noreply.github.com)
53
+ - Bump @react-native-windows/cli to v0.67.2
54
+ - Bump @react-native-windows/virtualized-list to v0.67.1
55
+ - Bump @react-native-windows/codegen to v0.67.1
56
+
57
+ ## 0.67.6
58
+
59
+ Tue, 29 Mar 2022 17:35:30 GMT
60
+
61
+ ### Patches
62
+
63
+ - Guard against crashes due to cancelations and other errors from BitmapSource/SvgImageSource SetSourceAsync (asklar@microsoft.com)
64
+
65
+ ## 0.67.6
66
+
67
+ Tue, 29 Mar 2022 17:35:16 GMT
68
+
69
+ ### Patches
70
+
71
+ - Guard against crashes due to cancelations and other errors from BitmapSource/SvgImageSource SetSourceAsync (asklar@microsoft.com)
72
+
15
73
  ## 0.67.5
16
74
 
17
75
  Mon, 21 Mar 2022 15:13:26 GMT
@@ -13,7 +13,6 @@
13
13
  #include <Modules/ClipboardModule.h>
14
14
  #include <Modules/LinkingManagerModule.h>
15
15
  #include <Modules/NativeUIManager.h>
16
- #include <Modules/NetworkingModule.h>
17
16
  #include <Modules/PaperUIManagerModule.h>
18
17
  #include <Threading/MessageQueueThreadFactory.h>
19
18
 
@@ -50,9 +49,7 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
50
49
  std::vector<facebook::react::NativeModuleDescription> modules;
51
50
 
52
51
  modules.emplace_back(
53
- Microsoft::React::NetworkingModule::Name,
54
- []() { return std::make_unique<Microsoft::React::NetworkingModule>(); },
55
- jsMessageQueue);
52
+ "Networking", []() { return Microsoft::React::CreateHttpModule(); }, jsMessageQueue);
56
53
 
57
54
  modules.emplace_back(
58
55
  "Timing",
@@ -8,5 +8,5 @@
8
8
  <package id="Microsoft.Windows.CppWinRT" version="2.0.210312.4" targetFramework="native" />
9
9
  <package id="Microsoft.WinUI" version="3.0.0-preview4.210210.4" targetFramework="native" />
10
10
  <package id="ReactNative.Hermes.Windows" version="0.10.0-ms.1" targetFramework="native" />
11
- <!-- package id="ReactNative.V8Jsi.Windows.UWP" version="0.65.5" targetFramework="native" / -->
11
+ <!-- package id="ReactNative.V8Jsi.Windows.UWP" version="0.65.11" targetFramework="native" / -->
12
12
  </packages>
@@ -190,7 +190,7 @@ struct NapiJsiRuntime : facebook::jsi::Runtime {
190
190
  facebook::jsi::Function createFunctionFromHostFunction(
191
191
  const facebook::jsi::PropNameID &name,
192
192
  unsigned int paramCount,
193
- facebook::jsi::HostFunctionType type) override;
193
+ facebook::jsi::HostFunctionType func) override;
194
194
  facebook::jsi::Value call(
195
195
  const facebook::jsi::Function &func,
196
196
  const facebook::jsi::Value &jsThis,
@@ -475,7 +475,7 @@ struct NapiJsiRuntime : facebook::jsi::Runtime {
475
475
  void SetProperty(napi_value object, napi_value propertyId, napi_value value, napi_property_attributes attrs) const;
476
476
  napi_value CreateArray(size_t length) const;
477
477
  void SetElement(napi_value array, uint32_t index, napi_value value) const;
478
- static napi_value JsiHostFunctionCallback(napi_env env, napi_callback_info info) noexcept;
478
+ static napi_value __cdecl JsiHostFunctionCallback(napi_env env, napi_callback_info info) noexcept;
479
479
  napi_value CreateExternalFunction(napi_value name, int32_t paramCount, napi_callback callback, void *callbackData);
480
480
  napi_value CreateExternalObject(void *data, napi_finalize finalizeCallback) const;
481
481
  template <typename T>
@@ -1702,7 +1702,7 @@ void NapiJsiRuntime::SetElement(napi_value array, uint32_t index, napi_value val
1702
1702
  }
1703
1703
 
1704
1704
  // The NAPI external function callback used for the JSI host function implementation.
1705
- /*static*/ napi_value NapiJsiRuntime::JsiHostFunctionCallback(napi_env env, napi_callback_info info) noexcept {
1705
+ /*static*/ napi_value __cdecl NapiJsiRuntime::JsiHostFunctionCallback(napi_env env, napi_callback_info info) noexcept {
1706
1706
  HostFunctionWrapper *hostFuncWrapper{};
1707
1707
  size_t argc{};
1708
1708
  CHECK_NAPI_ELSE_CRASH(
@@ -1750,15 +1750,11 @@ napi_value NapiJsiRuntime::CreateExternalObject(void *data, napi_finalize finali
1750
1750
  // Wraps up std::unique_ptr as an external object.
1751
1751
  template <typename T>
1752
1752
  napi_value NapiJsiRuntime::CreateExternalObject(unique_ptr<T> &&data) const {
1753
- napi_value object =
1754
- CreateExternalObject(data.get(), [](napi_env /*env*/, void *dataToDestroy, void * /*finalizerHint*/) {
1755
- // We wrap dataToDestroy in a unique_ptr to avoid calling delete explicitly.
1756
- if (std::is_array<T>::value) {
1757
- delete[] static_cast<T *>(dataToDestroy);
1758
- } else {
1759
- delete static_cast<T *>(dataToDestroy);
1760
- }
1761
- });
1753
+ napi_finalize finalize = [](napi_env /*env*/, void *dataToDestroy, void * /*finalizerHint*/) {
1754
+ // We wrap dataToDestroy in a unique_ptr to avoid calling delete explicitly.
1755
+ unique_ptr<T> dataDeleter{static_cast<T *>(dataToDestroy)};
1756
+ };
1757
+ napi_value object = CreateExternalObject(data.get(), finalize);
1762
1758
 
1763
1759
  // We only call data.release() after the CreateExternalObject succeeds.
1764
1760
  // Otherwise, when CreateExternalObject fails and an exception is thrown,
@@ -1807,7 +1803,7 @@ napi_value NapiJsiRuntime::GetHostObjectProxyHandler() {
1807
1803
  // Sets Proxy trap method as a pointer to NapiJsiRuntime instance method.
1808
1804
  template <napi_value (NapiJsiRuntime::*trapMethod)(span<napi_value>), size_t argCount>
1809
1805
  void NapiJsiRuntime::SetProxyTrap(napi_value handler, napi_value propertyName) {
1810
- auto proxyTrap = [](napi_env env, napi_callback_info info) noexcept {
1806
+ napi_callback proxyTrap = [](napi_env env, napi_callback_info info) noexcept {
1811
1807
  NapiJsiRuntime *runtime{};
1812
1808
  napi_value args[argCount]{};
1813
1809
  size_t actualArgCount{argCount};
@@ -2,6 +2,8 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  #pragma once
5
+ #ifndef MICROSOFT_REACTNATIVE_JSI_NODEAPIJSIRUNTIME
6
+ #define MICROSOFT_REACTNATIVE_JSI_NODEAPIJSIRUNTIME
5
7
 
6
8
  // JSI
7
9
  #include <js_native_ext_api.h>
@@ -19,3 +21,5 @@ namespace Microsoft::JSI {
19
21
  std::unique_ptr<facebook::jsi::Runtime> __cdecl MakeNodeApiJsiRuntime(napi_env env) noexcept;
20
22
 
21
23
  } // namespace Microsoft::JSI
24
+
25
+ #endif // MICROSOFT_REACTNATIVE_JSI_NODEAPIJSIRUNTIME
@@ -1091,7 +1091,7 @@ template <class TModule, int I, class TMethodSpec>
1091
1091
  struct ReactMethodVerifier {
1092
1092
  static constexpr bool Verify() noexcept {
1093
1093
  ReactMethodVerifier verifier{};
1094
- ReactMemberInfoIterator<TModule>{}.GetMemberInfo<I>(verifier);
1094
+ ReactMemberInfoIterator<TModule>{}.template GetMemberInfo<I>(verifier);
1095
1095
  return verifier.m_result;
1096
1096
  }
1097
1097
 
@@ -1109,7 +1109,7 @@ template <class TModule, int I, class TMethodSpec>
1109
1109
  struct ReactSyncMethodVerifier {
1110
1110
  static constexpr bool Verify() noexcept {
1111
1111
  ReactSyncMethodVerifier verifier{};
1112
- ReactMemberInfoIterator<TModule>{}.GetMemberInfo<I>(verifier);
1112
+ ReactMemberInfoIterator<TModule>{}.template GetMemberInfo<I>(verifier);
1113
1113
  return verifier.m_result;
1114
1114
  }
1115
1115
 
@@ -723,9 +723,14 @@ inline DispatchTaskImpl<TInvoke, TOnCancel>::~DispatchTaskImpl() noexcept {
723
723
  }
724
724
  }
725
725
 
726
+ namespace details {
727
+ template <typename>
728
+ constexpr bool always_false = false;
729
+ }
730
+
726
731
  template <typename T>
727
732
  inline void MustBeNoExceptVoidFunctor() {
728
- static_assert(false, __FUNCTION__ ": not a noexcept callable functor returning void");
733
+ static_assert(details::always_false<T>, __FUNCTION__ ": not a noexcept callable functor returning void");
729
734
  }
730
735
 
731
736
  template <typename TInvoke, typename TOnCancel>
@@ -1,6 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
3
 
4
+ #include <utility>
4
5
  #include "dispatchQueue/dispatchQueue.h"
5
6
  #include "queueService.h"
6
7
 
@@ -29,6 +30,13 @@ struct ThreadPoolSchedulerWin : Mso::UnknownObject<IDispatchQueueScheduler> {
29
30
  void Shutdown() noexcept override;
30
31
  void AwaitTermination() noexcept override;
31
32
 
33
+ public: // Used by test APIs
34
+ static void EnableThreadPoolWorkTracking(bool enable) noexcept;
35
+ static void WaitForThreadPoolWorkCompletion() noexcept;
36
+
37
+ private: // Used by test APIs
38
+ static void TrackThreadPoolWork(const std::shared_ptr<TP_WORK> &work) noexcept;
39
+
32
40
  private:
33
41
  struct ThreadAccessGuard {
34
42
  ThreadAccessGuard(ThreadPoolSchedulerWin *scheduler) noexcept;
@@ -42,12 +50,29 @@ struct ThreadPoolSchedulerWin : Mso::UnknownObject<IDispatchQueueScheduler> {
42
50
  };
43
51
 
44
52
  private:
45
- std::unique_ptr<TP_WORK, ThreadPoolWorkDeleter> m_threadPoolWork;
53
+ std::shared_ptr<TP_WORK> m_threadPoolWork;
46
54
  Mso::WeakPtr<IDispatchQueueService> m_queue;
47
55
  const uint32_t m_maxThreads{1};
48
56
  std::atomic<uint32_t> m_usedThreads{0};
49
57
 
50
58
  constexpr static uint32_t MaxConcurrentThreads{64};
59
+
60
+ private:
61
+ static std::mutex s_threadPoolWorkMutex;
62
+ static bool s_enableThreadPoolWorkTracking;
63
+ static std::vector<std::shared_ptr<TP_WORK>> s_trackedThreadPoolWork;
64
+ };
65
+
66
+ // Track the ThreadPoolSchedulerWin instance used by current thread.
67
+ // We use it to avoid a deadlock on queue shutdown.
68
+ struct ThreadPoolSchedulerWinContext {
69
+ ThreadPoolSchedulerWinContext(ThreadPoolSchedulerWin *scheduler) noexcept;
70
+ ~ThreadPoolSchedulerWinContext() noexcept;
71
+ static ThreadPoolSchedulerWin *CurrentScheduler() noexcept;
72
+
73
+ private:
74
+ static thread_local ThreadPoolSchedulerWin *tls_scheduler;
75
+ ThreadPoolSchedulerWin *m_prevScheduler{nullptr};
51
76
  };
52
77
 
53
78
  //=============================================================================
@@ -64,9 +89,15 @@ void ThreadPoolWorkDeleter::operator()(TP_WORK *tpWork) noexcept {
64
89
  // ThreadPoolSchedulerWin implementation
65
90
  //=============================================================================
66
91
 
92
+ std::mutex ThreadPoolSchedulerWin::s_threadPoolWorkMutex;
93
+ bool ThreadPoolSchedulerWin::s_enableThreadPoolWorkTracking{false};
94
+ std::vector<std::shared_ptr<TP_WORK>> ThreadPoolSchedulerWin::s_trackedThreadPoolWork;
95
+
67
96
  ThreadPoolSchedulerWin::ThreadPoolSchedulerWin(uint32_t maxThreads) noexcept
68
- : m_threadPoolWork{::CreateThreadpoolWork(WorkCallback, this, nullptr)},
69
- m_maxThreads{maxThreads == 0 ? MaxConcurrentThreads : maxThreads} {}
97
+ : m_threadPoolWork{::CreateThreadpoolWork(WorkCallback, this, nullptr), ThreadPoolWorkDeleter{}},
98
+ m_maxThreads{maxThreads == 0 ? MaxConcurrentThreads : maxThreads} {
99
+ TrackThreadPoolWork(m_threadPoolWork);
100
+ }
70
101
 
71
102
  ThreadPoolSchedulerWin::~ThreadPoolSchedulerWin() noexcept {
72
103
  AwaitTermination();
@@ -78,6 +109,7 @@ ThreadPoolSchedulerWin::~ThreadPoolSchedulerWin() noexcept {
78
109
  _Inout_ PTP_WORK /*work*/) {
79
110
  // The ThreadPoolSchedulerWin is alive here because m_threadPoolWork must be completed before it is destroyed.
80
111
  ThreadPoolSchedulerWin *self = static_cast<ThreadPoolSchedulerWin *>(context);
112
+ ThreadPoolSchedulerWinContext schedulerContext(self);
81
113
 
82
114
  if (auto queue = self->m_queue.GetStrongPtr()) {
83
115
  auto endTime = std::chrono::steady_clock::now() + 100ms;
@@ -129,7 +161,38 @@ void ThreadPoolSchedulerWin::Shutdown() noexcept {
129
161
  }
130
162
 
131
163
  void ThreadPoolSchedulerWin::AwaitTermination() noexcept {
132
- ::WaitForThreadpoolWorkCallbacks(m_threadPoolWork.get(), false);
164
+ // Avoid deadlock when the dispatch queue and ThreadPoolSchedulerWin are released from inside of a task.
165
+ if (ThreadPoolSchedulerWinContext::CurrentScheduler() != this) {
166
+ ::WaitForThreadpoolWorkCallbacks(m_threadPoolWork.get(), false);
167
+ }
168
+ }
169
+
170
+ void ThreadPoolSchedulerWin::EnableThreadPoolWorkTracking(bool enable) noexcept {
171
+ std::vector<std::shared_ptr<TP_WORK>> tpWorkToStopTracking;
172
+ {
173
+ std::scoped_lock lock{s_threadPoolWorkMutex};
174
+ s_enableThreadPoolWorkTracking = enable;
175
+ // Reset all previously tracked work
176
+ tpWorkToStopTracking = std::move(s_trackedThreadPoolWork);
177
+ }
178
+ }
179
+
180
+ void ThreadPoolSchedulerWin::WaitForThreadPoolWorkCompletion() noexcept {
181
+ std::vector<std::shared_ptr<TP_WORK>> tpWorkToTrack;
182
+ {
183
+ std::scoped_lock lock{s_threadPoolWorkMutex};
184
+ tpWorkToTrack = std::move(s_trackedThreadPoolWork);
185
+ }
186
+ for (std::shared_ptr<TP_WORK> &tpWork : tpWorkToTrack) {
187
+ ::WaitForThreadpoolWorkCallbacks(tpWork.get(), false);
188
+ }
189
+ }
190
+
191
+ void ThreadPoolSchedulerWin::TrackThreadPoolWork(const std::shared_ptr<TP_WORK> &tpWork) noexcept {
192
+ std::scoped_lock lock{s_threadPoolWorkMutex};
193
+ if (s_enableThreadPoolWorkTracking) {
194
+ s_trackedThreadPoolWork.push_back(tpWork);
195
+ }
133
196
  }
134
197
 
135
198
  //=============================================================================
@@ -151,6 +214,23 @@ ThreadPoolSchedulerWin::ThreadAccessGuard::~ThreadAccessGuard() noexcept {
151
214
  return tls_scheduler == scheduler;
152
215
  }
153
216
 
217
+ //=============================================================================
218
+ // ThreadPoolSchedulerWinContext implementation
219
+ //=============================================================================
220
+
221
+ thread_local ThreadPoolSchedulerWin *ThreadPoolSchedulerWinContext::tls_scheduler{nullptr};
222
+
223
+ ThreadPoolSchedulerWinContext::ThreadPoolSchedulerWinContext(ThreadPoolSchedulerWin *scheduler) noexcept
224
+ : m_prevScheduler(std::exchange(tls_scheduler, scheduler)) {}
225
+
226
+ ThreadPoolSchedulerWinContext::~ThreadPoolSchedulerWinContext() noexcept {
227
+ std::exchange(tls_scheduler, m_prevScheduler);
228
+ }
229
+
230
+ ThreadPoolSchedulerWin *ThreadPoolSchedulerWinContext::CurrentScheduler() noexcept {
231
+ return tls_scheduler;
232
+ }
233
+
154
234
  //=============================================================================
155
235
  // DispatchQueueStatic::MakeThreadPoolScheduler implementation
156
236
  //=============================================================================
@@ -160,4 +240,16 @@ ThreadPoolSchedulerWin::ThreadAccessGuard::~ThreadAccessGuard() noexcept {
160
240
  return Mso::Make<ThreadPoolSchedulerWin, IDispatchQueueScheduler>(maxThreads);
161
241
  }
162
242
 
243
+ //=============================================================================
244
+ // Test specific functions
245
+ //=============================================================================
246
+
247
+ void Test_ThreadPoolSchedulerWin_EnableThreadPoolWorkTracking(bool enable) noexcept {
248
+ ThreadPoolSchedulerWin::EnableThreadPoolWorkTracking(enable);
249
+ }
250
+
251
+ void Test_ThreadPoolSchedulerWin_WaitForThreadPoolWorkCompletion() noexcept {
252
+ ThreadPoolSchedulerWin::WaitForThreadPoolWorkCompletion();
253
+ }
254
+
163
255
  } // namespace Mso
@@ -10,10 +10,10 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.67.6</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.67.9</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>67</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>6</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>9</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
18
  </PropertyGroup>
19
19
  </Project>
@@ -16,7 +16,7 @@
16
16
  <EnableDevServerHBCBundles Condition="'$(EnableDevServerHBCBundles)' == ''">false</EnableDevServerHBCBundles>
17
17
 
18
18
  <UseV8 Condition="'$(UseV8)' == ''">false</UseV8>
19
- <V8Version Condition="'$(V8Version)' == ''">0.65.5</V8Version>
19
+ <V8Version Condition="'$(V8Version)' == ''">0.65.11</V8Version>
20
20
  <V8PackageName>ReactNative.V8Jsi.Windows</V8PackageName>
21
21
  <V8PackageName Condition="'$(V8AppPlatform)' != 'win32'">$(V8PackageName).UWP</V8PackageName>
22
22
  <V8Package>$(SolutionDir)packages\$(V8PackageName).$(V8Version)</V8Package>
@@ -32,6 +32,10 @@ extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateAsyncStorageMod
32
32
 
33
33
  namespace Microsoft::React {
34
34
 
35
+ extern const char *GetHttpModuleName() noexcept;
36
+ extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateHttpModule() noexcept;
37
+
38
+ extern const char *GetWebSocketModuleName() noexcept;
35
39
  extern std::unique_ptr<facebook::xplat::module::CxxModule> CreateWebSocketModule() noexcept;
36
40
 
37
41
  } // namespace Microsoft::React
@@ -3,32 +3,51 @@
3
3
 
4
4
  #pragma once
5
5
 
6
- #include <Folly/dynamic.h>
6
+ // Standard Library
7
+ #include <functional>
8
+ #include <memory>
9
+ #include <string>
10
+ #include <unordered_map>
7
11
 
8
12
  namespace Microsoft::React {
9
13
 
10
14
  struct IHttpResource {
11
- typedef std::map<std::string, std::string> Headers;
15
+ typedef std::unordered_map<std::string, std::string> Headers;
12
16
 
13
- static std::unique_ptr<IHttpResource> Make() noexcept;
17
+ struct BodyData {
18
+ enum class Type : size_t { Empty, String, Base64, Uri, Form } Type = Type::Empty;
19
+ std::string Data;
20
+ };
21
+
22
+ struct Response {
23
+ int64_t StatusCode;
24
+ Headers Headers;
25
+ std::string Url;
26
+ };
27
+
28
+ static std::shared_ptr<IHttpResource> Make() noexcept;
14
29
 
15
30
  virtual ~IHttpResource() noexcept {}
16
31
 
17
32
  virtual void SendRequest(
18
- const std::string &method,
19
- const std::string &url,
20
- const Headers &headers,
21
- folly::dynamic bodyData, // ISS:2365799 - Make non-folly.
22
- const std::string &responseType,
33
+ std::string &&method,
34
+ std::string &&url,
35
+ Headers &&headers,
36
+ BodyData &&bodyData,
37
+ std::string &&responseType,
23
38
  bool useIncrementalUpdates,
24
- std::int64_t timeout,
39
+ int64_t timeout,
40
+ bool withCredentials,
25
41
  std::function<void(int64_t)> &&callback) noexcept = 0;
26
- virtual void AbortRequest() noexcept = 0;
42
+ virtual void AbortRequest(int64_t requestId) noexcept = 0;
43
+
27
44
  virtual void ClearCookies() noexcept = 0;
28
45
 
29
- virtual void SetOnRequest(std::function<void()> &&handler) noexcept = 0;
30
- virtual void SetOnResponse(std::function<void(const std::string &)> &&handler) noexcept = 0;
31
- virtual void SetOnError(std::function<void(const std::string &)> &&handler) noexcept = 0;
46
+ virtual void SetOnRequest(std::function<void(int64_t requestId)> &&handler) noexcept = 0; // TODO: Keep???
47
+ virtual void SetOnResponse(std::function<void(int64_t requestId, Response &&response)> &&handler) noexcept = 0;
48
+ virtual void SetOnData(std::function<void(int64_t requestId, std::string &&responseData)> &&handler) noexcept = 0;
49
+ virtual void SetOnError(
50
+ std::function<void(int64_t requestId, std::string &&errorMessage /*, bool isTimeout*/)> &&handler) noexcept = 0;
32
51
  };
33
52
 
34
53
  } // namespace Microsoft::React
@@ -71,7 +71,7 @@ struct IWebSocketResource {
71
71
 
72
72
  struct Error {
73
73
  std::string Message;
74
- const ErrorType Type;
74
+ ErrorType Type;
75
75
  };
76
76
 
77
77
  #pragma endregion Inner types
@@ -22,7 +22,7 @@ class NapiJsiV8RuntimeHolder : public Microsoft::JSI::RuntimeHolderLazyInit {
22
22
  std::unique_ptr<facebook::jsi::PreparedScriptStore> &&preparedScriptStore) noexcept;
23
23
 
24
24
  private:
25
- static void ScheduleTaskCallback(
25
+ static void __cdecl ScheduleTaskCallback(
26
26
  napi_env env,
27
27
  napi_ext_task_callback taskCb,
28
28
  void *taskData,