On Tuesday, September 17, 2013 12:16:23 AM UTC-7, Dan Carney wrote:
> The next round of changes to Persistent are in. V8_USE_UNSAFE_HANDLES no
> longer exists. Persistent now has a second template parameter that
> controls copy and assignment behaviour. The default parameters keep the
> behaviour unchanged. To allow copying one could use such a class as the
> below
>
> template<class T>
> struct CopyablePersistentTraits {
> typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent;
> static const bool kResetInDestructor = true;
> template<class S, class M>
> static void Copy(const Persistent<S, M>& source, CopyablePersistent*
> dest) {}
> };
>
> the Copy function is called on both copy and assign, and the
> kResetInDestructor
> variable controls whether Reset is called in the destructor.
>
> Setting kResetInDestructor = true is highly recommended, and we plan on
> changing the default traits class at some point to do this.
>
> We will keep the default functionality of disallowing copying and
> assignment as is, as these are expensive operations. An embedder should
> only perform them intentionally.
>
>
I'm in the process of integrating V8 into Go. Go does not understand C++,
so I've been having to cast Persistent handles to void*. I'm assuming this
is the only way to do it. The void* itself is wrapped in a C struct with an
enum specifying the type.
In one particular case a Persistent handle (wrapped) is passed into a
function, and then the function passing that parameter disposes the
Persistent handle. If the handle is a Function, then it needs a copy of
that Persistent handle. Is this what I have to do to copy the Persistent
handle, or is there a better way?
Luke
--
--
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.