[v8-users] Re: When is SetSecondPassCallback need to be called?

2018-07-23 Thread Zac Hansen

there was a long conversation about this about a year ago, maybe you can 
find it.  it turned out to be pretty convoluted from what I remember.


On Monday, July 23, 2018 at 12:16:09 AM UTC-7, fengx...@gmail.com wrote:
>
> Hi, 
> I noticed that chromium's sourcecode src/gin/wrappable.cc 
> use SetSecondPassCallback to make wrappable object deleted, while node.js 
> does not. So when is SetSecondPassCallback need to be used? what's the 
> purpose of this api?
>
> I also find a related link 
> 
>  which 
> says:
>
> "Phantom handles allow for freeing objects with one pass of GC. However, 
> this means that by the time the callback is invoked, the v8 object already 
> does no longer exist. To avoid accidential access to the dead object, 
> there 
> are now two callbacks, where the first must only reset the handle, and the 
> second does the clean-up work. "
>
> It looks like if not use second pass callback, accidential access to the 
> dead object will happen. what's the accidential access? Does the dead 
> object  means the v8 object or the wrappable object?
>

-- 
-- 
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.


Re: [v8-users] where is the implementation of ObjectTemplate constructor?

2018-07-23 Thread fengxingren
Thanks. So the heap object 's "member data" are initialized by READ_FILEDS 
macro which directly read by offset.

在 2018年7月21日星期六 UTC+8上午1:36:42,Jakob Kummerow写道:
>
> ObjectTemplate has no constructor (because it lives on the managed heap, 
> where C++ constructors don't make sense). Declaring a private constructor 
> (without defining it anywhere) prevents the C++ compiler from automatically 
> creating a default constructor. The only way to create an ObjectTemplate is 
> with its New(...) method.
>
> On Fri, Jul 20, 2018 at 2:49 AM > wrote:
>
>> Hi,
>> ObjectTemplate is declared in v8.h, and it's constructor was declared as 
>> private. But where is the implementation of it's constructor? I can't find 
>> it's source code.
>>
>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@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+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
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.


[v8-users] When is SetSecondPassCallback need to be called?

2018-07-23 Thread fengxingren
Hi, 
I noticed that chromium's sourcecode src/gin/wrappable.cc 
use SetSecondPassCallback to make wrappable object deleted, while node.js 
does not. So when is SetSecondPassCallback need to be used? what's the 
purpose of this api?

I also find a related link 

 which 
says:

"Phantom handles allow for freeing objects with one pass of GC. However, 
this means that by the time the callback is invoked, the v8 object already 
does no longer exist. To avoid accidential access to the dead object, there 
are now two callbacks, where the first must only reset the handle, and the 
second does the clean-up work. "

It looks like if not use second pass callback, accidential access to the 
dead object will happen. what's the accidential access? Does the dead 
object  means the v8 object or the wrappable object?

-- 
-- 
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.