mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 13:14:48 +00:00
core: snapshot improvements (#2052)
* Moves how snapshots are supplied to the Isolate. Previously they were given by Behavior::startup_data() but it was only called once at startup. It makes more sense (and simplifies Behavior) to pass it to the constructor of Isolate. * Adds new libdeno type deno_snapshot instead of overloading deno_buf. * Adds new libdeno method to delete snapshot deno_snapshot_delete(). * Renames deno_get_snapshot() to deno_snapshot_new(). * Makes StartupData hold references to snapshots. This was implicit when it previously held a deno_buf but is made explicit now. Note that include_bytes!() returns a &'static [u8] and we want to avoid copying that.
This commit is contained in:
parent
cdb72afd8d
commit
f7fdb90fd5
18 changed files with 182 additions and 121 deletions
|
@ -17,7 +17,6 @@ use deno::Behavior;
|
|||
use deno::Buf;
|
||||
use deno::JSError;
|
||||
use deno::Op;
|
||||
use deno::StartupData;
|
||||
use futures::future::*;
|
||||
use futures::sync::oneshot;
|
||||
use futures::Future;
|
||||
|
@ -70,10 +69,6 @@ impl IsolateStateContainer for &CompilerBehavior {
|
|||
}
|
||||
|
||||
impl Behavior for CompilerBehavior {
|
||||
fn startup_data(&mut self) -> Option<StartupData> {
|
||||
Some(startup_data::compiler_isolate_init())
|
||||
}
|
||||
|
||||
fn dispatch(
|
||||
&mut self,
|
||||
control: &[u8],
|
||||
|
@ -148,6 +143,7 @@ fn lazy_start(parent_state: Arc<IsolateState>) -> ResourceId {
|
|||
cell
|
||||
.get_or_insert_with(|| {
|
||||
let worker_result = workers::spawn(
|
||||
startup_data::compiler_isolate_init(),
|
||||
CompilerBehavior::new(
|
||||
parent_state.flags.clone(),
|
||||
parent_state.argv.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue