Skip to content

Commit 03744ca

Browse files
committed
chore: More adjustments
1 parent ed16657 commit 03744ca

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
<WasmEnableThreads Condition=" '$(WasmShellEnableThreads)' == 'true' ">true</WasmEnableThreads>
203203

204204
<!-- https://github.com/dotnet/runtime/blob/1231a9addd0fb3cfb806c2a89cb45a3018c48bb2/src/mono/browser/build/BrowserWasmApp.targets#L125-L126 -->
205-
<_WasmPThreadPoolInitialSize Condition=" '$(WasmShellPThreadsPoolSize)' == 'true' ">true</_WasmPThreadPoolInitialSize>
205+
<_WasmPThreadPoolInitialSize Condition=" '$(WasmShellPThreadsPoolSize)' == '' ">2</_WasmPThreadPoolInitialSize>
206206

207207
<!-- Native build compatibility -->
208208
<WasmBuildNative Condition="

src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ namespace Uno.WebAssembly.Bootstrap {
145145
onConfigLoaded: this.onConfigLoaded,
146146
onDotnetReady: this.onDotnetReady,
147147
onAbort: this.onAbort,
148+
pthreadPoolInitialSize: 2,
148149
exports: ["IDBFS", "FS"].concat(this._unoConfig.emcc_exported_runtime_methods),
149150
onDownloadResourceProgress: (resourcesLoaded: number, totalResources: number) => this.reportDownloadResourceProgress(resourcesLoaded, totalResources),
150151
};
@@ -260,9 +261,9 @@ namespace Uno.WebAssembly.Bootstrap {
260261

261262
await this.setupHotReload();
262263

263-
if (this._hotReloadSupport) {
264-
await this._hotReloadSupport.initializeHotReload();
265-
}
264+
//if (this._hotReloadSupport) {
265+
// await this._hotReloadSupport.initializeHotReload();
266+
//}
266267

267268
this._runMain(this._unoConfig.uno_main, []);
268269

src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/HotReloadSupport.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,15 @@ namespace Uno.WebAssembly.Bootstrap {
3737
(<any>this._context).config.environmentVariables['ASPNETCORE-BROWSER-TOOLS']
3838
|| (<any>this._context).config.environmentVariables['__ASPNETCORE_BROWSER_TOOLS'];
3939

40+
if (!await HotReloadSupport._initializeMethod()) {
41+
console.warn("The application was compiled with the IL linker enabled, hot reload is disabled. See https://aka.platform.uno/wasm-il-linker for more details.");
42+
}
43+
let capabilities = await HotReloadSupport._getApplyUpdateCapabilitiesMethod();
44+
4045
// Take the place of the internal .NET for WebAssembly APIs for metadata updates coming
4146
// from the "BrowserLink" feature.
4247
(function (Blazor) {
4348
Blazor._internal = {
44-
initialize: function () {
45-
if (!HotReloadSupport._initializeMethod()) {
46-
console.warn("The application was compiled with the IL linker enabled, hot reload is disabled. See https://aka.platform.uno/wasm-il-linker for more details.");
47-
}
48-
},
49-
5049
applyExisting: async function (): Promise<void> {
5150

5251
if (browserToolsVariable == "true")
@@ -62,13 +61,11 @@ namespace Uno.WebAssembly.Bootstrap {
6261
},
6362

6463
getApplyUpdateCapabilities: function () {
65-
Blazor._internal.initialize();
66-
return HotReloadSupport._getApplyUpdateCapabilitiesMethod();
64+
return capabilities;
6765
},
6866

6967
applyHotReload: function (moduleId: any, metadataDelta: any, ilDelta: any, pdbDelta: any, updatedTypes: any) {
70-
Blazor._internal.initialize();
71-
return HotReloadSupport._applyHotReloadDeltaMethod(moduleId, metadataDelta, ilDelta, pdbDelta || "", updatedTypes || []);
68+
HotReloadSupport._applyHotReloadDeltaMethod(moduleId, metadataDelta, ilDelta, pdbDelta || "", updatedTypes || []);
7269
}
7370
};
7471
})((<any>window).Blazor || ((<any>window).Blazor = {}));

src/Uno.Wasm.Tests.Shared/Runtime.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Runtime.InteropServices;
44
using System.Runtime.InteropServices.ComTypes;
55
using System.Runtime.InteropServices.JavaScript;
6+
using System.Threading.Tasks;
67

78
namespace WebAssembly
89
{
@@ -11,7 +12,7 @@ internal sealed class Runtime
1112
/// <summary>
1213
/// Invokes Javascript code in the hosting environment
1314
/// </summary>
14-
internal static string InvokeJS(string str)
15+
internal static Task<string> InvokeJS(string str)
1516
{
1617
Console.WriteLine($"Invoking {str}");
1718
return Interop.InvokeJS(str);
@@ -21,6 +22,6 @@ internal static string InvokeJS(string str)
2122
internal static partial class Interop
2223
{
2324
[JSImport("globalThis.Uno.WebAssembly.Bootstrap.Bootstrapper.invokeJS")]
24-
public static partial string InvokeJS(string value);
25+
public static partial Task<string> InvokeJS(string value);
2526
}
2627
}

src/Uno.Wasm.Threads.Shared/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static void Main()
4444
Console.WriteLine($"TID: {Thread.CurrentThread.ManagedThreadId}");
4545
Console.WriteLine($"SynchronizationContext: {_jsContext}");
4646

47-
Runtime.InvokeJS("Interop.appendResult('Startup')");
47+
_ = Runtime.InvokeJS("Interop.appendResult('Startup')");
4848

4949
Run();
5050

@@ -57,7 +57,7 @@ private static void OnTick(object state)
5757
if (_event.WaitOne(10) && _mainThreadInvoked)
5858
{
5959
var r = $"Done {_messages.Count} results (_mainThreadInvoked:{_mainThreadInvoked})";
60-
Runtime.InvokeJS($"Interop.appendResult('{r}')");
60+
_ = Runtime.InvokeJS($"Interop.appendResult('{r}')");
6161
Console.WriteLine($"[tid:{Thread.CurrentThread.ManagedThreadId}]: {r}");
6262
_timer.Dispose();
6363
}

src/Uno.Wasm.Threads.Shared/WasmScripts/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
});
44

55
var Interop = {
6-
appendResult: function (str) {
6+
appendResult: async function (str) {
77
var txt = document.createTextNode(str);
88
var parent = document.getElementById('results');
99
parent.appendChild(txt, parent.lastChild);

src/Uno.Wasm.Threads/Uno.Wasm.Threads.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<!--<WasmShellMonoRuntimeExecutionMode Condition="$([MSBuild]::IsOsPlatform('Linux'))">FullAOT</WasmShellMonoRuntimeExecutionMode>-->
1010
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1111
<WasmShellEnableThreads>true</WasmShellEnableThreads>
12+
<!--<WasmBuildNative>true</WasmBuildNative>-->
1213
<!--<WasmShellILLinkerEnabled>false</WasmShellILLinkerEnabled>-->
1314
</PropertyGroup>
1415

0 commit comments

Comments
 (0)