Esempio n. 1
0
v8::Local<v8::Context> V8Proxy::mainWorldContext(Frame* frame)
{
    V8Proxy* proxy = retrieve(frame);
    if (!proxy)
        return v8::Local<v8::Context>();

    proxy->initContextIfNeeded();
    return v8::Local<v8::Context>::New(proxy->context());
}
Esempio n. 2
0
PassRefPtr<SharedPersistent<v8::Context> > V8Proxy::shared_context(Frame* frame)
{
    V8Proxy *proxy = V8Proxy::retrieve(frame);
    if (!proxy)
        return 0;

    proxy->initContextIfNeeded();
    RefPtr<SharedPersistent<v8::Context> > context = proxy->shared_context();
    if (V8IsolatedWorld* world = V8IsolatedWorld::getEntered()) {
        context = world->shared_context();
        if (frame != V8Proxy::retrieveFrame(context->get()))
            return 0;
    }

    return context;
}