react-native-windows 0.78.5 → 0.78.6
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/Directory.Build.props +6 -4
- package/Folly/Folly.vcxproj +46 -6
- package/Folly/Folly.vcxproj.filters +16 -4
- package/Folly/TEMP_UntilFollyUpdate/ConstexprMath.h +26 -18
- package/Folly/TEMP_UntilFollyUpdate/Conv.cpp +1205 -0
- package/Folly/TEMP_UntilFollyUpdate/chrono/Hardware.h +155 -0
- package/Folly/TEMP_UntilFollyUpdate/concurrency/CacheLocality.cpp +633 -0
- package/Folly/TEMP_UntilFollyUpdate/{dynamic-inl.h → json/dynamic-inl.h} +3 -4
- package/Folly/TEMP_UntilFollyUpdate/{json.cpp → json/json.cpp} +14 -10
- package/Folly/TEMP_UntilFollyUpdate/lang/SafeAssert.h +7 -14
- package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.h +6 -6
- package/Folly/ThreadNameStub.cpp +10 -0
- package/Folly/cgmanifest.json +11 -1
- package/Libraries/Components/View/View.windows.js +107 -56
- package/Libraries/Components/View/ViewAccessibility.d.ts +60 -1
- package/Libraries/Image/Image.windows.js +42 -21
- package/Libraries/Modal/Modal.d.ts +7 -0
- package/Libraries/Modal/Modal.windows.js +7 -1
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -0
- package/Libraries/Text/Text.d.ts +18 -0
- package/Microsoft.ReactNative/AsynchronousEventBeat.cpp +4 -25
- package/Microsoft.ReactNative/AsynchronousEventBeat.h +0 -3
- package/Microsoft.ReactNative/Base/FollyIncludes.h +1 -0
- package/Microsoft.ReactNative/CallInvoker.cpp +42 -0
- package/Microsoft.ReactNative/CallInvoker.h +34 -0
- package/Microsoft.ReactNative/{JSDispatcherWriter.cpp → CallInvokerWriter.cpp} +35 -47
- package/Microsoft.ReactNative/CallInvokerWriter.h +74 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +0 -5
- package/Microsoft.ReactNative/CompositionSwitcher.idl +7 -0
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +8 -10
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +12 -2
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.cpp +100 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionAnnotationProvider.h +31 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +77 -11
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +43 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +7 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +86 -56
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +5 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionUIService.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +118 -63
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -8
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +16 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +4 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +9 -1
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +34 -11
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +133 -135
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +9 -6
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +46 -49
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +13 -8
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +5 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +146 -25
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +14 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +160 -12
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +47 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +15 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.cpp +6 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputProps.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +7 -9
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -1
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +5 -0
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +40 -36
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +68 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +11 -0
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +70 -13
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +10 -2
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +5 -5
- package/Microsoft.ReactNative/Fabric/ImageRequestParams.cpp +26 -0
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +47 -8
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.h +10 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/CompositionAccessibilityProps.h +67 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +22 -4
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.h +15 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +20 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +5 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/MouseEvent.h +20 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +5 -8
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorParser.h +1 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +247 -45
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +15 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/MessageQueueThreadImpl.cpp +39 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/MessageQueueThreadImpl.h +54 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.cpp +126 -0
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.h +73 -0
- package/Microsoft.ReactNative/IReactContext.cpp +17 -0
- package/Microsoft.ReactNative/IReactContext.h +1 -0
- package/Microsoft.ReactNative/IReactContext.idl +18 -1
- package/Microsoft.ReactNative/IReactDispatcher.idl +1 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.cpp +12 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.h +2 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.idl +8 -0
- package/Microsoft.ReactNative/JsiApi.cpp +10 -2
- package/Microsoft.ReactNative/JsiApi.h +1 -0
- package/Microsoft.ReactNative/JsiApi.idl +1 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +0 -3
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +2 -3
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +7 -12
- package/Microsoft.ReactNative/Modules/Animated/AnimationDriver.cpp +2 -1
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedModule.cpp +4 -8
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/ClipboardModule.cpp +6 -8
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +6 -15
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +13 -24
- package/Microsoft.ReactNative/QuirkSettings.cpp +0 -16
- package/Microsoft.ReactNative/QuirkSettings.h +0 -3
- package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +11 -1
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +78 -68
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -2
- package/Microsoft.ReactNative/ReactInstanceSettings.cpp +12 -0
- package/Microsoft.ReactNative/ReactInstanceSettings.h +2 -0
- package/Microsoft.ReactNative/ReactInstanceSettings.idl +6 -0
- package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
- package/Microsoft.ReactNative/ReactSupport.cpp +44 -11
- package/Microsoft.ReactNative/RedBox.cpp +30 -1
- package/Microsoft.ReactNative/SchedulerSettings.cpp +4 -4
- package/Microsoft.ReactNative/SchedulerSettings.h +1 -1
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +30 -12
- package/Microsoft.ReactNative/Utils/ImageUtils.h +1 -0
- package/Microsoft.ReactNative/Utils/LocalBundleReader.cpp +37 -31
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.cpp +1 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.inc +2 -0
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_posix.cpp +1 -1
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +94 -27
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +27 -6
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.cpp +45 -11
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.h +6 -0
- package/Microsoft.ReactNative.Cxx/JSI/decorator.h +220 -0
- package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +28 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +6 -0
- package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +241 -4
- package/Microsoft.ReactNative.Cxx/JSI/jsi.h +207 -19
- package/Microsoft.ReactNative.Cxx/JSValue.cpp +19 -3
- package/Microsoft.ReactNative.Cxx/JSValue.h +15 -7
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +2 -2
- package/Microsoft.ReactNative.Cxx/NativeModules.h +60 -2
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +1267 -614
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.h +4 -2
- package/Microsoft.ReactNative.Cxx/ReactContext.h +7 -0
- package/Microsoft.ReactNative.Cxx/TurboModuleProvider.cpp +11 -13
- package/Microsoft.ReactNative.Cxx/TurboModuleProvider.h +2 -3
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +81 -20
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +47 -2
- package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +13 -0
- package/Microsoft.ReactNative.Cxx/stubs/glog/logging.h +1 -1
- package/Microsoft.ReactNative.Managed/ReactContext.cs +3 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/React.Cpp.props +2 -1
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jserrorhandler/JsErrorHandler.cpp +429 -0
- package/ReactCommon/cgmanifest.json +1 -1
- package/Shared/HermesRuntimeHolder.cpp +6 -0
- package/Shared/JSI/ChakraRuntime.cpp +4 -0
- package/Shared/JSI/ChakraRuntime.h +2 -0
- package/Shared/Modules/BlobModule.cpp +14 -16
- package/Shared/Modules/BlobModule.h +3 -1
- package/Shared/Shared.vcxitems +11 -7
- package/Shared/Shared.vcxitems.filters +6 -1
- package/Shared/TurboModuleManager.cpp +0 -15
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +6 -6
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +6 -6
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +6 -6
- package/codegen/react/components/rnwcore/InputAccessory.g.h +6 -6
- package/codegen/react/components/rnwcore/ModalHostView.g.h +11 -7
- package/codegen/react/components/rnwcore/Props.cpp +2 -1
- package/codegen/react/components/rnwcore/Props.h +1 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +6 -6
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +6 -6
- package/codegen/react/components/rnwcore/Switch.g.h +6 -6
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +6 -6
- package/index.windows.js +4 -2
- package/package.json +3 -4
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
- package/stubs/glog/logging.h +1 -1
- package/Microsoft.ReactNative/JSDispatcherWriter.h +0 -47
- package/Microsoft.ReactNative/SynchronousEventBeat.cpp +0 -51
- package/Microsoft.ReactNative/SynchronousEventBeat.h +0 -31
|
@@ -10,20 +10,12 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
|
|
|
10
10
|
|
|
11
11
|
namespace winrt::Microsoft::ReactNative {
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
namespace Details {
|
|
14
|
+
// Try to get JSI Runtime for the ReactContext
|
|
14
15
|
// If it is not found, then create it based on context JSI runtime and store it in the context.Properties().
|
|
15
16
|
// The function returns nullptr if the current context does not have JSI runtime.
|
|
16
17
|
// It makes sure that the JSI runtime holder is removed when the instance is unloaded.
|
|
17
|
-
|
|
18
|
-
ReactDispatcher jsDispatcher = context.JSDispatcher();
|
|
19
|
-
VerifyElseCrashSz(jsDispatcher.HasThreadAccess(), "Must be in JS thread");
|
|
20
|
-
|
|
21
|
-
// The JSI runtime is not available if we do Web debugging when JS is running in web browser.
|
|
22
|
-
JsiRuntime abiJsiRuntime = context.Handle().JSRuntime().as<JsiRuntime>();
|
|
23
|
-
if (!abiJsiRuntime) {
|
|
24
|
-
return nullptr;
|
|
25
|
-
}
|
|
26
|
-
|
|
18
|
+
JsiAbiRuntime *TryGetOrCreateContextRuntime(ReactContext const &context, JsiRuntime const &abiJsiRuntime) noexcept {
|
|
27
19
|
// See if the JSI runtime was previously created.
|
|
28
20
|
JsiAbiRuntime *runtime = JsiAbiRuntime::GetFromJsiRuntime(abiJsiRuntime);
|
|
29
21
|
if (!runtime) {
|
|
@@ -57,6 +49,48 @@ facebook::jsi::Runtime *TryGetOrCreateContextRuntime(ReactContext const &context
|
|
|
57
49
|
return runtime;
|
|
58
50
|
}
|
|
59
51
|
|
|
52
|
+
} // namespace Details
|
|
53
|
+
|
|
54
|
+
facebook::jsi::Runtime *TryGetOrCreateContextRuntime(
|
|
55
|
+
ReactContext const &context,
|
|
56
|
+
winrt::Windows::Foundation::IInspectable const &runtimeHandle) noexcept {
|
|
57
|
+
if (!runtimeHandle) {
|
|
58
|
+
return nullptr;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// The JSI runtime is not available if we do Web debugging when JS is running in web browser.
|
|
62
|
+
JsiRuntime abiJsiRuntime = runtimeHandle.as<JsiRuntime>();
|
|
63
|
+
if (!abiJsiRuntime) {
|
|
64
|
+
return nullptr;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return Details::TryGetOrCreateContextRuntime(context, abiJsiRuntime);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Note: deprecated in favor of TryGetOrCreateContextRuntime with Handle parameter
|
|
71
|
+
facebook::jsi::Runtime *TryGetOrCreateContextRuntime(ReactContext const &context) noexcept {
|
|
72
|
+
#ifdef DEBUG
|
|
73
|
+
ReactDispatcher jsDispatcher = context.JSDispatcher();
|
|
74
|
+
VerifyElseCrashSz(jsDispatcher.HasThreadAccess(), "Must be in JS thread");
|
|
75
|
+
#endif
|
|
76
|
+
|
|
77
|
+
if (auto runtimeHandle = context.Handle().JSRuntime()) {
|
|
78
|
+
return TryGetOrCreateContextRuntime(context, runtimeHandle);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return nullptr;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Calls TryGetOrCreateContextRuntime to get JSI runtime.
|
|
85
|
+
// It crashes when TryGetOrCreateContextRuntime returns null.
|
|
86
|
+
[[deprecated]] facebook::jsi::Runtime &GetOrCreateContextRuntime(
|
|
87
|
+
ReactContext const &context,
|
|
88
|
+
winrt::Windows::Foundation::IInspectable const &runtimeHandle) noexcept {
|
|
89
|
+
facebook::jsi::Runtime *runtime = TryGetOrCreateContextRuntime(context, runtimeHandle);
|
|
90
|
+
VerifyElseCrashSz(runtime, "JSI runtime is not available");
|
|
91
|
+
return *runtime;
|
|
92
|
+
}
|
|
93
|
+
|
|
60
94
|
// Calls TryGetOrCreateContextRuntime to get JSI runtime.
|
|
61
95
|
// It crashes when TryGetOrCreateContextRuntime returns null.
|
|
62
96
|
// Note: deprecated in favor of TryGetOrCreateContextRuntime.
|
|
@@ -11,10 +11,15 @@
|
|
|
11
11
|
|
|
12
12
|
namespace winrt::Microsoft::ReactNative {
|
|
13
13
|
|
|
14
|
+
facebook::jsi::Runtime &GetOrCreateContextRuntime(
|
|
15
|
+
ReactContext const &context,
|
|
16
|
+
winrt::Windows::Foundation::IInspectable const &runtimeHandle) noexcept;
|
|
17
|
+
|
|
14
18
|
// Try to get JSI Runtime for the current JS dispatcher thread.
|
|
15
19
|
// If it is not found, then create it based on context JSI runtime and store it in the context.Properties().
|
|
16
20
|
// The function returns nullptr if the current context does not have JSI runtime.
|
|
17
21
|
// It makes sure that the JSI runtime holder is removed when the instance is unloaded.
|
|
22
|
+
// Deprecated -- will remove once we remove the JSRuntime property from ReactContext
|
|
18
23
|
facebook::jsi::Runtime *TryGetOrCreateContextRuntime(ReactContext const &context) noexcept;
|
|
19
24
|
|
|
20
25
|
// Calls TryGetOrCreateContextRuntime to get JSI runtime.
|
|
@@ -25,6 +30,7 @@ facebook::jsi::Runtime *TryGetOrCreateContextRuntime(ReactContext const &context
|
|
|
25
30
|
// Call provided lambda with the facebook::jsi::Runtime& parameter.
|
|
26
31
|
// For example: ExecuteJsi(context, [](facebook::jsi::Runtime& runtime){...})
|
|
27
32
|
// The code is executed synchronously if it is already in JSDispatcher, or asynchronously otherwise.
|
|
33
|
+
// New Arch should use ReactContext.CallInvoker instead
|
|
28
34
|
template <class TCodeWithRuntime>
|
|
29
35
|
void ExecuteJsi(ReactContext const &context, TCodeWithRuntime const &code, ReactPromise<void> *callStatus = nullptr) {
|
|
30
36
|
ReactDispatcher jsDispatcher = context.JSDispatcher();
|
|
@@ -126,6 +126,11 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation {
|
|
|
126
126
|
const std::shared_ptr<const PreparedJavaScript>& js) override {
|
|
127
127
|
return plain().evaluatePreparedJavaScript(js);
|
|
128
128
|
}
|
|
129
|
+
#if JSI_VERSION >= 12
|
|
130
|
+
void queueMicrotask(const jsi::Function& callback) override {
|
|
131
|
+
return plain().queueMicrotask(callback);
|
|
132
|
+
}
|
|
133
|
+
#endif
|
|
129
134
|
#if JSI_VERSION >= 4
|
|
130
135
|
bool drainMicrotasks(int maxMicrotasksHint) override {
|
|
131
136
|
return plain().drainMicrotasks(maxMicrotasksHint);
|
|
@@ -183,6 +188,12 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation {
|
|
|
183
188
|
PropNameID createPropNameIDFromString(const String& str) override {
|
|
184
189
|
return plain_.createPropNameIDFromString(str);
|
|
185
190
|
};
|
|
191
|
+
#if JSI_VERSION >= 19
|
|
192
|
+
PropNameID createPropNameIDFromUtf16(const char16_t* utf16, size_t length)
|
|
193
|
+
override {
|
|
194
|
+
return plain_.createPropNameIDFromUtf16(utf16, length);
|
|
195
|
+
}
|
|
196
|
+
#endif
|
|
186
197
|
#if JSI_VERSION >= 5
|
|
187
198
|
PropNameID createPropNameIDFromSymbol(const Symbol& sym) override {
|
|
188
199
|
return plain_.createPropNameIDFromSymbol(sym);
|
|
@@ -226,10 +237,48 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation {
|
|
|
226
237
|
String createStringFromUtf8(const uint8_t* utf8, size_t length) override {
|
|
227
238
|
return plain_.createStringFromUtf8(utf8, length);
|
|
228
239
|
};
|
|
240
|
+
#if JSI_VERSION >= 19
|
|
241
|
+
String createStringFromUtf16(const char16_t* utf16, size_t length) override {
|
|
242
|
+
return plain_.createStringFromUtf16(utf16, length);
|
|
243
|
+
}
|
|
244
|
+
#endif
|
|
229
245
|
std::string utf8(const String& s) override {
|
|
230
246
|
return plain_.utf8(s);
|
|
231
247
|
}
|
|
232
248
|
|
|
249
|
+
#if JSI_VERSION >= 14
|
|
250
|
+
std::u16string utf16(const String& str) override {
|
|
251
|
+
return plain_.utf16(str);
|
|
252
|
+
}
|
|
253
|
+
std::u16string utf16(const PropNameID& sym) override {
|
|
254
|
+
return plain_.utf16(sym);
|
|
255
|
+
}
|
|
256
|
+
#endif
|
|
257
|
+
|
|
258
|
+
#if JSI_VERSION >= 16
|
|
259
|
+
void getStringData(
|
|
260
|
+
const jsi::String& str,
|
|
261
|
+
void* ctx,
|
|
262
|
+
void (
|
|
263
|
+
*cb)(void* ctx, bool ascii, const void* data, size_t num)) override {
|
|
264
|
+
plain_.getStringData(str, ctx, cb);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
void getPropNameIdData(
|
|
268
|
+
const jsi::PropNameID& sym,
|
|
269
|
+
void* ctx,
|
|
270
|
+
void (
|
|
271
|
+
*cb)(void* ctx, bool ascii, const void* data, size_t num)) override {
|
|
272
|
+
plain_.getPropNameIdData(sym, ctx, cb);
|
|
273
|
+
}
|
|
274
|
+
#endif
|
|
275
|
+
|
|
276
|
+
#if JSI_VERSION >= 18
|
|
277
|
+
Object createObjectWithPrototype(const Value& prototype) override {
|
|
278
|
+
return plain_.createObjectWithPrototype(prototype);
|
|
279
|
+
}
|
|
280
|
+
#endif
|
|
281
|
+
|
|
233
282
|
Object createObject() override {
|
|
234
283
|
return plain_.createObject();
|
|
235
284
|
};
|
|
@@ -268,6 +317,16 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation {
|
|
|
268
317
|
}
|
|
269
318
|
#endif
|
|
270
319
|
|
|
320
|
+
#if JSI_VERSION >= 17
|
|
321
|
+
void setPrototypeOf(const Object& object, const Value& prototype) override {
|
|
322
|
+
plain_.setPrototypeOf(object, prototype);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
Value getPrototypeOf(const Object& object) override {
|
|
326
|
+
return plain_.getPrototypeOf(object);
|
|
327
|
+
}
|
|
328
|
+
#endif
|
|
329
|
+
|
|
271
330
|
Value getProperty(const Object& o, const PropNameID& name) override {
|
|
272
331
|
return plain_.getProperty(o, name);
|
|
273
332
|
};
|
|
@@ -427,13 +486,29 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation {
|
|
|
427
486
|
plain().instrumentation().stopHeapSampling(os);
|
|
428
487
|
}
|
|
429
488
|
|
|
489
|
+
#if JSI_VERSION >= 13
|
|
490
|
+
void createSnapshotToFile(
|
|
491
|
+
const std::string& path,
|
|
492
|
+
const HeapSnapshotOptions& options) override {
|
|
493
|
+
plain().instrumentation().createSnapshotToFile(path, options);
|
|
494
|
+
}
|
|
495
|
+
#else
|
|
430
496
|
void createSnapshotToFile(const std::string& path) override {
|
|
431
497
|
plain().instrumentation().createSnapshotToFile(path);
|
|
432
498
|
}
|
|
499
|
+
#endif
|
|
433
500
|
|
|
501
|
+
#if JSI_VERSION >= 13
|
|
502
|
+
void createSnapshotToStream(
|
|
503
|
+
std::ostream& os,
|
|
504
|
+
const HeapSnapshotOptions& options) override {
|
|
505
|
+
plain().instrumentation().createSnapshotToStream(os, options);
|
|
506
|
+
}
|
|
507
|
+
#else
|
|
434
508
|
void createSnapshotToStream(std::ostream& os) override {
|
|
435
509
|
plain().instrumentation().createSnapshotToStream(os);
|
|
436
510
|
}
|
|
511
|
+
#endif
|
|
437
512
|
|
|
438
513
|
std::string flushAndDisableBridgeTrafficTrace() override {
|
|
439
514
|
return const_cast<Plain&>(plain())
|
|
@@ -562,6 +637,12 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
|
|
|
562
637
|
Around around{with_};
|
|
563
638
|
return RD::evaluatePreparedJavaScript(js);
|
|
564
639
|
}
|
|
640
|
+
#if JSI_VERSION >= 12
|
|
641
|
+
void queueMicrotask(const Function& callback) override {
|
|
642
|
+
Around around{with_};
|
|
643
|
+
RD::queueMicrotask(callback);
|
|
644
|
+
}
|
|
645
|
+
#endif
|
|
565
646
|
#if JSI_VERSION >= 4
|
|
566
647
|
bool drainMicrotasks(int maxMicrotasksHint) override {
|
|
567
648
|
Around around{with_};
|
|
@@ -595,6 +676,12 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
|
|
|
595
676
|
Around around{with_};
|
|
596
677
|
return RD::cloneSymbol(pv);
|
|
597
678
|
};
|
|
679
|
+
#if JSI_VERSION >= 6
|
|
680
|
+
Runtime::PointerValue* cloneBigInt(const Runtime::PointerValue* pv) override {
|
|
681
|
+
Around around{with_};
|
|
682
|
+
return RD::cloneBigInt(pv);
|
|
683
|
+
};
|
|
684
|
+
#endif
|
|
598
685
|
Runtime::PointerValue* cloneString(const Runtime::PointerValue* pv) override {
|
|
599
686
|
Around around{with_};
|
|
600
687
|
return RD::cloneString(pv);
|
|
@@ -619,10 +706,23 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
|
|
|
619
706
|
Around around{with_};
|
|
620
707
|
return RD::createPropNameIDFromUtf8(utf8, length);
|
|
621
708
|
};
|
|
709
|
+
#if JSI_VERSION >= 19
|
|
710
|
+
PropNameID createPropNameIDFromUtf16(const char16_t* utf16, size_t length)
|
|
711
|
+
override {
|
|
712
|
+
Around around{with_};
|
|
713
|
+
return RD::createPropNameIDFromUtf16(utf16, length);
|
|
714
|
+
}
|
|
715
|
+
#endif
|
|
622
716
|
PropNameID createPropNameIDFromString(const String& str) override {
|
|
623
717
|
Around around{with_};
|
|
624
718
|
return RD::createPropNameIDFromString(str);
|
|
625
719
|
};
|
|
720
|
+
#if JSI_VERSION >= 5
|
|
721
|
+
PropNameID createPropNameIDFromSymbol(const Symbol& sym) override {
|
|
722
|
+
Around around{with_};
|
|
723
|
+
return RD::createPropNameIDFromSymbol(sym);
|
|
724
|
+
};
|
|
725
|
+
#endif
|
|
626
726
|
std::string utf8(const PropNameID& id) override {
|
|
627
727
|
Around around{with_};
|
|
628
728
|
return RD::utf8(id);
|
|
@@ -637,6 +737,33 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
|
|
|
637
737
|
return RD::symbolToString(sym);
|
|
638
738
|
};
|
|
639
739
|
|
|
740
|
+
#if JSI_VERSION >= 8
|
|
741
|
+
BigInt createBigIntFromInt64(int64_t i) override {
|
|
742
|
+
Around around{with_};
|
|
743
|
+
return RD::createBigIntFromInt64(i);
|
|
744
|
+
};
|
|
745
|
+
BigInt createBigIntFromUint64(uint64_t i) override {
|
|
746
|
+
Around around{with_};
|
|
747
|
+
return RD::createBigIntFromUint64(i);
|
|
748
|
+
};
|
|
749
|
+
bool bigintIsInt64(const BigInt& bi) override {
|
|
750
|
+
Around around{with_};
|
|
751
|
+
return RD::bigintIsInt64(bi);
|
|
752
|
+
};
|
|
753
|
+
bool bigintIsUint64(const BigInt& bi) override {
|
|
754
|
+
Around around{with_};
|
|
755
|
+
return RD::bigintIsUint64(bi);
|
|
756
|
+
};
|
|
757
|
+
uint64_t truncate(const BigInt& bi) override {
|
|
758
|
+
Around around{with_};
|
|
759
|
+
return RD::truncate(bi);
|
|
760
|
+
};
|
|
761
|
+
String bigintToString(const BigInt& bi, int i) override {
|
|
762
|
+
Around around{with_};
|
|
763
|
+
return RD::bigintToString(bi, i);
|
|
764
|
+
};
|
|
765
|
+
#endif
|
|
766
|
+
|
|
640
767
|
String createStringFromAscii(const char* str, size_t length) override {
|
|
641
768
|
Around around{with_};
|
|
642
769
|
return RD::createStringFromAscii(str, length);
|
|
@@ -645,11 +772,60 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
|
|
|
645
772
|
Around around{with_};
|
|
646
773
|
return RD::createStringFromUtf8(utf8, length);
|
|
647
774
|
};
|
|
775
|
+
#if JSI_VERSION >= 19
|
|
776
|
+
String createStringFromUtf16(const char16_t* utf16, size_t length) override {
|
|
777
|
+
Around around{with_};
|
|
778
|
+
return RD::createStringFromUtf16(utf16, length);
|
|
779
|
+
}
|
|
780
|
+
#endif
|
|
648
781
|
std::string utf8(const String& s) override {
|
|
649
782
|
Around around{with_};
|
|
650
783
|
return RD::utf8(s);
|
|
651
784
|
}
|
|
652
785
|
|
|
786
|
+
#if JSI_VERSION >= 14
|
|
787
|
+
std::u16string utf16(const String& str) override {
|
|
788
|
+
Around around{with_};
|
|
789
|
+
return RD::utf16(str);
|
|
790
|
+
}
|
|
791
|
+
std::u16string utf16(const PropNameID& sym) override {
|
|
792
|
+
Around around{with_};
|
|
793
|
+
return RD::utf16(sym);
|
|
794
|
+
}
|
|
795
|
+
#endif
|
|
796
|
+
|
|
797
|
+
#if JSI_VERSION >= 16
|
|
798
|
+
void getStringData(
|
|
799
|
+
const jsi::String& str,
|
|
800
|
+
void* ctx,
|
|
801
|
+
void (
|
|
802
|
+
*cb)(void* ctx, bool ascii, const void* data, size_t num)) override {
|
|
803
|
+
Around around{with_};
|
|
804
|
+
RD::getStringData(str, ctx, cb);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
void getPropNameIdData(
|
|
808
|
+
const jsi::PropNameID& sym,
|
|
809
|
+
void* ctx,
|
|
810
|
+
void (
|
|
811
|
+
*cb)(void* ctx, bool ascii, const void* data, size_t num)) override {
|
|
812
|
+
Around around{with_};
|
|
813
|
+
RD::getPropNameIdData(sym, ctx, cb);
|
|
814
|
+
}
|
|
815
|
+
#endif
|
|
816
|
+
|
|
817
|
+
Value createValueFromJsonUtf8(const uint8_t* json, size_t length) override {
|
|
818
|
+
Around around{with_};
|
|
819
|
+
return RD::createValueFromJsonUtf8(json, length);
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
#if JSI_VERSION >= 18
|
|
823
|
+
Object createObjectWithPrototype(const Value& prototype) override {
|
|
824
|
+
Around around{with_};
|
|
825
|
+
return RD::createObjectWithPrototype(prototype);
|
|
826
|
+
}
|
|
827
|
+
#endif
|
|
828
|
+
|
|
653
829
|
Object createObject() override {
|
|
654
830
|
Around around{with_};
|
|
655
831
|
return RD::createObject();
|
|
@@ -667,6 +843,34 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
|
|
|
667
843
|
return RD::getHostFunction(f);
|
|
668
844
|
};
|
|
669
845
|
|
|
846
|
+
#if JSI_VERSION >= 7
|
|
847
|
+
bool hasNativeState(const Object& o) override {
|
|
848
|
+
Around around{with_};
|
|
849
|
+
return RD::hasNativeState(o);
|
|
850
|
+
};
|
|
851
|
+
std::shared_ptr<NativeState> getNativeState(const Object& o) override {
|
|
852
|
+
Around around{with_};
|
|
853
|
+
return RD::getNativeState(o);
|
|
854
|
+
};
|
|
855
|
+
void setNativeState(const Object& o, std::shared_ptr<NativeState> state)
|
|
856
|
+
override {
|
|
857
|
+
Around around{with_};
|
|
858
|
+
RD::setNativeState(o, state);
|
|
859
|
+
};
|
|
860
|
+
#endif
|
|
861
|
+
|
|
862
|
+
#if JSI_VERSION >= 17
|
|
863
|
+
void setPrototypeOf(const Object& object, const Value& prototype) override {
|
|
864
|
+
Around around{with_};
|
|
865
|
+
RD::setPrototypeOf(object, prototype);
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
Value getPrototypeOf(const Object& object) override {
|
|
869
|
+
Around around{with_};
|
|
870
|
+
return RD::getPrototypeOf(object);
|
|
871
|
+
}
|
|
872
|
+
#endif
|
|
873
|
+
|
|
670
874
|
Value getProperty(const Object& o, const PropNameID& name) override {
|
|
671
875
|
Around around{with_};
|
|
672
876
|
return RD::getProperty(o, name);
|
|
@@ -800,6 +1004,14 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
|
|
|
800
1004
|
Around around{with_};
|
|
801
1005
|
return RD::strictEquals(a, b);
|
|
802
1006
|
};
|
|
1007
|
+
|
|
1008
|
+
#if JSI_VERSION >= 6
|
|
1009
|
+
bool strictEquals(const BigInt& a, const BigInt& b) const override {
|
|
1010
|
+
Around around{with_};
|
|
1011
|
+
return RD::strictEquals(a, b);
|
|
1012
|
+
};
|
|
1013
|
+
#endif
|
|
1014
|
+
|
|
803
1015
|
bool strictEquals(const String& a, const String& b) const override {
|
|
804
1016
|
Around around{with_};
|
|
805
1017
|
return RD::strictEquals(a, b);
|
|
@@ -814,6 +1026,14 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
|
|
|
814
1026
|
return RD::instanceOf(o, f);
|
|
815
1027
|
};
|
|
816
1028
|
|
|
1029
|
+
#if JSI_VERSION >= 11
|
|
1030
|
+
void setExternalMemoryPressure(const jsi::Object& obj, size_t amount)
|
|
1031
|
+
override {
|
|
1032
|
+
Around around{with_};
|
|
1033
|
+
RD::setExternalMemoryPressure(obj, amount);
|
|
1034
|
+
};
|
|
1035
|
+
#endif
|
|
1036
|
+
|
|
817
1037
|
private:
|
|
818
1038
|
// Wrap an RAII type around With& to guarantee after always happens.
|
|
819
1039
|
struct Around {
|
|
@@ -25,6 +25,14 @@ namespace jsi {
|
|
|
25
25
|
/// it modify the values of any jsi values in the heap (although GCs are fine).
|
|
26
26
|
class JSI_EXPORT Instrumentation {
|
|
27
27
|
public:
|
|
28
|
+
#if JSI_VERSION >= 13
|
|
29
|
+
/// Additional options controlling what to include when capturing a heap
|
|
30
|
+
/// snapshot.
|
|
31
|
+
struct HeapSnapshotOptions {
|
|
32
|
+
bool captureNumericValue{false};
|
|
33
|
+
};
|
|
34
|
+
#endif
|
|
35
|
+
|
|
28
36
|
virtual ~Instrumentation() = default;
|
|
29
37
|
|
|
30
38
|
/// Returns GC statistics as a JSON-encoded string, with an object containing
|
|
@@ -89,15 +97,35 @@ class JSI_EXPORT Instrumentation {
|
|
|
89
97
|
/// \p os. The output is a JSON formatted string.
|
|
90
98
|
virtual void stopHeapSampling(std::ostream& os) = 0;
|
|
91
99
|
|
|
100
|
+
#if JSI_VERSION >= 13
|
|
101
|
+
/// Captures the heap to a file
|
|
102
|
+
///
|
|
103
|
+
/// \param path to save the heap capture.
|
|
104
|
+
/// \param options additional options for what to capture.
|
|
105
|
+
virtual void createSnapshotToFile(
|
|
106
|
+
const std::string& path,
|
|
107
|
+
const HeapSnapshotOptions& options = {false}) = 0;
|
|
108
|
+
#else
|
|
92
109
|
/// Captures the heap to a file
|
|
93
110
|
///
|
|
94
111
|
/// \param path to save the heap capture
|
|
95
112
|
virtual void createSnapshotToFile(const std::string& path) = 0;
|
|
113
|
+
#endif
|
|
96
114
|
|
|
115
|
+
#if JSI_VERSION >= 13
|
|
116
|
+
/// Captures the heap to an output stream
|
|
117
|
+
///
|
|
118
|
+
/// \param os output stream to write to.
|
|
119
|
+
/// \param options additional options for what to capture.
|
|
120
|
+
virtual void createSnapshotToStream(
|
|
121
|
+
std::ostream& os,
|
|
122
|
+
const HeapSnapshotOptions& options = {false}) = 0;
|
|
123
|
+
#else
|
|
97
124
|
/// Captures the heap to an output stream
|
|
98
125
|
///
|
|
99
126
|
/// \param os output stream to write to.
|
|
100
127
|
virtual void createSnapshotToStream(std::ostream& os) = 0;
|
|
128
|
+
#endif
|
|
101
129
|
|
|
102
130
|
/// If the runtime has been created to trace to a temp file, flush
|
|
103
131
|
/// any unwritten parts of the trace of bridge traffic to the file,
|
|
@@ -86,6 +86,12 @@ inline const Runtime::PointerValue* Runtime::getPointerValue(
|
|
|
86
86
|
return value.data_.pointer.ptr_;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
#if JSI_VERSION >= 17
|
|
90
|
+
Value Object::getPrototype(Runtime& runtime) const {
|
|
91
|
+
return runtime.getPrototypeOf(*this);
|
|
92
|
+
}
|
|
93
|
+
#endif
|
|
94
|
+
|
|
89
95
|
inline Value Object::getProperty(Runtime& runtime, const char* name) const {
|
|
90
96
|
return getProperty(runtime, String::createFromAscii(runtime, name));
|
|
91
97
|
}
|