On Wed, Aug 7, 2013 at 10:46 AM, Dan Carney <dcar...@chromium.org> wrote: > Hi all, > > as part of the refactor of v8::Persistent, I've added the ability to store > and fetch a handle which will live for the lifetime of the Isolate, but > which has none of the complexity and overhead (and problems) of a > Persistent. This can be useful for things like ObjectTemplates and > FunctionTemplates which you might lazily initialize, but need forever once > they have been initialized. There are probably other use cases out there as > well. > > The API is simple: > > int eternal_index = v8::kUninitializedEternalIndex; // always initialize to > this value > { > HandleScope scope(isolate); > Local<Object> local = .... // some v8 code > eternal_index = local.Eternalize(isolate); > } > > // Note: don't actually need a HandleScope to simply get an eternal > Local<Object> local = Local<Object>::GetEternal(isolate, eternal_index); > > Any place where you can Eternalize a handle, it's probably best to do so, as > Persistents that live forever can potentially hold on to a lot of memory in > internal data structures. > > Cheers, > Dan
Hi Dan, I saw the patches land in the last few days, looks like a useful addition to the API. Quick question (and one I suspect I know the answer to): how do eternal handles interact with contexts? The eternal handles list is a per-isolate property. If I create and eternalize a handle in context A, then it won't be usable in context B unless the security tokens match, right? Thanks, Ben -- -- 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/groups/opt_out.