summaryrefslogtreecommitdiff
path: root/core/snapshot_util.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-06-03 21:22:32 +0100
committerGitHub <noreply@github.com>2023-06-03 14:22:32 -0600
commit34dac6c6efa75f38c29031a65db1ee3332a67259 (patch)
tree5facbc9c0631feebc23ed2f2d9ea37643d0e7086 /core/snapshot_util.rs
parent7d0853d15863b2fb61bcf5927139cfdd3d869d73 (diff)
refactor(core): remove force_op_registration and cleanup JsRuntimeForSnapshot (#19353)
Addresses https://github.com/denoland/deno/pull/19308#discussion_r1212248194. Removes force_op_registration as it is no longer necessary.
Diffstat (limited to 'core/snapshot_util.rs')
-rw-r--r--core/snapshot_util.rs38
1 files changed, 2 insertions, 36 deletions
diff --git a/core/snapshot_util.rs b/core/snapshot_util.rs
index 05a196f50..88c273147 100644
--- a/core/snapshot_util.rs
+++ b/core/snapshot_util.rs
@@ -153,40 +153,6 @@ fn data_error_to_panic(err: v8::DataError) -> ! {
}
}
-pub(crate) enum SnapshotOptions {
- Load(Snapshot),
- CreateFromExisting(Snapshot),
- Create,
- None,
-}
-
-impl SnapshotOptions {
- pub fn new_from(snapshot: Option<Snapshot>, will_snapshot: bool) -> Self {
- match (snapshot, will_snapshot) {
- (Some(snapshot), true) => Self::CreateFromExisting(snapshot),
- (None, true) => Self::Create,
- (Some(snapshot), false) => Self::Load(snapshot),
- (None, false) => Self::None,
- }
- }
-
- pub fn loaded(&self) -> bool {
- matches!(self, Self::Load(_) | Self::CreateFromExisting(_))
- }
-
- pub fn will_snapshot(&self) -> bool {
- matches!(self, Self::Create | Self::CreateFromExisting(_))
- }
-
- pub fn snapshot(self) -> Option<Snapshot> {
- match self {
- Self::CreateFromExisting(snapshot) => Some(snapshot),
- Self::Load(snapshot) => Some(snapshot),
- _ => None,
- }
- }
-}
-
pub(crate) struct SnapshottedData {
pub module_map_data: v8::Global<v8::Array>,
pub module_handles: Vec<v8::Global<v8::Module>>,
@@ -257,9 +223,9 @@ pub(crate) fn set_snapshotted_data(
/// Returns an isolate set up for snapshotting.
pub(crate) fn create_snapshot_creator(
external_refs: &'static v8::ExternalReferences,
- maybe_startup_snapshot: SnapshotOptions,
+ maybe_startup_snapshot: Option<Snapshot>,
) -> v8::OwnedIsolate {
- if let Some(snapshot) = maybe_startup_snapshot.snapshot() {
+ if let Some(snapshot) = maybe_startup_snapshot {
match snapshot {
Snapshot::Static(data) => {
v8::Isolate::snapshot_creator_from_existing_snapshot(