1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

refactor(core): move setting up snapshot context to JsRuntime::snapshot (#18383)

This commit is contained in:
Bartek Iwańczuk 2023-03-23 14:10:17 +01:00 committed by GitHub
parent 2117d9c1a7
commit 64602e7027
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -411,7 +411,6 @@ impl JsRuntime {
}
global_context = v8::Global::new(scope, context);
scope.set_default_context(context);
}
(isolate, snapshot_options)
} else {
@ -931,6 +930,14 @@ impl JsRuntime {
pub fn snapshot(mut self) -> v8::StartupData {
self.state.borrow_mut().inspector.take();
// Set the context to be snapshot's default context
{
let context = self.global_context();
let mut scope = self.handle_scope();
let local_context = v8::Local::new(&mut scope, context);
scope.set_default_context(local_context);
}
// Serialize the module map and store its data in the snapshot.
{
let snapshotted_data = {