mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-21 20:28:58 +00:00
isolate->GetCppHeap()
can return nullptr if no heap is attached (#1385)
Changes `v8::Isolate::get_cpp_heap` to return a `Option<&Heap>`.
This commit is contained in:
parent
e4cdf58665
commit
70a07c050b
@ -63,7 +63,7 @@ fn main() {
|
||||
let obj = templ.new_instance(scope).unwrap();
|
||||
|
||||
let member = v8::cppgc::make_garbage_collected(
|
||||
scope.get_cpp_heap(),
|
||||
scope.get_cpp_heap().unwrap(),
|
||||
Box::new(Wrappable {
|
||||
trace_count: Cell::new(0),
|
||||
id,
|
||||
|
@ -1100,8 +1100,8 @@ impl Isolate {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_cpp_heap(&mut self) -> &Heap {
|
||||
unsafe { &*v8__Isolate__GetCppHeap(self) }
|
||||
pub fn get_cpp_heap(&mut self) -> Option<&Heap> {
|
||||
unsafe { v8__Isolate__GetCppHeap(self).as_ref() }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
@ -59,8 +59,10 @@ fn cppgc_object_wrap() {
|
||||
|
||||
let obj = templ.new_instance(scope).unwrap();
|
||||
|
||||
let member =
|
||||
v8::cppgc::make_garbage_collected(scope.get_cpp_heap(), Box::new(Wrap));
|
||||
let member = v8::cppgc::make_garbage_collected(
|
||||
scope.get_cpp_heap().unwrap(),
|
||||
Box::new(Wrap),
|
||||
);
|
||||
|
||||
obj.set_aligned_pointer_in_internal_field(
|
||||
0,
|
||||
|
Loading…
Reference in New Issue
Block a user