On Wednesday, September 18, 2013 2:58:04 PM UTC-7, Ben Noordhuis wrote: > On Wed, Sep 18, 2013 at 10:10 PM, Luke <[email protected] <javascript:>> > wrote: > > On Wednesday, September 18, 2013 1:05:06 PM UTC-7, Ben Noordhuis wrote: > > > >> On Wed, Sep 18, 2013 at 9:44 PM, Luke <[email protected]> wrote: > >> > How do I get an Isolate from a persistent context? I need to enter an > >> > Isolate::Scope and Context::Scope, but this method is marked to be > >> > deprecated: > >> > > >> > V8_INLINE Scope(Isolate* isolate, Persistent<Context>& context) > >> > > >> > > >> > What is the right way to do this going forward? > >> > > >> > > >> > Luke > >> > >> Rematerialize the Local<Context> with Local<Context>::New(isolate, > >> persistent_context). After that, you create the Context::Scope as > >> usual. > >> > >> You can get the current isolate with Isolate::GetCurrent(). If you > >> have multiple isolates and you don't know at that point what isolate > >> the context belongs to, you'll have to restructure your application a > >> little. > > > > > > What does Isolate::GetCurrent() return? Does it always return an > Isolate? > > Yes. > > > So I need to use an Isolate, to get a Context, to get another Isolate. > Is > > that right? > > Yes and no. > > The isolate argument to Local<T>::New() is used to insert the new > Local into the current HandleScope so yes, what you're suggesting will > probably work. > > The wisdom of mixing isolates that way is debatable so no, I wouldn't > necessarily recommend it. Hence the 'restructure your application' > comment in my previous email; if you don't know what isolate that > context belongs to, try to re-order things so you do know. >
When I have a Persistent handle of something, does that something no longer belong to the Isolate? Is that why I can't get an Isolate from a Persistent handle? What is the proper way to (currently) copy a Persistent handle so if the other gets disposed I still have the copy? 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.
