react-native-windows 0.71.24 → 0.71.25

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.
Files changed (77) hide show
  1. package/Directory.Build.props +5 -0
  2. package/Libraries/Network/RCTNetworking.windows.js +10 -16
  3. package/Microsoft.ReactNative/IReactDispatcher.cpp +4 -0
  4. package/Microsoft.ReactNative/IReactDispatcher.h +1 -0
  5. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +3 -7
  6. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +0 -7
  7. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +43 -21
  8. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +0 -2
  9. package/Microsoft.ReactNative/Views/DevMenu.cpp +3 -3
  10. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiLoader.cpp +16 -0
  11. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +43 -12
  12. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +17 -6
  13. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpApp.targets +1 -1
  14. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.targets +1 -1
  15. package/PropertySheets/External/Microsoft.ReactNative.WinAppSDK.CSharpApp.targets +1 -1
  16. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  17. package/PropertySheets/JSEngine.props +4 -4
  18. package/PropertySheets/React.Cpp.props +3 -3
  19. package/PropertySheets/Warnings.props +6 -0
  20. package/ReactCommon/ReactCommon.vcxproj +53 -1
  21. package/ReactCommon/cgmanifest.json +15 -0
  22. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +36 -0
  23. package/Shared/BaseFileReaderResource.cpp +95 -0
  24. package/Shared/BaseFileReaderResource.h +41 -0
  25. package/Shared/CreateModules.h +27 -5
  26. package/Shared/DevSupportManager.cpp +2 -9
  27. package/Shared/DevSupportManager.h +2 -6
  28. package/Shared/HermesRuntimeHolder.cpp +344 -84
  29. package/Shared/HermesRuntimeHolder.h +32 -21
  30. package/Shared/HermesSamplingProfiler.cpp +66 -14
  31. package/Shared/HermesSamplingProfiler.h +5 -3
  32. package/Shared/IFileReaderResource.h +36 -0
  33. package/Shared/InspectorPackagerConnection.cpp +62 -108
  34. package/Shared/InspectorPackagerConnection.h +9 -21
  35. package/Shared/JSI/RuntimeHolder.h +2 -2
  36. package/Shared/JSI/ScriptStore.h +18 -20
  37. package/Shared/JSI/V8RuntimeHolder.cpp +260 -0
  38. package/Shared/JSI/V8RuntimeHolder.h +37 -0
  39. package/Shared/Modules/BlobModule.cpp +93 -298
  40. package/Shared/Modules/BlobModule.h +25 -91
  41. package/Shared/Modules/CxxModuleUtilities.cpp +32 -0
  42. package/Shared/Modules/CxxModuleUtilities.h +17 -0
  43. package/Shared/Modules/FileReaderModule.cpp +118 -51
  44. package/Shared/Modules/FileReaderModule.h +27 -1
  45. package/Shared/Modules/HttpModule.cpp +133 -9
  46. package/Shared/Modules/HttpModule.h +33 -0
  47. package/Shared/Modules/IRequestBodyHandler.h +6 -4
  48. package/Shared/Modules/IResponseHandler.h +3 -3
  49. package/Shared/Modules/IUriHandler.h +3 -3
  50. package/Shared/Modules/IWebSocketModuleContentHandler.h +6 -4
  51. package/Shared/Modules/WebSocketModule.cpp +190 -7
  52. package/Shared/Modules/WebSocketTurboModule.h +52 -0
  53. package/Shared/Networking/DefaultBlobResource.cpp +323 -0
  54. package/Shared/Networking/DefaultBlobResource.h +133 -0
  55. package/Shared/Networking/IBlobResource.h +56 -0
  56. package/Shared/Networking/IHttpResource.h +6 -5
  57. package/Shared/Networking/WinRTHttpResource.cpp +40 -32
  58. package/Shared/Networking/WinRTHttpResource.h +4 -3
  59. package/Shared/Networking/WinRTTypes.h +3 -3
  60. package/Shared/OInstance.cpp +17 -33
  61. package/Shared/SafeLoadLibrary.cpp +41 -0
  62. package/Shared/SafeLoadLibrary.h +15 -0
  63. package/Shared/Shared.vcxitems +27 -9
  64. package/Shared/Shared.vcxitems.filters +47 -33
  65. package/package.json +2 -2
  66. package/template/cs-app-WinAppSDK/proj/ExperimentalFeatures.props +1 -1
  67. package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +0 -59
  68. package/Microsoft.ReactNative/Base/CoreNativeModules.h +0 -30
  69. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +0 -2103
  70. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.h +0 -73
  71. package/Shared/HermesShim.cpp +0 -118
  72. package/Shared/HermesShim.h +0 -21
  73. package/Shared/JSI/NapiJsiV8RuntimeHolder.cpp +0 -209
  74. package/Shared/JSI/NapiJsiV8RuntimeHolder.h +0 -44
  75. package/Shared/V8JSIRuntimeHolder.cpp +0 -70
  76. package/Shared/V8JSIRuntimeHolder.h +0 -53
  77. /package/Shared/{Modules/IBlobPersistor.h → IBlobPersistor.h} +0 -0
