From f7fdb90fd51e340ea598c055bb3573d3cdfbdaa8 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 8 Apr 2019 10:12:43 -0400 Subject: 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. --- cli/cli_behavior.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'cli/cli_behavior.rs') diff --git a/cli/cli_behavior.rs b/cli/cli_behavior.rs index 05f2cf006..860ec76ec 100644 --- a/cli/cli_behavior.rs +++ b/cli/cli_behavior.rs @@ -4,24 +4,16 @@ use crate::ops; use deno::deno_buf; use deno::Behavior; use deno::Op; -use deno::StartupData; use std::sync::Arc; /// Implements deno::Behavior for the main Deno command-line. pub struct CliBehavior { - startup_data: Option, pub state: Arc, } impl CliBehavior { - pub fn new( - startup_data: Option, - state: Arc, - ) -> Self { - Self { - startup_data, - state, - } + pub fn new(state: Arc) -> Self { + Self { state } } } @@ -38,10 +30,6 @@ impl IsolateStateContainer for CliBehavior { } impl Behavior for CliBehavior { - fn startup_data(&mut self) -> Option { - self.startup_data.take() - } - fn dispatch( &mut self, control: &[u8], -- cgit v1.2.3