From 7fc9d7d62a864d1e6af0e77291a105726f73279c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 24 Apr 2019 21:43:06 -0400 Subject: core: Add test for snapshotting from Rust (#2197) --- core/isolate.rs | 53 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 13 deletions(-) (limited to 'core/isolate.rs') diff --git a/core/isolate.rs b/core/isolate.rs index 95cf1be17..5488fab75 100644 --- a/core/isolate.rs +++ b/core/isolate.rs @@ -65,12 +65,14 @@ pub struct Script<'a> { pub enum StartupData<'a> { Script(Script<'a>), Snapshot(&'a [u8]), + LibdenoSnapshot(Snapshot1<'a>), None, } #[derive(Default)] pub struct Config { dispatch: Option (bool, Box) + Send + Sync>>, + pub will_snapshot: bool, } impl Config { @@ -129,21 +131,29 @@ impl Isolate { let shared = SharedQueue::new(RECOMMENDED_SIZE); let needs_init = true; - // Seperate into Option values for eatch startup type - let (startup_snapshot, startup_script) = match startup_data { - StartupData::Snapshot(d) => (Some(d), None), - StartupData::Script(d) => (None, Some(d)), - StartupData::None => (None, None), - }; - let libdeno_config = libdeno::deno_config { - will_snapshot: 0, - load_snapshot: match startup_snapshot { - Some(s) => Snapshot2::from(s), - None => Snapshot2::empty(), - }, + + let mut startup_script: Option