feat: support SharedArrayBuffer sharing between workers (#11040)

This commit adds support for sharing SABs between workers.
This commit is contained in:
Luca Casonato 2021-07-06 19:42:52 +02:00 committed by GitHub
parent 672a88f272
commit bdfad23dd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 152 additions and 0 deletions

View file

@ -15,6 +15,7 @@ use crate::module_graph::TypeLib;
use crate::source_maps::SourceMapGetter;
use crate::specifier_handler::FetchHandler;
use crate::version;
use deno_core::SharedArrayBufferStore;
use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel;
use deno_runtime::deno_web::BlobStore;
use deno_runtime::inspector_server::InspectorServer;
@ -55,6 +56,7 @@ pub struct ProgramState {
pub ca_data: Option<Vec<u8>>,
pub blob_store: BlobStore,
pub broadcast_channel: InMemoryBroadcastChannel,
pub shared_array_buffer_store: SharedArrayBufferStore,
}
impl ProgramState {
@ -81,6 +83,7 @@ impl ProgramState {
let blob_store = BlobStore::default();
let broadcast_channel = InMemoryBroadcastChannel::default();
let shared_array_buffer_store = SharedArrayBufferStore::default();
let file_fetcher = FileFetcher::new(
http_cache,
@ -148,6 +151,7 @@ impl ProgramState {
ca_data,
blob_store,
broadcast_channel,
shared_array_buffer_store,
};
Ok(Arc::new(program_state))
}