Skip to content

Commit

Permalink
refactor(core): merge CoreIsolate and EsIsolate (#7370)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Sep 6, 2020
1 parent c821e8f commit 803bdd3
Show file tree
Hide file tree
Showing 8 changed files with 981 additions and 1,016 deletions.
4 changes: 2 additions & 2 deletions cli/global_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl GlobalState {
}

/// This function is called when new module load is
/// initialized by the EsIsolate. Its resposibility is to collect
/// initialized by the CoreIsolate. Its resposibility is to collect
/// all dependencies and if it is required then also perform TS typecheck
/// and traspilation.
pub async fn prepare_module_load(
Expand Down Expand Up @@ -180,7 +180,7 @@ impl GlobalState {
}

// TODO(bartlomieju): this method doesn't need to be async anymore
/// This method is used after `prepare_module_load` finishes and EsIsolate
/// This method is used after `prepare_module_load` finishes and CoreIsolate
/// starts loading source and executing source code. This method shouldn't
/// perform any IO (besides $DENO_DIR) and only operate on sources collected
/// during `prepare_module_load`.
Expand Down
4 changes: 2 additions & 2 deletions cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ use crate::permissions::Permissions;
use crate::tsc::TargetLib;
use crate::worker::MainWorker;
use deno_core::v8_set_flags;
use deno_core::CoreIsolate;
use deno_core::Deps;
use deno_core::ErrBox;
use deno_core::EsIsolate;
use deno_core::ModuleSpecifier;
use deno_doc as doc;
use deno_doc::parser::DocFileLoader;
Expand Down Expand Up @@ -217,7 +217,7 @@ async fn print_file_info(
{
output.map = source_map.filename.to_str().map(|s| s.to_owned());
}
let es_state_rc = EsIsolate::state(&worker.isolate);
let es_state_rc = CoreIsolate::state(&worker.isolate);
let es_state = es_state_rc.borrow();

if let Some(deps) = es_state.modules.deps(&module_specifier) {
Expand Down
6 changes: 3 additions & 3 deletions cli/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn create_channels() -> (WorkerChannelsInternal, WorkerHandle) {
/// - `WebWorker`
pub struct Worker {
pub name: String,
pub isolate: deno_core::EsIsolate,
pub isolate: deno_core::CoreIsolate,
pub inspector: Option<Box<DenoInspector>>,
pub state: Rc<State>,
pub waker: AtomicWaker,
Expand All @@ -105,7 +105,7 @@ impl Worker {
startup_data: StartupData,
state: &Rc<State>,
) -> Self {
let mut isolate = deno_core::EsIsolate::new(
let mut isolate = deno_core::CoreIsolate::new_with_loader(
state.clone(),
state.clone(),
startup_data,
Expand Down Expand Up @@ -235,7 +235,7 @@ impl Future for Worker {
}

impl Deref for Worker {
type Target = deno_core::EsIsolate;
type Target = deno_core::CoreIsolate;
fn deref(&self) -> &Self::Target {
&self.isolate
}
Expand Down
7 changes: 3 additions & 4 deletions core/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use crate::CoreIsolate;
use crate::CoreIsolateState;
use crate::ErrBox;
use crate::EsIsolate;
use crate::JSError;
use crate::Op;
use crate::OpId;
Expand Down Expand Up @@ -240,7 +239,7 @@ pub extern "C" fn host_import_module_dynamically_callback(

let resolver_handle = v8::Global::new(scope, resolver);
{
let state_rc = EsIsolate::state(scope);
let state_rc = CoreIsolate::state(scope);
let mut state = state_rc.borrow_mut();
state.dyn_import_cb(resolver_handle, &specifier_str, &referrer_name_str);
}
Expand All @@ -254,7 +253,7 @@ pub extern "C" fn host_initialize_import_meta_object_callback(
meta: v8::Local<v8::Object>,
) {
let scope = &mut unsafe { v8::CallbackScope::new(context) };
let state_rc = EsIsolate::state(scope);
let state_rc = CoreIsolate::state(scope);
let state = state_rc.borrow();

let id = module.get_identity_hash();
Expand Down Expand Up @@ -713,7 +712,7 @@ pub fn module_resolve_callback<'s>(
) -> Option<v8::Local<'s, v8::Module>> {
let scope = &mut unsafe { v8::CallbackScope::new(context) };

let state_rc = EsIsolate::state(scope);
let state_rc = CoreIsolate::state(scope);
let mut state = state_rc.borrow_mut();

let referrer_id = referrer.get_identity_hash();
Expand Down
Loading

0 comments on commit 803bdd3

Please sign in to comment.