On Tuesday, August 27, 2013 1:53:03 AM UTC+2, Jim Acquavella wrote:
>
> But if you centralize the storage and information associated with an 
> indirection, then all copies, weak or otherwise should point to the same 
> object.  If during a weak callback disposes the handle, and others are 
> referring to it such that it isn't the last reference, the memory 
> associated with the handle shouldn't be disposed, but the handle data 
> should be.  Then, the other handles when calling IsEmpty should return 
> true.  The centralized data used for the Persistent is reference counted 
> and only when the reference count becomes zero should the actual 
> centralized storage memory be disposed.  Make sense?
>

It makes sense technically, yes, but it makes the api semantically 
confusing, which we'd like to avoid.  There are certain actions which would 
force the duplication of the storage cell - like calling make weak on a 
cell that's already weak.  Or even calling SetWrapperClassId.  A persistent 
can't have 2 weak callbacks or 2 class_ids, so duplicating the cell is the 
only logical thing to do, and duplicating the cell is very unnatural in the 
context of reference counting.

To do correctly, it would essentially require some sort of persistent 
builder or something which would ensure that it can't be modified after 
creation (except in the weak callback).  As absurd as may sound, I'd like 
to minimize the changes to the api.

Additionally, handles are meant to be strong, and passing around a 
persistent that might just disappear outside of its weak callback is 
somewhat contrary to the way the api is intended to work.

-- 
-- 
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to