summaryrefslogtreecommitdiff
path: root/cli/program_state.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 /cli/program_state.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 'cli/program_state.rs')
-rw-r--r--cli/program_state.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/program_state.rs b/cli/program_state.rs
index f47dcf0e9..a41acdec3 100644
--- a/cli/program_state.rs
+++ b/cli/program_state.rs
@@ -14,6 +14,7 @@ use crate::module_graph::TypeLib;
use crate::source_maps::SourceMapGetter;
use crate::specifier_handler::FetchHandler;
use crate::version;
+use deno_runtime::deno_file::BlobUrlStore;
use deno_runtime::inspector::InspectorServer;
use deno_runtime::permissions::Permissions;
@@ -56,6 +57,7 @@ pub struct ProgramState {
pub maybe_import_map: Option<ImportMap>,
pub maybe_inspector_server: Option<Arc<InspectorServer>>,
pub ca_data: Option<Vec<u8>>,
+ pub blob_url_store: BlobUrlStore,
}
impl ProgramState {
@@ -80,11 +82,14 @@ impl ProgramState {
CacheSetting::Use
};
+ let blob_url_store = BlobUrlStore::default();
+
let file_fetcher = FileFetcher::new(
http_cache,
cache_usage,
!flags.no_remote,
ca_data.clone(),
+ blob_url_store.clone(),
)?;
let lockfile = if let Some(filename) = &flags.lock {
@@ -131,6 +136,7 @@ impl ProgramState {
maybe_import_map,
maybe_inspector_server,
ca_data,
+ blob_url_store,
};
Ok(Arc::new(program_state))
}
@@ -257,7 +263,7 @@ impl ProgramState {
match url.scheme() {
// we should only be looking for emits for schemes that denote external
// modules, which the disk_cache supports
- "wasm" | "file" | "http" | "https" | "data" => (),
+ "wasm" | "file" | "http" | "https" | "data" | "blob" => (),
_ => {
return None;
}