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:
parent
2117d9c1a7
commit
64602e7027
1 changed files with 8 additions and 1 deletions
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue