diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-11-14 18:10:25 +0100 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-11-14 12:10:25 -0500 |
commit | 8b90b8e88325d28fe41d8312ea91417b6e66a12e (patch) | |
tree | a80d85de86353e05a5e59fe8b9890635dcbf200c /cli/ops/resources.rs | |
parent | 38ffe8886db104068af07cd5efe3d83f42da8ed6 (diff) |
refactor: per-worker resource table, take 2 (#3342)
- removes global `RESOURCE_TABLE` - resource tables are now created per `Worker`
in `State`
- renames `CliResource` to `StreamResource` and moves all logic related
to it to `cli/ops/io.rs`
- removes `cli/resources.rs`
- adds `state` argument to `op_read` and `op_write` and consequently adds
`stateful_minimal_op` to `State`
- IMPORTANT NOTE: workers don't have access to process stdio - this is
caused by fact that dropping worker would close stdout for process
(because it's constructed from raw handle, which closes underlying file
descriptor on drop)
Diffstat (limited to 'cli/ops/resources.rs')
-rw-r--r-- | cli/ops/resources.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cli/ops/resources.rs b/cli/ops/resources.rs index d92c6a83c..c35e9762c 100644 --- a/cli/ops/resources.rs +++ b/cli/ops/resources.rs @@ -1,7 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{JsonOp, Value}; use crate::ops::json_op; -use crate::resources::lock_resource_table; use crate::state::ThreadSafeState; use deno::*; @@ -10,11 +9,11 @@ pub fn init(i: &mut Isolate, s: &ThreadSafeState) { } fn op_resources( - _state: &ThreadSafeState, + state: &ThreadSafeState, _args: Value, _zero_copy: Option<PinnedBuf>, ) -> Result<JsonOp, ErrBox> { - let resource_table = lock_resource_table(); + let resource_table = state.lock_resource_table(); let serialized_resources = resource_table.entries(); Ok(JsonOp::Sync(json!(serialized_resources))) } |