@@ -3,19 +3,21 @@
3
3
 
4
4
  #pragma once
5
5
 
6
+ #include <ReactHost/React.h>
7
+ #include <atomic>
6
8
  #include <string>
7
9
 
8
10
  namespace Microsoft::ReactNative {
9
11
 
10
12
  class HermesSamplingProfiler final {
11
13
  public:
12
- static winrt::fire_and_forget Start() noexcept;
13
- static std::future<std::string> Stop() noexcept;
14
+ static winrt::fire_and_forget Start(Mso::CntPtr<Mso::React::IReactContext> const &reactContext) noexcept;
15
+ static std::future<std::string> Stop(Mso::CntPtr<Mso::React::IReactContext> const &reactContext) noexcept;
14
16
  static std::string GetLastTraceFilePath() noexcept;
15
17
  static bool IsStarted() noexcept;
16
18
 
17
19
  private:
18
- static bool s_isStarted;
20
+ static std::atomic_bool s_isStarted;
19
21
  static std::string s_lastTraceFilePath;
20
22
  };
21
23
 
@@ -0,0 +1,36 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include "IBlobPersistor.h"
7
+
8
+ // Standard Library
9
+ #include <functional>
10
+ #include <string>
11
+
12
+ namespace Microsoft::React {
13
+
14
+ struct IFileReaderResource {
15
+ virtual ~IFileReaderResource() noexcept {}
16
+
17
+ virtual void ReadAsText(
18
+ std::string &&blobId,
19
+ int64_t offset,
20
+ int64_t size,
21
+ std::string &&encoding,
22
+ std::function<void(std::string &&)> &&resolver,
23
+ std::function<void(std::string &&)> &&rejecter) noexcept = 0;
24
+
25
+ virtual void ReadAsDataUrl(
26
+ std::string &&blobId,
27
+ int64_t offset,
28
+ int64_t size,
29
+ std::string &&type,
30
+ std::function<void(std::string &&)> &&resolver,
31
+ std::function<void(std::string &&)> &&rejecter) noexcept = 0;
32
+
33
+ static std::shared_ptr<IFileReaderResource> Make(std::weak_ptr<IBlobPersistor> weakBlobPersistor) noexcept;
34
+ };
35
+
36
+ } // namespace Microsoft::React
@@ -3,18 +3,10 @@
3
3
 
4
4
  #include "pch.h"
5
5
 
6
- #ifdef HERMES_ENABLE_DEBUGGER
7
-
8
6
  #include <folly/json.h>
9
7
  #include <tracing/tracing.h>
10
8
  #include "InspectorPackagerConnection.h"
11
9
 
12
- namespace facebook {
13
- namespace react {
14
- IDestructible::~IDestructible() {}
15
- } // namespace react
16
- } // namespace facebook
17
-
18
10
  namespace Microsoft::ReactNative {
19
11
 
20
12
  namespace {
@@ -80,35 +72,16 @@ struct InspectorProtocol {
80
72
  }
81
73
 
82
74
  static folly::dynamic constructGetPagesResponsePayloadForPackager(
83
- const std::vector<facebook::react::InspectorPage2> &pages,
84
- InspectorPackagerConnection::BundleStatus bundleStatus) {
85
- folly::dynamic payload = folly::dynamic::array;
86
- for (const facebook::react::InspectorPage2 &page : pages) {
87
- folly::dynamic pageDyn = folly::dynamic::object;
88
- pageDyn["id"] = page.id;
89
- pageDyn["title"] = page.title;
90
- pageDyn["vm"] = page.vm;
91
-
92
- pageDyn["isLastBundleDownloadSuccess"] = bundleStatus.m_isLastDownloadSucess;
93
- pageDyn["bundleUpdateTimestamp"] = bundleStatus.m_updateTimestamp;
94
-
95
- payload.push_back(pageDyn);
96
- }
97
- return payload;
98
- }
99
-
100
- static folly::dynamic constructGetPagesResponsePayloadForPackager(
101
- std::unique_ptr<facebook::react::IInspectorPages> pages,
75
+ const std::vector<facebook::react::InspectorPage> &pages,
102
76
  InspectorPackagerConnection::BundleStatus bundleStatus) {
103
77
  folly::dynamic payload = folly::dynamic::array;
104
- for (int p = 0; p < pages->size(); p++) {
105
- const facebook::react::InspectorPage2 page = pages->getPage(p);
78
+ for (const facebook::react::InspectorPage &page : pages) {
106
79
  folly::dynamic pageDyn = folly::dynamic::object;
107
80
  pageDyn["id"] = page.id;
108
81
  pageDyn["title"] = page.title;
109
82
  pageDyn["vm"] = page.vm;
110
83
 
111
- pageDyn["isLastBundleDownloadSuccess"] = bundleStatus.m_isLastDownloadSucess;
84
+ pageDyn["isLastBundleDownloadSuccess"] = bundleStatus.m_isLastDownloadSuccess;
112
85
  pageDyn["bundleUpdateTimestamp"] = bundleStatus.m_updateTimestamp;
113
86
 
114
87
  payload.push_back(pageDyn);
@@ -116,14 +89,14 @@ struct InspectorProtocol {
116
89
  return payload;
117
90
  }
118
91
 
119
- static folly::dynamic constructVMResponsePayloadForPackager(int64_t pageId, std::string &&messageFromVM) {
92
+ static folly::dynamic constructVMResponsePayloadForPackager(int32_t pageId, std::string &&messageFromVM) {
120
93
  folly::dynamic payload = folly::dynamic::object;
121
94
  payload[InspectorProtocol::Message_eventName_wrappedEvent] = messageFromVM;
122
95
  payload[InspectorProtocol::Message_PAGEID] = pageId;
123
96
  return payload;
124
97
  }
125
98
 
126
- static folly::dynamic constructVMResponsePayloadOnDisconnectForPackager(int64_t pageId) {
99
+ static folly::dynamic constructVMResponsePayloadOnDisconnectForPackager(int32_t pageId) {
127
100
  folly::dynamic payload = folly::dynamic::object;
128
101
  payload[InspectorProtocol::Message_PAGEID] = pageId;
129
102
  return payload;
@@ -132,7 +105,7 @@ struct InspectorProtocol {
132
105
 
133
106
  } // namespace
134
107
 
135
- RemoteConnection::RemoteConnection(int64_t pageId, const InspectorPackagerConnection &packagerConnection)
108
+ RemoteConnection::RemoteConnection(int32_t pageId, const InspectorPackagerConnection &packagerConnection)
136
109
  : m_packagerConnection(packagerConnection), m_pageId(pageId) {}
137
110
 
138
111
  void RemoteConnection::onMessage(std::string message) {
@@ -152,26 +125,6 @@ void RemoteConnection::onDisconnect() {
152
125
  m_packagerConnection.sendMessageToPackager(std::move(responsestr));
153
126
  }
154
127
 
155
- RemoteConnection2::RemoteConnection2(int64_t pageId, const InspectorPackagerConnection &packagerConnection)
156
- : m_packagerConnection(packagerConnection), m_pageId(pageId) {}
157
-
158
- void RemoteConnection2::onMessage(std::string message) {
159
- folly::dynamic response = InspectorProtocol::constructResponseForPackager(
160
- InspectorProtocol::EventType::WrappedEvent,
161
- InspectorProtocol::constructVMResponsePayloadForPackager(m_pageId, std::move(message)));
162
- std::string responsestr = folly::toJson(response);
163
- m_packagerConnection.sendMessageToPackager(std::move(responsestr));
164
- }
165
-
166
- void RemoteConnection2::onDisconnect() {
167
- folly::dynamic response = InspectorProtocol::constructResponseForPackager(
168
- InspectorProtocol::EventType::Disconnect,
169
- InspectorProtocol::constructVMResponsePayloadOnDisconnectForPackager(m_pageId));
170
-
171
- std::string responsestr = folly::toJson(response);
172
- m_packagerConnection.sendMessageToPackager(std::move(responsestr));
173
- }
174
-
175
128
  winrt::fire_and_forget InspectorPackagerConnection::sendMessageToPackagerAsync(std::string &&message) const {
176
129
  std::string message_(std::move(message));
177
130
  co_await winrt::resume_background();
@@ -183,7 +136,7 @@ void InspectorPackagerConnection::sendMessageToPackager(std::string &&message) c
183
136
  sendMessageToPackagerAsync(std::move(message));
184
137
  }
185
138
 
186
- void InspectorPackagerConnection::sendMessageToVM(int64_t pageId, std::string &&message) {
139
+ void InspectorPackagerConnection::sendMessageToVM(int32_t pageId, std::string &&message) {
187
140
  m_localConnections[pageId]->sendMessage(std::move(message));
188
141
  }
189
142
 
@@ -214,59 +167,62 @@ winrt::fire_and_forget InspectorPackagerConnection::connectAsync() {
214
167
  m_packagerWebSocketConnection->SetOnConnect(
215
168
  []() { facebook::react::tracing::log("Inspector: Websocket connection succeeded."); });
216
169
 
217
- m_packagerWebSocketConnection->SetOnMessage(
218
- [self = shared_from_this()](size_t /*length*/, const std::string &message, bool isBinary) {
219
- assert(!isBinary && "We don't expect any binary messages !");
220
- folly::dynamic messageDyn = folly::parseJson(message);
221
-
222
- InspectorProtocol::EventType eventType = InspectorProtocol::getEventType(messageDyn);
223
- switch (eventType) {
224
- case InspectorProtocol::EventType::GetPages: {
225
- std::unique_ptr<facebook::react::IInspectorPages> inspectorPages = facebook::react::getInspectorPages();
226
- folly::dynamic response = InspectorProtocol::constructResponseForPackager(
227
- InspectorProtocol::EventType::GetPages,
228
- InspectorProtocol::constructGetPagesResponsePayloadForPackager(
229
- std::move(inspectorPages), self->m_bundleStatusProvider->getBundleStatus()));
230
-
231
- std::string responsestr = folly::toJson(response);
232
- self->sendMessageToPackager(std::move(responsestr));
233
- } break;
234
-
235
- case InspectorProtocol::EventType::WrappedEvent: {
236
- folly::dynamic payload = messageDyn[InspectorProtocol::Message_PAYLOAD];
237
- int64_t pageId = payload[InspectorProtocol::Message_PAGEID].asInt();
238
-
239
- if (self->m_localConnections.find(pageId) == self->m_localConnections.end()) {
240
- break;
241
- }
242
-
243
- std::string wrappedEvent = payload[InspectorProtocol::Message_eventName_wrappedEvent].getString();
244
- self->sendMessageToVM(pageId, std::move(wrappedEvent));
245
- } break;
246
-
247
- case InspectorProtocol::EventType::Connect: {
248
- folly::dynamic payload = messageDyn[InspectorProtocol::Message_PAYLOAD];
249
- int64_t pageId = payload[InspectorProtocol::Message_PAGEID].asInt();
250
-
251
- if (self->m_localConnections.find(pageId) != self->m_localConnections.end()) {
252
- break;
253
- }
254
-
255
- self->m_localConnections[pageId] = facebook::react::connectInspectorPage(
256
- static_cast<int>(pageId), std::make_unique<RemoteConnection2>(pageId, *self));
257
- } break;
258
-
259
- case InspectorProtocol::EventType::Disconnect: {
260
- folly::dynamic payload = messageDyn[InspectorProtocol::Message_PAYLOAD];
261
- int64_t pageId = payload[InspectorProtocol::Message_PAGEID].asInt();
262
- if (self->m_localConnections.find(pageId) != self->m_localConnections.end()) {
263
- self->m_localConnections[pageId]->disconnect();
264
- self->m_localConnections.erase(pageId);
265
- }
266
-
267
- } break;
170
+ m_packagerWebSocketConnection->SetOnMessage([self = shared_from_this()](
171
+ size_t /*length*/, const std::string &message, bool isBinary) {
172
+ assert(!isBinary && "We don't expect any binary messages !");
173
+ folly::dynamic messageDyn = folly::parseJson(message);
174
+
175
+ InspectorProtocol::EventType eventType = InspectorProtocol::getEventType(messageDyn);
176
+ switch (eventType) {
177
+ case InspectorProtocol::EventType::GetPages: {
178
+ std::vector<facebook::react::InspectorPage> inspectorPages = facebook::react::getInspectorInstance().getPages();
179
+ folly::dynamic response = InspectorProtocol::constructResponseForPackager(
180
+ InspectorProtocol::EventType::GetPages,
181
+ InspectorProtocol::constructGetPagesResponsePayloadForPackager(
182
+ inspectorPages, self->m_bundleStatusProvider->getBundleStatus()));
183
+
184
+ std::string responsestr = folly::toJson(response);
185
+ self->sendMessageToPackager(std::move(responsestr));
186
+ break;
187
+ }
188
+
189
+ case InspectorProtocol::EventType::WrappedEvent: {
190
+ folly::dynamic payload = messageDyn[InspectorProtocol::Message_PAYLOAD];
191
+ int32_t pageId = static_cast<int32_t>(payload[InspectorProtocol::Message_PAGEID].asInt());
192
+
193
+ if (self->m_localConnections.find(pageId) == self->m_localConnections.end()) {
194
+ break;
268
195
  }
269
- });
196
+
197
+ std::string wrappedEvent = payload[InspectorProtocol::Message_eventName_wrappedEvent].getString();
198
+ self->sendMessageToVM(pageId, std::move(wrappedEvent));
199
+ break;
200
+ }
201
+
202
+ case InspectorProtocol::EventType::Connect: {
203
+ folly::dynamic payload = messageDyn[InspectorProtocol::Message_PAYLOAD];
204
+ int32_t pageId = static_cast<int32_t>(payload[InspectorProtocol::Message_PAGEID].asInt());
205
+
206
+ if (self->m_localConnections.find(pageId) != self->m_localConnections.end()) {
207
+ break;
208
+ }
209
+
210
+ self->m_localConnections[pageId] =
211
+ facebook::react::getInspectorInstance().connect(pageId, std::make_unique<RemoteConnection>(pageId, *self));
212
+ break;
213
+ }
214
+
215
+ case InspectorProtocol::EventType::Disconnect: {
216
+ folly::dynamic payload = messageDyn[InspectorProtocol::Message_PAYLOAD];
217
+ int32_t pageId = static_cast<int32_t>(payload[InspectorProtocol::Message_PAGEID].asInt());
218
+ if (self->m_localConnections.find(pageId) != self->m_localConnections.end()) {
219
+ self->m_localConnections[pageId]->disconnect();
220
+ self->m_localConnections.erase(pageId);
221
+ }
222
+ break;
223
+ }
224
+ }
225
+ });
270
226
 
271
227
  Microsoft::React::Networking::IWebSocketResource::Protocols protocols;
272
228
  Microsoft::React::Networking::IWebSocketResource::Options options;
@@ -276,5 +232,3 @@ winrt::fire_and_forget InspectorPackagerConnection::connectAsync() {
276
232
  }
277
233
 
278
234
  } // namespace Microsoft::ReactNative
279
-
280
- #endif
@@ -3,7 +3,6 @@
3
3
 
4
4
  #pragma once
5
5
 
6
- #include <InspectorProxy.h>
7
6
  #include <Networking/WinRTWebSocketResource.h>
8
7
  #include <jsinspector/InspectorInterfaces.h>
9
8
 
@@ -16,12 +15,12 @@ class InspectorPackagerConnection final : public std::enable_shared_from_this<In
16
15
 
17
16
  class BundleStatus {
18
17
  public:
19
- bool m_isLastDownloadSucess;
18
+ bool m_isLastDownloadSuccess;
20
19
  int64_t m_updateTimestamp = -1;
21
20
 
22
- BundleStatus(bool isLastDownloadSucess, long updateTimestamp)
23
- : m_isLastDownloadSucess(isLastDownloadSucess), m_updateTimestamp(updateTimestamp) {}
24
- BundleStatus() : m_isLastDownloadSucess(false), m_updateTimestamp(-1) {}
21
+ BundleStatus(bool isLastDownloadSuccess, long updateTimestamp)
22
+ : m_isLastDownloadSuccess(isLastDownloadSuccess), m_updateTimestamp(updateTimestamp) {}
23
+ BundleStatus() : m_isLastDownloadSuccess(false), m_updateTimestamp(-1) {}
25
24
  };
26
25
 
27
26
  struct IBundleStatusProvider {
@@ -32,16 +31,16 @@ class InspectorPackagerConnection final : public std::enable_shared_from_this<In
32
31
 
33
32
  private:
34
33
  friend class RemoteConnection;
35
- friend class RemoteConnection2;
36
34
 
37
35
  winrt::fire_and_forget sendMessageToPackagerAsync(std::string &&message) const;
38
36
  void sendMessageToPackager(std::string &&message) const;
39
37
 
40
38
  // Note:: VM side Inspector processes the messages asynchronousely in a sequential executor with dedicated thread.
41
39
  // Hence, we don't bother invoking the inspector asynchronously.
42
- void sendMessageToVM(int64_t pageId, std::string &&message);
40
+ void sendMessageToVM(int32_t pageId, std::string &&message);
43
41
 
44
- std::unordered_map<int64_t, std::unique_ptr<facebook::react::ILocalConnection>> m_localConnections;
42
+ private:
43
+ std::unordered_map<int32_t, std::unique_ptr<facebook::react::ILocalConnection>> m_localConnections;
45
44
  std::shared_ptr<Microsoft::React::Networking::WinRTWebSocketResource> m_packagerWebSocketConnection;
46
45
  std::shared_ptr<IBundleStatusProvider> m_bundleStatusProvider;
47
46
  std::string m_url;
@@ -49,23 +48,12 @@ class InspectorPackagerConnection final : public std::enable_shared_from_this<In
49
48
 
50
49
  class RemoteConnection final : public facebook::react::IRemoteConnection {
51
50
  public:
52
- RemoteConnection(int64_t pageId, const InspectorPackagerConnection &packagerConnection);
53
- void onMessage(std::string message) override;
54
- void onDisconnect() override;
55
-
56
- private:
57
- int64_t m_pageId;
58
- const InspectorPackagerConnection &m_packagerConnection;
59
- };
60
-
61
- class RemoteConnection2 final : public facebook::react::IRemoteConnection2 {
62
- public:
63
- RemoteConnection2(int64_t pageId, const InspectorPackagerConnection &packagerConnection);
51
+ RemoteConnection(int32_t pageId, const InspectorPackagerConnection &packagerConnection);
64
52
  void onMessage(std::string message) override;
65
53
  void onDisconnect() override;
66
54
 
67
55
  private:
68
- int64_t m_pageId;
56
+ int32_t m_pageId;
69
57
  const InspectorPackagerConnection &m_packagerConnection;
70
58
  };
71
59
 
@@ -11,7 +11,7 @@ namespace Microsoft::JSI {
11
11
  // a. lazily create a JSI Runtime on the first call to getRuntime
12
12
  // b. subsequent calls to getRuntime should return the Runtime created in (a)
13
13
 
14
- // Note :: All calls to getRuntime() should happen on the same thread unless you are sure that
14
+ // Note: all calls to getRuntime() should happen on the same thread unless you are sure that
15
15
  // the underlying Runtime instance is thread safe.
16
16
 
17
17
  struct RuntimeHolderLazyInit {
@@ -21,7 +21,7 @@ struct RuntimeHolderLazyInit {
21
21
  virtual void teardown() noexcept {};
22
22
 
23
23
  // You can call this when a crash happens to attempt recording additional data
24
- // The fd supplied is a raw file stream an implementation might write JSON to
24
+ // The fileDescriptor supplied is a raw file stream an implementation might write JSON to.
25
25
  virtual void crashHandler(int fileDescriptor) noexcept {};
26
26
  };
27
27
 
@@ -5,12 +5,11 @@
5
5
  #include <jsi/jsi.h>
6
6
  #include <memory>
7
7
 
8
- namespace facebook {
9
- namespace jsi {
8
+ namespace facebook::jsi {
10
9
 
11
- // Integer type as it's persist friently.
12
- using ScriptVersion_t = uint64_t; // It shouldbe std::optional<uint64_t> once we have c++17 available everywhere. Until
13
- // then, 0 implies versioning not available.
10
+ // Integer type as it's persist friendly.
11
+ using ScriptVersion_t = uint64_t; // It should be std::optional<uint64_t> once we have c++17 available everywhere.
12
+ // Until then, 0 implies versioning not available.
14
13
  using JSRuntimeVersion_t = uint64_t; // 0 implies version can't be computed. We assert whenever that happens.
15
14
 
16
15
  struct VersionedBuffer {
@@ -30,14 +29,14 @@ struct JSRuntimeSignature {
30
29
 
31
30
  // Most JSI::Runtime implementation offer some form of prepared JavaScript which offers better performance
32
31
  // characteristics when loading comparing to plain JavaScript. Embedders can provide an instance of this interface
33
- // (through JSI::Runtime implementation's factory method), to enable persistance of the prepared script and retrieval on
34
- // subsequent evaluation of a script.
32
+ // (through JSI::Runtime implementation's factory method), to enable persistence of the prepared script
33
+ // and retrieval on subsequent evaluation of a script.
35
34
  struct PreparedScriptStore {
36
35
  virtual ~PreparedScriptStore() = default;
37
36
 
38
- // Try to retrieve the prepared javascript for a given combination of script & runtime.
39
- // scriptSignature : Javascript url and version
40
- // RuntimeSignature : Javascript engine type and version
37
+ // Try to retrieve the prepared JavaScript for a given combination of script & runtime.
38
+ // scriptSignature : JavaScript URL and version
39
+ // RuntimeSignature : JavaScript engine type and version
41
40
  // prepareTag : Custom tag to uniquely identify JS engine specific preparation schemes. It is usually useful while
42
41
  // experimentation and can be null. It is possible that no prepared script is available for a given script & runtime
43
42
  // signature. This method should null if so
@@ -47,12 +46,12 @@ struct PreparedScriptStore {
47
46
  const char *prepareTag // Optional tag. For e.g. eagerly evaluated vs lazy cache.
48
47
  ) noexcept = 0;
49
48
 
50
- // Persist the perpared javascript for a given combination of script & runtime.
51
- // scriptSignature : Javascript url and version
52
- // RuntimeSignature : Javascript engine type and version
49
+ // Persist the prepared JavaScript for a given combination of script & runtime.
50
+ // scriptSignature : JavaScript URL and version
51
+ // RuntimeSignature : JavaScript engine type and version
53
52
  // prepareTag : Custom tag to uniquely identify JS engine specific preparation schemes. It is usually useful while
54
53
  // experimentation and can be null. It is possible that no prepared script is available for a given script & runtime
55
- // signature. This method should null if so Any failure in persistance should be identified during the subsequent
54
+ // signature. This method should null if so Any failure in persistence should be identified during the subsequent
56
55
  // retrieval through the integrity mechanism which must be put into the storage.
57
56
  virtual void persistPreparedScript(
58
57
  std::shared_ptr<const facebook::jsi::Buffer> preparedScript,
@@ -63,17 +62,16 @@ struct PreparedScriptStore {
63
62
  };
64
63
 
65
64
  // JSI::Runtime implementation must be provided an instance on this interface to enable version sensitive capabilities
66
- // such as usage of pre-prepared javascript script. Alternatively, this entity can be used to directly provide the
67
- // Javascript buffer and rich metadata to the JSI::Runtime instance.
65
+ // such as usage of prepared JavaScript script. Alternatively, this entity can be used to directly provide the
66
+ // JavaScript buffer and rich meta data to the JSI::Runtime instance.
68
67
  struct ScriptStore {
69
68
  virtual ~ScriptStore() = default;
70
69
 
71
- // Return the Javascript buffer and version corresponding to a given url.
70
+ // Return the JavaScript buffer and version corresponding to a given URL.
72
71
  virtual VersionedBuffer getVersionedScript(const std::string &url) noexcept = 0;
73
72
 
74
- // Return the version of the Javascript buffer corresponding to a given url.
73
+ // Return the version of the JavaScript buffer corresponding to a given URL.
75
74
  virtual ScriptVersion_t getScriptVersion(const std::string &url) noexcept = 0;
76
75
  };
77
76
 
78
- } // namespace jsi
79
- } // namespace facebook
77
+ } // namespace facebook::jsi