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. --- core/libdeno/test.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/libdeno/test.h') diff --git a/core/libdeno/test.h b/core/libdeno/test.h index 2f7c32384..dd5dc99b2 100644 --- a/core/libdeno/test.h +++ b/core/libdeno/test.h @@ -5,7 +5,8 @@ #include "deno.h" #include "testing/gtest/include/gtest/gtest.h" -extern deno_buf snapshot; // Loaded in libdeno/test.cc +extern deno_snapshot snapshot; // Loaded in libdeno/test.cc const deno_buf empty = {nullptr, 0, nullptr, 0, 0}; +const deno_snapshot empty_snapshot = {nullptr, 0}; #endif // TEST_H_ -- cgit v1.2.3