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.

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 childHandle must be released before parentHandle.
borrow<T extends Object, R>(WASIComponentResourceType<T> type, int handle, R callback(T resource)) → R
Runs callback with the resource for handle while marking it borrowed.
borrowAsync<T extends Object, R>(WASIComponentResourceType<T> type, int handle, Future<R> callback(T resource)) Future<R>
Runs async callback with the resource for handle while it is borrowed.
contains(int handle) bool
Returns true when handle currently refers to a live resource.
containsType<T extends Object>(WASIComponentResourceType<T> type, int handle) bool
Returns true when handle currently refers to a live type resource.
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 handle when its nominal type has expectedTypeName.
get<T extends Object>(WASIComponentResourceType<T> type, int handle) → T
Returns the resource for handle when it has type T.
insert<T extends Object>(WASIComponentResourceType<T> type, T resource) int
Inserts resource and 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.drop operation.
resourceNew<T extends Object>(WASIComponentResourceType<T> type, T representation) int
Implements the canonical ABI resource.new operation.
resourceRep<T extends Object>(WASIComponentResourceType<T> type, int handle) → T
Implements the canonical ABI resource.rep operation.
retainCurrentScope() WASIComponentResourceScopeLease
Retains the current allocation scope until the returned lease is released.
runScoped<T>(FutureOr<T> callback()) Future<T>
Runs callback in an allocation scope and drops any handles it leaks.
take<T extends Object>(WASIComponentResourceType<T> type, int handle) → T
Removes an owned handle and returns its host representation.
takeDetachingChildren<T extends Object>(WASIComponentResourceType<T> type, int handle) → T
Transfers an owned handle while keeping its direct children alive.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited