Convert Browser.workers to HandleAllocator. NFC#27127
Conversation
How important are those goals? Workers are created quite rarely so I suspect that keeping this code minimal with a simple array is good enough. Did you see a problem somewhere? |
Yes, that isn't really the goal here. The goal is more about using the HandleAllocator consistently so if/when we improve it (or perhaps just delete in favor of managing externref_t) on the native side, we have single point of control where we all subsystems can benefit. |
|
Updated the PR description. |
This avoids using a raw array and allows reusing IDs. Remove Browser.workers and use a new global helper workerHandles instead.
Using the common/shared
HandleAllocatorfor all subsystems allows us to make improvements in the central location. For example, we can play around usingexternref_tinstead of allocating integers on the JS side.This also comes with codesize saving, at least for
test_codesize_hello_dylink_all(I imagine because it already includes severalHandleAllocatorusages).This also removes a field from the global
Browserobject.