WASIComponentResourceTable class final
A typed resource table for WASI component hosts.
Component resources are represented as opaque integer handles. The table keeps the host objects typed, rejects stale handles, and prevents dropping a resource while it is borrowed by host code.
Constructors
Properties
- activeCount → int
-
Number of live resources in the table.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
attachChild(
int parentHandle, int childHandle) → void -
Records that
childHandlemust be released beforeparentHandle. -
borrow<
T extends Object, R> (WASIComponentResourceType< T> type, int handle, R callback(T resource)) → R -
Runs
callbackwith the resource forhandlewhile marking it borrowed. -
borrowAsync<
T extends Object, R> (WASIComponentResourceType< T> type, int handle, Future<R> callback(T resource)) → Future<R> -
Runs async
callbackwith the resource forhandlewhile it is borrowed. -
contains(
int handle) → bool -
Returns
truewhenhandlecurrently refers to a live resource. -
containsType<
T extends Object> (WASIComponentResourceType< T> type, int handle) → bool -
Returns
truewhenhandlecurrently refers to a livetyperesource. -
createBorrowCallScope(
) → WASIComponentCanonicalBorrowCallScope - Creates an auto-cleaned canonical borrow scope for one sync call.
-
defineType<
T extends Object> (String name, {void onDrop(T resource)?}) → WASIComponentResourceType< T> -
Defines a nominal component resource type backed by Dart values of
T. -
drop<
T extends Object> (WASIComponentResourceType< T> type, int handle) → void -
Drops the resource for
handle. -
dropNamed(
String expectedTypeName, int handle) → void -
Drops
handlewhen its nominal type hasexpectedTypeName. -
get<
T extends Object> (WASIComponentResourceType< T> type, int handle) → T -
Returns the resource for
handlewhen it has typeT. -
insert<
T extends Object> (WASIComponentResourceType< T> type, T resource) → int -
Inserts
resourceand returns an opaque component handle. -
insertBorrowHandle(
int sourceHandle, WASIComponentCanonicalBorrowScope scope) → int -
Creates a canonical borrowed handle owned by
scope. -
insertPersistent<
T extends Object> (WASIComponentResourceType< T> type, T resource) → int - Inserts a host-owned resource that outlives the current runtime scope.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resourceDrop<
T extends Object> (WASIComponentResourceType< T> type, int handle) → void -
Implements the canonical ABI
resource.dropoperation. -
resourceNew<
T extends Object> (WASIComponentResourceType< T> type, T representation) → int -
Implements the canonical ABI
resource.newoperation. -
resourceRep<
T extends Object> (WASIComponentResourceType< T> type, int handle) → T -
Implements the canonical ABI
resource.repoperation. -
retainCurrentScope(
) → WASIComponentResourceScopeLease - Retains the current allocation scope until the returned lease is released.
-
runScoped<
T> (FutureOr< T> callback()) → Future<T> -
Runs
callbackin an allocation scope and drops any handles it leaks. -
take<
T extends Object> (WASIComponentResourceType< T> type, int handle) → T -
Removes an owned
handleand returns its host representation. -
takeDetachingChildren<
T extends Object> (WASIComponentResourceType< T> type, int handle) → T -
Transfers an owned
handlewhile keeping its direct children alive. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited