Skip to content

Commit

Permalink
[WASI] ownsPollable parameter to RegisterWasiPollable, downgrade depe…
Browse files Browse the repository at this point in the history
…ndencies (dotnet#107978)
  • Loading branch information
pavelsavara authored Sep 18, 2024
1 parent 9eb48cd commit 59a096e
Show file tree
Hide file tree
Showing 30 changed files with 724 additions and 799 deletions.
20 changes: 10 additions & 10 deletions src/libraries/System.Net.Http/src/System.Net.Http.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -465,16 +465,16 @@
<Compile Include="System\Net\Http\WasiHttpHandler\WasiOutputStream.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiInputStream.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttp.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.clocks.v0_2_1.MonotonicClockInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.http.v0_2_1.OutgoingHandlerInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.http.v0_2_1.TypesInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_1.ErrorInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IError.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_1.PollInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_1.StreamsInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.clocks.v0_2_0.MonotonicClockInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.http.v0_2_0.OutgoingHandlerInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.http.v0_2_0.TypesInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.ErrorInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IError.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.PollInterop.cs" />
<Compile Include="System\Net\Http\WasiHttpHandler\WasiHttpWorld.wit.imports.wasi.io.v0_2_0.StreamsInterop.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
// <auto-generated />
#nullable enable
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
using System.Threading;
using System.Threading.Tasks;
using WasiHttpWorld;
using WasiHttpWorld.wit.imports.wasi.http.v0_2_1;
using WasiHttpWorld.wit.imports.wasi.io.v0_2_1;
using static WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes;
using WasiHttpWorld.wit.imports.wasi.http.v0_2_0;
using WasiHttpWorld.wit.imports.wasi.io.v0_2_0;
using static WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes;

namespace System.Net.Http
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
using System.Threading;
using System.Threading.Tasks;
using WasiHttpWorld;
using WasiHttpWorld.wit.imports.wasi.http.v0_2_1;
using WasiHttpWorld.wit.imports.wasi.io.v0_2_1;
using static WasiHttpWorld.wit.imports.wasi.http.v0_2_1.ITypes;
using static WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IStreams;
using WasiHttpWorld.wit.imports.wasi.http.v0_2_0;
using WasiHttpWorld.wit.imports.wasi.io.v0_2_0;
using static WasiHttpWorld.wit.imports.wasi.http.v0_2_0.ITypes;
using static WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IStreams;

namespace System.Net.Http
{
Expand All @@ -29,10 +29,10 @@ public static Task RegisterWasiPollable(IPoll.Pollable pollable, CancellationTok
pollable.Handle = 0;
GC.SuppressFinalize(pollable);

return CallRegisterWasiPollableHandle((Thread)null!, handle, cancellationToken);
return CallRegisterWasiPollableHandle((Thread)null!, handle, true, cancellationToken);

[UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "RegisterWasiPollableHandle")]
static extern Task CallRegisterWasiPollableHandle(Thread t, int handle, CancellationToken cancellationToken);
static extern Task CallRegisterWasiPollableHandle(Thread t, int handle, bool ownsPollable, CancellationToken cancellationToken);
}

public static Method ConvertMethod(HttpMethod requestMethod)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT!
// Generated by `wit-bindgen` 0.32.0. DO NOT EDIT!
// <auto-generated />
#nullable enable

Expand All @@ -11,13 +11,13 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace WasiHttpWorld.wit.imports.wasi.clocks.v0_2_1
namespace WasiHttpWorld.wit.imports.wasi.clocks.v0_2_0
{
internal static class MonotonicClockInterop {

internal static class NowWasmInterop
{
[DllImport("wasi:clocks/[email protected].1", EntryPoint = "now"), WasmImportLinkage]
[DllImport("wasi:clocks/[email protected].0", EntryPoint = "now"), WasmImportLinkage]
internal static extern long wasmImportNow();

}
Expand All @@ -32,7 +32,7 @@ internal static unsafe ulong Now()

internal static class ResolutionWasmInterop
{
[DllImport("wasi:clocks/[email protected].1", EntryPoint = "resolution"), WasmImportLinkage]
[DllImport("wasi:clocks/[email protected].0", EntryPoint = "resolution"), WasmImportLinkage]
internal static extern long wasmImportResolution();

}
Expand All @@ -47,31 +47,31 @@ internal static unsafe ulong Resolution()

internal static class SubscribeInstantWasmInterop
{
[DllImport("wasi:clocks/[email protected].1", EntryPoint = "subscribe-instant"), WasmImportLinkage]
[DllImport("wasi:clocks/[email protected].0", EntryPoint = "subscribe-instant"), WasmImportLinkage]
internal static extern int wasmImportSubscribeInstant(long p0);

}

internal static unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable SubscribeInstant(ulong when)
internal static unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable SubscribeInstant(ulong when)
{
var result = SubscribeInstantWasmInterop.wasmImportSubscribeInstant(unchecked((long)(when)));
var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result));
var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result));
return resource;

//TODO: free alloc handle (interopString) if exists
}

internal static class SubscribeDurationWasmInterop
{
[DllImport("wasi:clocks/[email protected].1", EntryPoint = "subscribe-duration"), WasmImportLinkage]
[DllImport("wasi:clocks/[email protected].0", EntryPoint = "subscribe-duration"), WasmImportLinkage]
internal static extern int wasmImportSubscribeDuration(long p0);

}

internal static unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable SubscribeDuration(ulong when)
internal static unsafe global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable SubscribeDuration(ulong when)
{
var result = SubscribeDurationWasmInterop.wasmImportSubscribeDuration(unchecked((long)(when)));
var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_1.IPoll.Pollable.THandle(result));
var resource = new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable(new global::WasiHttpWorld.wit.imports.wasi.io.v0_2_0.IPoll.Pollable.THandle(result));
return resource;

//TODO: free alloc handle (interopString) if exists
Expand Down
Loading

0 comments on commit 59a096e

Please sign in to comment.