Have you tried it?   This is fundamentally required behavior in anything 
that embeds any type of externally allocated memory inside a JavaScript 
object, so I'd be surprised if it were broken.

I've been using this for years and never had any issues with it not 
returning me the data I expect.

Or perhaps I'm misunderstanding you -- this is the code that allows you to 
destroy your objects when the JavaScript garbage collector runs, right?

--Zac

On Monday, February 26, 2018 at 8:49:42 PM UTC-8, A.M. wrote:
>
> Calling `SetWeak` like this:
>
> global_handle.SetWeak(parameter, &X::WeakCallback, v8::WeakCallbackType::
> kInternalFields);
>
> , against a handle that contains an object with internal fields calls 
> `X::WeakCallback` with the parameter and both internal fields of 
> `v8::WeakCallbackInfo<v8::Global<v8::Object>>` always return `NULL`. 
>
> Looking at 
> `v8::internal::GlobalHandles::Node::PostGarbageCollectionProcessing`, which 
> calls the weak callback, those internal fields are always `NULL`:
>
>     void* embedder_fields[v8::kEmbedderFieldsInWeakCallback] = {nullptr,
>                                                                 nullptr};
>     v8::WeakCallbackInfo<void> data(reinterpret_cast<v8::Isolate*>(isolate
> ),
>                                     parameter(), embedder_fields, nullptr
> );
>     weak_callback_(data);
>
>
> Is that some experimental feature or there's some way to make object's 
> internal fields available within the weak callback?
>
> Thanks
>
>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to