mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-22 04:40:01 +00:00
Fix: SnapshotCreator's internal Isolate does not get initialized (#371)
This commit is contained in:
parent
f242d17732
commit
6638b05096
@ -159,10 +159,14 @@ impl Isolate {
|
||||
IsolateHandle::new(self)
|
||||
}
|
||||
|
||||
fn create_annex(&mut self, create_param_allocations: Box<dyn Any>) {
|
||||
pub(crate) fn create_annex(
|
||||
&mut self,
|
||||
create_param_allocations: Box<dyn Any>,
|
||||
) {
|
||||
let annex_arc = Arc::new(IsolateAnnex::new(self, create_param_allocations));
|
||||
let annex_ptr = Arc::into_raw(annex_arc);
|
||||
unsafe { v8__Isolate__SetData(self, 0, annex_ptr as *mut c_void) }
|
||||
unsafe { assert!(v8__Isolate__GetData(self, 0).is_null()) };
|
||||
unsafe { v8__Isolate__SetData(self, 0, annex_ptr as *mut c_void) };
|
||||
}
|
||||
|
||||
fn get_annex(&self) -> &IsolateAnnex {
|
||||
|
@ -133,6 +133,8 @@ impl SnapshotCreator {
|
||||
// revisited after the libdeno integration is complete.
|
||||
pub unsafe fn get_owned_isolate(&mut self) -> OwnedIsolate {
|
||||
let isolate_ptr = v8__SnapshotCreator__GetIsolate(self);
|
||||
OwnedIsolate::new(isolate_ptr)
|
||||
let mut owned_isolate = OwnedIsolate::new(isolate_ptr);
|
||||
owned_isolate.create_annex(Box::new(()));
|
||||
owned_isolate
|
||||
}
|
||||
}
|
||||
|
@ -1761,6 +1761,9 @@ fn snapshot_creator() {
|
||||
// the scope type system.
|
||||
let mut isolate = unsafe { snapshot_creator.get_owned_isolate() };
|
||||
|
||||
// Check that the SnapshotCreator isolate has been set up correctly.
|
||||
let _ = isolate.thread_safe_handle();
|
||||
|
||||
let mut hs = v8::HandleScope::new(&mut isolate);
|
||||
let scope = hs.enter();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user