summaryrefslogtreecommitdiff
path: root/runtime/worker.rs
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2021-04-07 15:22:14 +0200
committerGitHub <noreply@github.com>2021-04-07 15:22:14 +0200
commit966ce7de8a23f63d0f30b1748fe69ccaf07519e0 (patch)
tree3275ca96a835fe91a62a73d5a4c83bf6ca917b66 /runtime/worker.rs
parent2865f39bec6da135a2d2d679a65e7ff139131bd7 (diff)
feat: blob URL support (#10045)
This commit adds blob URL support. Blob URLs are stored in a process global storage, that can be accessed from all workers, and the module loader. Blob URLs can be created using `URL.createObjectURL` and revoked using `URL.revokeObjectURL`. This commit does not add support for `fetch`ing blob URLs. This will be added in a follow up commit.
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r--runtime/worker.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs
index 00434b313..982198d65 100644
--- a/runtime/worker.rs
+++ b/runtime/worker.rs
@@ -21,6 +21,7 @@ use deno_core::ModuleId;
use deno_core::ModuleLoader;
use deno_core::ModuleSpecifier;
use deno_core::RuntimeOptions;
+use deno_file::BlobUrlStore;
use log::debug;
use std::env;
use std::rc::Rc;
@@ -66,6 +67,7 @@ pub struct WorkerOptions {
pub no_color: bool,
pub get_error_class_fn: Option<GetErrorClassFn>,
pub location: Option<Url>,
+ pub blob_url_store: BlobUrlStore,
}
impl MainWorker {
@@ -129,6 +131,11 @@ impl MainWorker {
ops::reg_json_sync(js_runtime, "op_close", deno_core::op_close);
ops::reg_json_sync(js_runtime, "op_resources", deno_core::op_resources);
ops::url::init(js_runtime);
+ ops::file::init(
+ js_runtime,
+ options.blob_url_store.clone(),
+ options.location.clone(),
+ );
ops::fs_events::init(js_runtime);
ops::fs::init(js_runtime);
ops::io::init(js_runtime);
@@ -298,6 +305,7 @@ mod tests {
no_color: true,
get_error_class_fn: None,
location: None,
+ blob_url_store: BlobUrlStore::default(),
};
MainWorker::from_options(main_module, permissions, &options)