Skip to content

Commit

Permalink
Rename deno_core::Isolate to deno_core::CoreIsolate (denoland#4851)
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Apr 23, 2020
1 parent 10a1748 commit d871115
Show file tree
Hide file tree
Showing 36 changed files with 253 additions and 227 deletions.
10 changes: 5 additions & 5 deletions cli/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use deno_core::include_crate_modules;
use deno_core::Isolate;
use deno_core::CoreIsolate;
use deno_core::StartupData;
use std::collections::HashMap;
use std::env;
Expand Down Expand Up @@ -48,10 +48,10 @@ fn main() {
.expect("Bundle compilation failed");
assert!(bundle_path.exists());

let runtime_isolate = &mut Isolate::new(StartupData::None, true);
let mut runtime_isolate = CoreIsolate::new(StartupData::None, true);

deno_typescript::mksnapshot_bundle(
runtime_isolate,
&mut runtime_isolate,
&snapshot_path,
&bundle_path,
&main_module_name,
Expand All @@ -71,7 +71,7 @@ fn main() {
.expect("Bundle compilation failed");
assert!(bundle_path.exists());

let runtime_isolate = &mut Isolate::new(StartupData::None, true);
let mut runtime_isolate = CoreIsolate::new(StartupData::None, true);

let mut custom_libs: HashMap<String, PathBuf> = HashMap::new();
custom_libs.insert(
Expand All @@ -96,7 +96,7 @@ fn main() {
);

deno_typescript::mksnapshot_bundle_ts(
runtime_isolate,
&mut runtime_isolate,
&snapshot_path,
&bundle_path,
&main_module_name,
Expand Down
4 changes: 2 additions & 2 deletions cli/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,11 @@ impl DenoInspector {
const CONTEXT_GROUP_ID: i32 = 1;

pub fn new(
isolate: &mut deno_core::Isolate,
isolate: &mut deno_core::CoreIsolate,
host: SocketAddr,
wait_for_debugger: bool,
) -> Box<Self> {
let deno_core::Isolate {
let deno_core::CoreIsolate {
v8_isolate,
global_context,
..
Expand Down
4 changes: 2 additions & 2 deletions cli/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub static WINDOW_LIB: &str = include_str!("js/lib.deno.window.d.ts");

#[test]
fn cli_snapshot() {
let mut isolate = deno_core::Isolate::new(
let mut isolate = deno_core::CoreIsolate::new(
deno_core::StartupData::Snapshot(deno_core::Snapshot::Static(CLI_SNAPSHOT)),
false,
);
Expand All @@ -40,7 +40,7 @@ fn cli_snapshot() {

#[test]
fn compiler_snapshot() {
let mut isolate = deno_core::Isolate::new(
let mut isolate = deno_core::CoreIsolate::new(
deno_core::StartupData::Snapshot(deno_core::Snapshot::Static(
COMPILER_SNAPSHOT,
)),
Expand Down
6 changes: 4 additions & 2 deletions cli/ops/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ use crate::futures::future::try_join_all;
use crate::msg;
use crate::op_error::OpError;
use crate::state::State;
use deno_core::CoreIsolate;
use deno_core::ModuleLoader;
use deno_core::*;
use deno_core::ModuleSpecifier;
use deno_core::ZeroCopyBuf;
use futures::future::FutureExt;

pub fn init(i: &mut Isolate, s: &State) {
pub fn init(i: &mut CoreIsolate, s: &State) {
i.register_op("op_cache", s.stateful_json_op(op_cache));
i.register_op("op_resolve_modules", s.stateful_json_op(op_resolve_modules));
i.register_op(
Expand Down
16 changes: 8 additions & 8 deletions cli/ops/dispatch_json.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use crate::op_error::OpError;
use deno_core::*;
use deno_core::Buf;
use deno_core::CoreIsolate;
use deno_core::Op;
use deno_core::ZeroCopyBuf;
use futures::future::FutureExt;
pub use serde_derive::Deserialize;
use serde_json::json;
Expand Down Expand Up @@ -43,15 +46,12 @@ struct AsyncArgs {

pub fn json_op<D>(
d: D,
) -> impl Fn(&mut deno_core::Isolate, &[u8], Option<ZeroCopyBuf>) -> Op
) -> impl Fn(&mut CoreIsolate, &[u8], Option<ZeroCopyBuf>) -> Op
where
D: Fn(
&mut deno_core::Isolate,
Value,
Option<ZeroCopyBuf>,
) -> Result<JsonOp, OpError>,
D:
Fn(&mut CoreIsolate, Value, Option<ZeroCopyBuf>) -> Result<JsonOp, OpError>,
{
move |isolate: &mut deno_core::Isolate,
move |isolate: &mut CoreIsolate,
control: &[u8],
zero_copy: Option<ZeroCopyBuf>| {
let async_args: AsyncArgs = match serde_json::from_slice(control) {
Expand Down
7 changes: 4 additions & 3 deletions cli/ops/dispatch_minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use crate::op_error::OpError;
use byteorder::{LittleEndian, WriteBytesExt};
use deno_core::Buf;
use deno_core::CoreIsolate;
use deno_core::Op;
use deno_core::ZeroCopyBuf;
use futures::future::FutureExt;
Expand Down Expand Up @@ -115,11 +116,11 @@ fn test_parse_min_record() {

pub fn minimal_op<D>(
d: D,
) -> impl Fn(&mut deno_core::Isolate, &[u8], Option<ZeroCopyBuf>) -> Op
) -> impl Fn(&mut CoreIsolate, &[u8], Option<ZeroCopyBuf>) -> Op
where
D: Fn(&mut deno_core::Isolate, bool, i32, Option<ZeroCopyBuf>) -> MinimalOp,
D: Fn(&mut CoreIsolate, bool, i32, Option<ZeroCopyBuf>) -> MinimalOp,
{
move |isolate: &mut deno_core::Isolate,
move |isolate: &mut CoreIsolate,
control: &[u8],
zero_copy: Option<ZeroCopyBuf>| {
let mut record = match parse_min_record(control) {
Expand Down
5 changes: 3 additions & 2 deletions cli/ops/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ use crate::op_error::OpError;
use crate::source_maps::get_orig_position;
use crate::source_maps::CachedMaps;
use crate::state::State;
use deno_core::*;
use deno_core::CoreIsolate;
use deno_core::ZeroCopyBuf;
use std::collections::HashMap;

pub fn init(i: &mut Isolate, s: &State) {
pub fn init(i: &mut CoreIsolate, s: &State) {
i.register_op(
"op_apply_source_map",
s.stateful_json_op(op_apply_source_map),
Expand Down
7 changes: 4 additions & 3 deletions cli/ops/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ use super::io::{StreamResource, StreamResourceHolder};
use crate::http_util::{create_http_client, HttpBody};
use crate::op_error::OpError;
use crate::state::State;
use deno_core::*;
use deno_core::CoreIsolate;
use deno_core::ZeroCopyBuf;
use futures::future::FutureExt;
use http::header::HeaderName;
use http::header::HeaderValue;
use http::Method;
use std::convert::From;

pub fn init(i: &mut Isolate, s: &State) {
pub fn init(i: &mut CoreIsolate, s: &State) {
i.register_op("op_fetch", s.stateful_json_op2(op_fetch));
}

Expand All @@ -23,7 +24,7 @@ struct FetchArgs {
}

pub fn op_fetch(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
state: &State,
args: Value,
data: Option<ZeroCopyBuf>,
Expand Down
8 changes: 4 additions & 4 deletions cli/ops/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::fs::resolve_from_cwd;
use crate::op_error::OpError;
use crate::ops::dispatch_json::JsonResult;
use crate::state::State;
use deno_core::Isolate;
use deno_core::CoreIsolate;
use deno_core::ZeroCopyBuf;
use futures::future::FutureExt;
use std::convert::From;
Expand All @@ -17,7 +17,7 @@ use std::time::UNIX_EPOCH;

use rand::{thread_rng, Rng};

pub fn init(i: &mut Isolate, s: &State) {
pub fn init(i: &mut CoreIsolate, s: &State) {
i.register_op("op_open", s.stateful_json_op2(op_open));
i.register_op("op_seek", s.stateful_json_op2(op_seek));
i.register_op("op_umask", s.stateful_json_op(op_umask));
Expand Down Expand Up @@ -68,7 +68,7 @@ struct OpenOptions {
}

fn op_open(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
state: &State,
args: Value,
_zero_copy: Option<ZeroCopyBuf>,
Expand Down Expand Up @@ -205,7 +205,7 @@ struct SeekArgs {
}

fn op_seek(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
_state: &State,
args: Value,
_zero_copy: Option<ZeroCopyBuf>,
Expand Down
10 changes: 6 additions & 4 deletions cli/ops/fs_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
use super::dispatch_json::{Deserialize, JsonOp, Value};
use crate::op_error::OpError;
use crate::state::State;
use deno_core::*;
use deno_core::CoreIsolate;
use deno_core::ErrBox;
use deno_core::ZeroCopyBuf;
use futures::future::poll_fn;
use futures::future::FutureExt;
use notify::event::Event as NotifyEvent;
Expand All @@ -16,7 +18,7 @@ use std::convert::From;
use std::path::PathBuf;
use tokio::sync::mpsc;

pub fn init(i: &mut Isolate, s: &State) {
pub fn init(i: &mut CoreIsolate, s: &State) {
i.register_op("op_fs_events_open", s.stateful_json_op2(op_fs_events_open));
i.register_op("op_fs_events_poll", s.stateful_json_op2(op_fs_events_poll));
}
Expand Down Expand Up @@ -60,7 +62,7 @@ impl From<NotifyEvent> for FsEvent {
}

pub fn op_fs_events_open(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
state: &State,
args: Value,
_zero_copy: Option<ZeroCopyBuf>,
Expand Down Expand Up @@ -98,7 +100,7 @@ pub fn op_fs_events_open(
}

pub fn op_fs_events_poll(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
_state: &State,
args: Value,
_zero_copy: Option<ZeroCopyBuf>,
Expand Down
10 changes: 6 additions & 4 deletions cli/ops/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use super::dispatch_minimal::MinimalOp;
use crate::http_util::HttpBody;
use crate::op_error::OpError;
use crate::state::State;
use deno_core::*;
use deno_core::CoreIsolate;
use deno_core::ResourceTable;
use deno_core::ZeroCopyBuf;
use futures::future::poll_fn;
use futures::future::FutureExt;
use futures::ready;
Expand Down Expand Up @@ -58,7 +60,7 @@ lazy_static! {
};
}

pub fn init(i: &mut Isolate, s: &State) {
pub fn init(i: &mut CoreIsolate, s: &State) {
i.register_op("op_read", s.stateful_minimal_op2(op_read));
i.register_op("op_write", s.stateful_minimal_op2(op_write));
}
Expand Down Expand Up @@ -204,7 +206,7 @@ impl DenoAsyncRead for StreamResource {
}

pub fn op_read(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
_state: &State,
is_sync: bool,
rid: i32,
Expand Down Expand Up @@ -328,7 +330,7 @@ impl DenoAsyncWrite for StreamResource {
}

pub fn op_write(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
_state: &State,
is_sync: bool,
rid: i32,
Expand Down
22 changes: 12 additions & 10 deletions cli/ops/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use super::io::{StreamResource, StreamResourceHolder};
use crate::op_error::OpError;
use crate::resolve_addr::resolve_addr;
use crate::state::State;
use deno_core::*;
use deno_core::CoreIsolate;
use deno_core::ResourceTable;
use deno_core::ZeroCopyBuf;
use futures::future::poll_fn;
use futures::future::FutureExt;
use std::convert::From;
Expand All @@ -19,7 +21,7 @@ use tokio::net::UdpSocket;
#[cfg(unix)]
use super::net_unix;

pub fn init(i: &mut Isolate, s: &State) {
pub fn init(i: &mut CoreIsolate, s: &State) {
i.register_op("op_accept", s.stateful_json_op2(op_accept));
i.register_op("op_connect", s.stateful_json_op2(op_connect));
i.register_op("op_shutdown", s.stateful_json_op2(op_shutdown));
Expand All @@ -35,7 +37,7 @@ struct AcceptArgs {
}

fn accept_tcp(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
args: AcceptArgs,
_zero_copy: Option<ZeroCopyBuf>,
) -> Result<JsonOp, OpError> {
Expand Down Expand Up @@ -95,7 +97,7 @@ fn accept_tcp(
}

fn op_accept(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
_state: &State,
args: Value,
zero_copy: Option<ZeroCopyBuf>,
Expand All @@ -119,7 +121,7 @@ struct ReceiveArgs {
}

fn receive_udp(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
_state: &State,
args: ReceiveArgs,
zero_copy: Option<ZeroCopyBuf>,
Expand Down Expand Up @@ -156,7 +158,7 @@ fn receive_udp(
}

fn op_receive(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
state: &State,
args: Value,
zero_copy: Option<ZeroCopyBuf>,
Expand Down Expand Up @@ -185,7 +187,7 @@ struct SendArgs {
}

fn op_send(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
state: &State,
args: Value,
zero_copy: Option<ZeroCopyBuf>,
Expand Down Expand Up @@ -254,7 +256,7 @@ struct ConnectArgs {
}

fn op_connect(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
state: &State,
args: Value,
_zero_copy: Option<ZeroCopyBuf>,
Expand Down Expand Up @@ -339,7 +341,7 @@ struct ShutdownArgs {
}

fn op_shutdown(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
_state: &State,
args: Value,
_zero_copy: Option<ZeroCopyBuf>,
Expand Down Expand Up @@ -479,7 +481,7 @@ fn listen_udp(
}

fn op_listen(
isolate: &mut deno_core::Isolate,
isolate: &mut CoreIsolate,
state: &State,
args: Value,
_zero_copy: Option<ZeroCopyBuf>,
Expand Down
Loading

0 comments on commit d871115

Please sign in to comment.