RecursiveLoad shouldn't own the Isolate (#2453)

This patch makes it so that RecursiveLoad doesn't own the Isolate, so
Worker::execute_mod_async does not consume itself.

Previously Worker implemented Loader, but now ThreadSafeState does.

This is necessary preparation work for dynamic import (#1789) and import
maps (#1921)
This commit is contained in:
Ryan Dahl 2019-06-05 16:35:38 -04:00 committed by GitHub
parent 6fa4d2e759
commit e152dae006
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 251 additions and 249 deletions

View file

@ -2067,7 +2067,7 @@ fn op_create_worker(
// TODO(ry) Use execute_mod_async here.
let result = worker.execute_mod(&specifier_url, false);
match result {
Ok(worker) => {
Ok(()) => {
let mut workers_tl = parent_state.workers.lock().unwrap();
workers_tl.insert(rid, worker.shared());
let builder = &mut FlatBufferBuilder::new();
@ -2085,10 +2085,8 @@ fn op_create_worker(
},
))
}
Err((errors::RustOrJsError::Js(_), _worker)) => {
Err(errors::worker_init_failed())
}
Err((errors::RustOrJsError::Rust(err), _worker)) => Err(err),
Err(errors::RustOrJsError::Js(_)) => Err(errors::worker_init_failed()),
Err(errors::RustOrJsError::Rust(err)) => Err(err),
}
}()))
}