react-native-windows 0.72.0-preview.3 → 0.72.0-preview.4
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.
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.72.0-preview.
|
|
13
|
+
<ReactNativeWindowsVersion>0.72.0-preview.4</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>72</ReactNativeWindowsMinor>
|
|
16
16
|
<ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>f2076401425338dec2db2d115b886988ac70e57b</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<EnableDevServerHBCBundles Condition="'$(EnableDevServerHBCBundles)' == ''">false</EnableDevServerHBCBundles>
|
|
25
25
|
|
|
26
26
|
<UseV8 Condition="'$(UseV8)' == ''">false</UseV8>
|
|
27
|
-
<V8Version Condition="'$(V8Version)' == ''">0.71.
|
|
27
|
+
<V8Version Condition="'$(V8Version)' == ''">0.71.3</V8Version>
|
|
28
28
|
<V8PackageName>ReactNative.V8Jsi.Windows</V8PackageName>
|
|
29
29
|
<V8PackageName Condition="'$(V8AppPlatform)' != 'win32'">$(V8PackageName).UWP</V8PackageName>
|
|
30
30
|
</PropertyGroup>
|
|
@@ -11,57 +11,75 @@ using std::unique_ptr;
|
|
|
11
11
|
|
|
12
12
|
namespace Microsoft::JSI {
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
class NapiTask {
|
|
15
|
+
public:
|
|
16
|
+
NapiTask(void *task, v8_task_run_cb onTaskRun, v8_task_release_cb onTaskRelease)
|
|
17
|
+
: task_(task), onTaskRun_(onTaskRun), onTaskRelease_(onTaskRelease) {}
|
|
18
|
+
|
|
19
|
+
NapiTask(NapiTask &&other)
|
|
20
|
+
: task_(std::exchange(other.task_, nullptr)),
|
|
21
|
+
onTaskRun_(std::exchange(other.onTaskRun_, nullptr)),
|
|
22
|
+
onTaskRelease_(std::exchange(other.onTaskRelease_, nullptr)) {}
|
|
23
|
+
|
|
24
|
+
NapiTask &operator=(NapiTask &&other) {
|
|
25
|
+
if (this != &other) {
|
|
26
|
+
NapiTask taskToDelete(std::move(*this));
|
|
27
|
+
task_ = std::exchange(other.task_, nullptr);
|
|
28
|
+
onTaskRun_ = std::exchange(other.onTaskRun_, nullptr);
|
|
29
|
+
onTaskRelease_ = std::exchange(other.onTaskRelease_, nullptr);
|
|
30
|
+
}
|
|
31
|
+
return *this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
NapiTask(const NapiTask &other) = delete;
|
|
35
|
+
NapiTask &operator=(const NapiTask &other) = delete;
|
|
29
36
|
|
|
30
37
|
~NapiTask() {
|
|
31
|
-
if (
|
|
32
|
-
|
|
38
|
+
if (task_ != nullptr) {
|
|
39
|
+
onTaskRelease_(task_);
|
|
33
40
|
}
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
void
|
|
37
|
-
|
|
43
|
+
void Run() const {
|
|
44
|
+
if (task_ != nullptr) {
|
|
45
|
+
onTaskRun_(task_);
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
private:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
napi_finalize m_finalizeCallback;
|
|
45
|
-
void *m_finalizeHint;
|
|
50
|
+
void *task_;
|
|
51
|
+
v8_task_run_cb onTaskRun_;
|
|
52
|
+
v8_task_release_cb onTaskRelease_;
|
|
46
53
|
};
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
void *finalizeHint) {
|
|
56
|
-
NapiJsiV8RuntimeHolder *holder;
|
|
57
|
-
auto result = napi_get_instance_data(env, (void **)&holder);
|
|
58
|
-
if (result != napi_status::napi_ok) {
|
|
59
|
-
std::terminate();
|
|
55
|
+
class NapiTaskRunner {
|
|
56
|
+
public:
|
|
57
|
+
NapiTaskRunner(std::shared_ptr<facebook::react::MessageQueueThread> jsQueue) : m_jsQueue(std::move(jsQueue)) {}
|
|
58
|
+
|
|
59
|
+
static v8_task_runner_t Create(std::shared_ptr<facebook::react::MessageQueueThread> jsQueue) {
|
|
60
|
+
NapiTaskRunner *taskRunner = new NapiTaskRunner(std::move(jsQueue));
|
|
61
|
+
return v8_create_task_runner(reinterpret_cast<void *>(taskRunner), &PostTask, &Release);
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
private:
|
|
65
|
+
static void __cdecl PostTask(
|
|
66
|
+
void *taskRunner,
|
|
67
|
+
void *task,
|
|
68
|
+
v8_task_run_cb onTaskRun,
|
|
69
|
+
v8_task_release_cb onTaskRelease) {
|
|
70
|
+
auto napiTask = std::make_shared<NapiTask>(task, onTaskRun, onTaskRelease);
|
|
71
|
+
reinterpret_cast<NapiTaskRunner *>(taskRunner)->m_jsQueue->runOnQueue([napiTask = std::move(napiTask)] {
|
|
72
|
+
napiTask->Run();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static void __cdecl Release(void *taskRunner) {
|
|
77
|
+
delete reinterpret_cast<NapiTaskRunner *>(taskRunner);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private:
|
|
81
|
+
std::shared_ptr<facebook::react::MessageQueueThread> m_jsQueue;
|
|
82
|
+
};
|
|
65
83
|
|
|
66
84
|
NapiJsiV8RuntimeHolder::NapiJsiV8RuntimeHolder(
|
|
67
85
|
shared_ptr<DevSettings> devSettings,
|
|
@@ -85,7 +103,7 @@ void NapiJsiV8RuntimeHolder::InitRuntime() noexcept {
|
|
|
85
103
|
settings.flags.enable_inspector = m_useDirectDebugger;
|
|
86
104
|
settings.flags.wait_for_debugger = m_debuggerBreakOnNextLine;
|
|
87
105
|
// TODO: args.debuggerRuntimeName = debuggerRuntimeName_;
|
|
88
|
-
settings.
|
|
106
|
+
settings.foreground_task_runner = NapiTaskRunner::Create(m_jsQueue);
|
|
89
107
|
|
|
90
108
|
napi_ext_script_cache scriptCache = InitScriptCache(std::move(m_preparedScriptStore));
|
|
91
109
|
settings.script_cache = &scriptCache;
|
|
@@ -24,14 +24,6 @@ class NapiJsiV8RuntimeHolder : public Microsoft::JSI::RuntimeHolderLazyInit {
|
|
|
24
24
|
std::unique_ptr<facebook::jsi::PreparedScriptStore> &&preparedScriptStore) noexcept;
|
|
25
25
|
|
|
26
26
|
private:
|
|
27
|
-
static void __cdecl ScheduleTaskCallback(
|
|
28
|
-
napi_env env,
|
|
29
|
-
napi_ext_task_callback taskCb,
|
|
30
|
-
void *taskData,
|
|
31
|
-
uint32_t delayMs,
|
|
32
|
-
napi_finalize finalizeCb,
|
|
33
|
-
void *finalizeHint);
|
|
34
|
-
|
|
35
27
|
void InitRuntime() noexcept;
|
|
36
28
|
napi_ext_script_cache InitScriptCache(
|
|
37
29
|
std::unique_ptr<facebook::jsi::PreparedScriptStore> &&preparedScriptStore) noexcept;
|