Esempio n. 1
0
bool V8PerIsolateData::hasInstance(WrapperTypeInfo* info, v8::Handle<v8::Value> value, WrapperWorldType currentWorldType)
{
    TemplateMap& templates = rawTemplateMap(currentWorldType);
    TemplateMap::iterator result = templates.find(info);
    if (result == templates.end())
        return false;
    return result->value->HasInstance(value);
}
v8::Handle<v8::FunctionTemplate> V8PerIsolateData::rawTemplate(const WrapperTypeInfo* info, WrapperWorldType currentWorldType)
{
    TemplateMap& templates = rawTemplateMap(currentWorldType);
    TemplateMap::iterator result = templates.find(info);
    if (result != templates.end())
        return result->value.newLocal(m_isolate);

    v8::HandleScope handleScope(m_isolate);
    v8::Handle<v8::FunctionTemplate> templ = createRawTemplate(m_isolate);
    templates.add(info, UnsafePersistent<v8::FunctionTemplate>(m_isolate, templ));
    return handleScope.Close(templ);
}
Esempio n. 3
0
v8::Persistent<v8::FunctionTemplate> V8PerIsolateData::rawTemplate(WrapperTypeInfo* info, WrapperWorldType currentWorldType)
{
    TemplateMap& templates = rawTemplateMap(currentWorldType);
    TemplateMap::iterator result = templates.find(info);
    if (result != templates.end())
        return result->value;

    v8::HandleScope handleScope;
    v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(m_isolate);
    templates.add(info, templ);
    return templ;
}