Context::Scope is just a simple class which calls Contex::Enter() in its
constructor and Context::Exit() in its destructor on the context passed to
it. The best way to use it is to place it inside C++ scopes
{
v8::Context::Scope scope(context1);
...
}
{
v8::Context::Scope scope(context2);
...
}
This code is equivalent to
context1->Enter();
...
context1->Exit();
context2->Enter();
...
context2->Exit();
Also Context::Scope is convenient when having a function which does
something in a given context
void DoSomething(Handle<Context> context) {
Context::Scope(context);
...
}
Regards,
Søren
On Tue, Jan 4, 2011 at 20:04, getify <[email protected]> wrote:
> In fact, let me go even further and say, is there even a need to have
> a name for each scope? Since I can uniquely name each context (as
> shown in the above code), can I just dynamically switch the scope with
> some call and not have that be assigned to some variable name at all?
> As far as I've seen, I don't actually need the name of the `Scope` to
> pass to any subsequent API calls, right?
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users