diff options
Diffstat (limited to 'cli/ops')
-rw-r--r-- | cli/ops/errors.rs | 2 | ||||
-rw-r--r-- | cli/ops/mod.rs | 14 | ||||
-rw-r--r-- | cli/ops/runtime.rs | 2 | ||||
-rw-r--r-- | cli/ops/runtime_compiler.rs | 10 | ||||
-rw-r--r-- | cli/ops/worker_host.rs | 14 |
5 files changed, 21 insertions, 21 deletions
diff --git a/cli/ops/errors.rs b/cli/ops/errors.rs index 40ea01370..04281e383 100644 --- a/cli/ops/errors.rs +++ b/cli/ops/errors.rs @@ -39,7 +39,7 @@ fn op_apply_source_map( args.line_number.into(), args.column_number.into(), &mut mappings_map, - &super::global_state(state).ts_compiler, + &super::program_state(state).ts_compiler, ); Ok(json!({ diff --git a/cli/ops/mod.rs b/cli/ops/mod.rs index b1ec5c344..f5f42a2d7 100644 --- a/cli/ops/mod.rs +++ b/cli/ops/mod.rs @@ -26,8 +26,8 @@ pub mod web_worker; pub mod websocket; pub mod worker_host; -use crate::global_state::GlobalState; use crate::metrics::metrics_op; +use crate::program_state::ProgramState; use deno_core::error::AnyError; use deno_core::json_op_async; use deno_core::json_op_sync; @@ -59,22 +59,22 @@ where /// Helper for checking unstable features. Used for sync ops. pub fn check_unstable(state: &OpState, api_name: &str) { - state.borrow::<Arc<GlobalState>>().check_unstable(api_name) + state.borrow::<Arc<ProgramState>>().check_unstable(api_name) } /// Helper for checking unstable features. Used for async ops. pub fn check_unstable2(state: &Rc<RefCell<OpState>>, api_name: &str) { let state = state.borrow(); - state.borrow::<Arc<GlobalState>>().check_unstable(api_name) + state.borrow::<Arc<ProgramState>>().check_unstable(api_name) } /// Helper for extracting the commonly used state. Used for sync ops. -pub fn global_state(state: &OpState) -> Arc<GlobalState> { - state.borrow::<Arc<GlobalState>>().clone() +pub fn program_state(state: &OpState) -> Arc<ProgramState> { + state.borrow::<Arc<ProgramState>>().clone() } /// Helper for extracting the commonly used state. Used for async ops. -pub fn global_state2(state: &Rc<RefCell<OpState>>) -> Arc<GlobalState> { +pub fn global_state2(state: &Rc<RefCell<OpState>>) -> Arc<ProgramState> { let state = state.borrow(); - state.borrow::<Arc<GlobalState>>().clone() + state.borrow::<Arc<ProgramState>>().clone() } diff --git a/cli/ops/runtime.rs b/cli/ops/runtime.rs index 3f7398479..3d7350361 100644 --- a/cli/ops/runtime.rs +++ b/cli/ops/runtime.rs @@ -29,7 +29,7 @@ fn op_start( _args: Value, _zero_copy: &mut [ZeroCopyBuf], ) -> Result<Value, AnyError> { - let gs = &super::global_state(state); + let gs = &super::program_state(state); Ok(json!({ // TODO(bartlomieju): `cwd` field is not used in JS, remove? diff --git a/cli/ops/runtime_compiler.rs b/cli/ops/runtime_compiler.rs index b06e51157..b01469fa9 100644 --- a/cli/ops/runtime_compiler.rs +++ b/cli/ops/runtime_compiler.rs @@ -37,14 +37,14 @@ async fn op_compile( super::check_unstable2(&state, "Deno.compile"); let args: CompileArgs = serde_json::from_value(args)?; let cli_state = super::global_state2(&state); - let global_state = cli_state.clone(); + let program_state = cli_state.clone(); let permissions = { let state = state.borrow(); state.borrow::<Permissions>().clone() }; let fut = if args.bundle { runtime_bundle( - &global_state, + &program_state, permissions, &args.root_name, &args.sources, @@ -53,7 +53,7 @@ async fn op_compile( .boxed_local() } else { runtime_compile( - &global_state, + &program_state, permissions, &args.root_name, &args.sources, @@ -79,8 +79,8 @@ async fn op_transpile( super::check_unstable2(&state, "Deno.transpile"); let args: TranspileArgs = serde_json::from_value(args)?; let cli_state = super::global_state2(&state); - let global_state = cli_state.clone(); + let program_state = cli_state.clone(); let result = - runtime_transpile(global_state, &args.sources, &args.options).await?; + runtime_transpile(program_state, &args.sources, &args.options).await?; Ok(result) } diff --git a/cli/ops/worker_host.rs b/cli/ops/worker_host.rs index 5de15f153..8ebf8b9e6 100644 --- a/cli/ops/worker_host.rs +++ b/cli/ops/worker_host.rs @@ -1,9 +1,9 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use crate::fmt_errors::JsError; -use crate::global_state::GlobalState; use crate::ops::io::get_stdio; use crate::permissions::Permissions; +use crate::program_state::ProgramState; use crate::tokio_util::create_basic_runtime; use crate::worker::WebWorker; use crate::worker::WebWorkerHandle; @@ -48,7 +48,7 @@ pub type WorkerId = u32; fn create_web_worker( worker_id: u32, name: String, - global_state: &Arc<GlobalState>, + program_state: &Arc<ProgramState>, permissions: Permissions, specifier: ModuleSpecifier, has_deno_namespace: bool, @@ -57,7 +57,7 @@ fn create_web_worker( name.clone(), permissions, specifier, - global_state.clone(), + program_state.clone(), has_deno_namespace, ); @@ -91,13 +91,13 @@ fn create_web_worker( fn run_worker_thread( worker_id: u32, name: String, - global_state: &Arc<GlobalState>, + program_state: &Arc<ProgramState>, permissions: Permissions, specifier: ModuleSpecifier, has_deno_namespace: bool, maybe_source_code: Option<String>, ) -> Result<(JoinHandle<()>, WebWorkerHandle), AnyError> { - let global_state = global_state.clone(); + let program_state = program_state.clone(); let (handle_sender, handle_receiver) = std::sync::mpsc::sync_channel::<Result<WebWorkerHandle, AnyError>>(1); @@ -111,7 +111,7 @@ fn run_worker_thread( let result = create_web_worker( worker_id, name, - &global_state, + &program_state, permissions, specifier.clone(), has_deno_namespace, @@ -211,7 +211,7 @@ fn op_create_worker( let module_specifier = ModuleSpecifier::resolve_url(&specifier)?; let worker_name = args_name.unwrap_or_else(|| "".to_string()); - let cli_state = super::global_state(state); + let cli_state = super::program_state(state); let (join_handle, worker_handle) = run_worker_thread( worker_id, |