Beispiel #1
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8AudioSourceNodeTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "AudioSourceNode", V8AudioNode::GetTemplate(), V8AudioSourceNode::internalFieldCount,
        0, 0,
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
Beispiel #2
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SVGFEDistantLightElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "SVGFEDistantLightElement", V8SVGElement::GetTemplate(), V8SVGFEDistantLightElement::internalFieldCount,
        SVGFEDistantLightElementAttrs, WTF_ARRAY_LENGTH(SVGFEDistantLightElementAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
static v8::Persistent<v8::FunctionTemplate> ConfigureV8XPathResultTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "XPathResult", v8::Persistent<v8::FunctionTemplate>(), V8XPathResult::internalFieldCount,
        XPathResultAttrs, sizeof(XPathResultAttrs) / sizeof(*XPathResultAttrs),
        XPathResultCallbacks, sizeof(XPathResultCallbacks) / sizeof(*XPathResultCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, XPathResultConsts, sizeof(XPathResultConsts) / sizeof(*XPathResultConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
Beispiel #4
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestExceptionTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestException", v8::Persistent<v8::FunctionTemplate>(), V8TestException::internalFieldCount,
        V8TestExceptionAttrs, WTF_ARRAY_LENGTH(V8TestExceptionAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
Beispiel #5
0
v8::Persistent<v8::ObjectTemplate> ECMAScriptContext::Impl::getGlobalTemplate() {
    static bool initilized = false;
    static v8::Persistent<v8::ObjectTemplate> globalTemplate;
    if (initilized)
        return globalTemplate;
#ifdef HAVE_V8_ISOLATE
    globalTemplate = v8::Persistent<v8::ObjectTemplate>::New(v8::Isolate::GetCurrent(), v8::ObjectTemplate::New());
#else
    globalTemplate = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
#endif
    registerClasses(globalTemplate);
    globalTemplate->SetInternalFieldCount(1);
    initilized = true;
    return globalTemplate;
}
Beispiel #6
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestExceptionTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = configureTemplate(desc, "TestException", v8::Persistent<v8::FunctionTemplate>(), V8TestException::internalFieldCount,
        TestExceptionAttrs, WTF_ARRAY_LENGTH(TestExceptionAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
Beispiel #7
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8XPathNSResolverTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "XPathNSResolver", v8::Persistent<v8::FunctionTemplate>(), V8XPathNSResolver::internalFieldCount,
        0, 0,
        XPathNSResolverCallbacks, WTF_ARRAY_LENGTH(XPathNSResolverCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
Beispiel #8
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8HTMLOutputElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "HTMLOutputElement", V8HTMLElement::GetTemplate(), V8HTMLOutputElement::internalFieldCount,
        HTMLOutputElementAttrs, WTF_ARRAY_LENGTH(HTMLOutputElementAttrs),
        HTMLOutputElementCallbacks, WTF_ARRAY_LENGTH(HTMLOutputElementCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SVGFontElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "SVGFontElement", V8SVGElement::GetTemplate(), V8SVGFontElement::internalFieldCount,
                       0, 0,
                       0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.


    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
Beispiel #10
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8MessageChannelTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "MessageChannel", v8::Persistent<v8::FunctionTemplate>(), V8MessageChannel::internalFieldCount,
        MessageChannelAttrs, WTF_ARRAY_LENGTH(MessageChannelAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    desc->SetCallHandler(V8MessageChannel::constructorCallback);
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestNamedConstructorTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType worldType)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestNamedConstructor", v8::Persistent<v8::FunctionTemplate>(), V8TestNamedConstructor::internalFieldCount,
        0, 0,
        0, 0, isolate);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
Beispiel #12
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8Float32ArrayTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "Float32Array", V8ArrayBufferView::GetTemplate(), V8Float32Array::internalFieldCount,
        Float32ArrayAttrs, WTF_ARRAY_LENGTH(Float32ArrayAttrs),
        Float32ArrayCallbacks, WTF_ARRAY_LENGTH(Float32ArrayCallbacks));
        desc->SetCallHandler(V8Float32Array::constructorCallback);
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, Float32ArrayConsts, WTF_ARRAY_LENGTH(Float32ArrayConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
Beispiel #13
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8EventExceptionTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "EventException",
      v8::Persistent<v8::FunctionTemplate>(), V8EventException::internalFieldCount,
      EventException_attrs, sizeof(EventException_attrs)/sizeof(*EventException_attrs),
      NULL, 0);
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  
  proto->Set(v8::String::New("toString"), v8::FunctionTemplate::New(EventExceptionInternal::toStringCallback, v8::Handle<v8::Value>(), default_signature), static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::DontEnum));
  batchConfigureConstants(desc, proto, EventException_consts, sizeof(EventException_consts)/sizeof(*EventException_consts));

  // Custom toString template
  desc->Set(getToStringName(), getToStringTemplate());
  return desc;
}
Beispiel #14
0
void Java_com_woyouquan_Canvas_nativeDone( JNIEnv *env )
{
	zip_close(apkArchive);

	if( !jsMainLoop.IsEmpty() )
	{
		jsMainLoop.Dispose();
	}

	CTimer::getInstance()->clean();
	CV8Context::getInstance()->clean();

	curl_global_cleanup();

	LOG("canvas done");
}
Beispiel #15
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestNodeTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = configureTemplate(desc, "TestNode", V8Node::GetTemplate(), V8TestNode::internalFieldCount,
        0, 0,
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    desc->SetCallHandler(V8TestNode::constructorCallback);
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
void NotifyProp (uv_work_t *r) {
  v8::HandleScope scope;
  async_req_prop *req = reinterpret_cast<async_req_prop *>(r->data);
  v8::TryCatch try_catch;
  v8::Local<v8::Value> argv[3];
  argv[0] = { v8::Local<v8::Value>::New(v8::String::New(req->quiddity_name.c_str ())) };
  argv[1] = { v8::Local<v8::Value>::New(v8::String::New(req->property_name.c_str ())) };
  argv[2] = { v8::Local<v8::Value>::New(v8::String::New(req->value.c_str ())) };
  if (!user_prop_cb.IsEmpty ())
    if (user_prop_cb->IsCallable ())
      user_prop_cb->Call(user_prop_cb, 3, argv);
  delete req;
  if (try_catch.HasCaught()) {
    node::FatalException(try_catch);
  }
}
Beispiel #17
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SVGFETurbulenceElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "SVGFETurbulenceElement", V8SVGElement::GetTemplate(), V8SVGFETurbulenceElement::internalFieldCount,
        SVGFETurbulenceElementAttrs, WTF_ARRAY_LENGTH(SVGFETurbulenceElementAttrs),
        SVGFETurbulenceElementCallbacks, WTF_ARRAY_LENGTH(SVGFETurbulenceElementCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, SVGFETurbulenceElementConsts, WTF_ARRAY_LENGTH(SVGFETurbulenceElementConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
static v8::Persistent<v8::FunctionTemplate> ConfigureV8HTMLCollectionTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "HTMLCollection", v8::Persistent<v8::FunctionTemplate>(), V8HTMLCollection::internalFieldCount,
        HTMLCollectionAttrs, sizeof(HTMLCollectionAttrs) / sizeof(*HTMLCollectionAttrs),
        HTMLCollectionCallbacks, sizeof(HTMLCollectionCallbacks) / sizeof(*HTMLCollectionCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    setCollectionIndexedGetter<HTMLCollection, Node>(desc);
    desc->InstanceTemplate()->SetNamedPropertyHandler(V8HTMLCollection::namedPropertyGetter, 0, 0, 0, 0);
    desc->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLCollection::callAsFunctionCallback);

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
static void cachedStringCallback(v8::Persistent<v8::Value> wrapper, void* parameter)
{
    StringImpl* stringImpl = static_cast<StringImpl*>(parameter);
    V8PerIsolateData::current()->stringCache()->remove(stringImpl);
    wrapper.Dispose();
    stringImpl->deref();
}
static v8::Persistent<v8::FunctionTemplate> ConfigureV8DOMStringMapTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "DOMStringMap", v8::Persistent<v8::FunctionTemplate>(), V8DOMStringMap::internalFieldCount,
        0, 0,
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    
    desc->InstanceTemplate()->SetNamedPropertyHandler(V8DOMStringMap::namedPropertyGetter, V8DOMStringMap::namedPropertySetter, V8DOMStringMap::namedPropertyQuery, V8DOMStringMap::namedPropertyDeleter, V8DOMStringMap::namedPropertyEnumerator);

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
Beispiel #21
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestEventConstructorTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestEventConstructor", v8::Persistent<v8::FunctionTemplate>(), V8TestEventConstructor::internalFieldCount,
                       V8TestEventConstructorAttrs, WTF_ARRAY_LENGTH(V8TestEventConstructorAttrs),
                       0, 0, isolate, currentWorldType);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    desc->SetCallHandler(V8TestEventConstructor::constructorCallback);
    desc->SetLength(1);

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SpeechRecognitionErrorTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "SpeechRecognitionError", V8Event::GetTemplate(), V8SpeechRecognitionError::internalFieldCount,
        V8SpeechRecognitionErrorAttrs, WTF_ARRAY_LENGTH(V8SpeechRecognitionErrorAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    desc->SetCallHandler(V8SpeechRecognitionError::constructorCallback);
    

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
Beispiel #23
0
 void visitDOMWrapper(DOMDataStore* store, T* object, v8::Persistent<v8::Object> wrapper)
 {
     WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
     if (!S::process(object, wrapper, typeInfo)) {
         ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper);
         if (activeDOMObject && activeDOMObject->hasPendingActivity()) {
             ASSERT(!wrapper.IsWeak());
             // NOTE: To re-enable weak status of the active object we use
             // |object| from the map and not |activeDOMObject|. The latter
             // may be a different pointer (in case ActiveDOMObject is not
             // the main base class of the object's class) and pointer
             // identity is required by DOM map functions.
             wrapper.MakeWeak(object, callback);
         }
     }
 }
Beispiel #24
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestSerializedScriptValueInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = configureTemplate(desc, "TestSerializedScriptValueInterface", v8::Persistent<v8::FunctionTemplate>(), V8TestSerializedScriptValueInterface::internalFieldCount,
        TestSerializedScriptValueInterfaceAttrs, WTF_ARRAY_LENGTH(TestSerializedScriptValueInterfaceAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    desc->SetCallHandler(V8TestSerializedScriptValueInterface::constructorCallback);
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
Beispiel #25
0
void ShaderBindings_BindToGlobal(v8::Persistent<v8::ObjectTemplate>& global) {
    HandleScope handle_scope;
    Handle<FunctionTemplate> shader = FunctionTemplate::New(fl_sha_ConstructorCall);
    shader->Set("getDefaultShader", FunctionTemplate::New(fl_sha_GetDefaultShader));
    shader->Set("getDefaultNoTextureShader", FunctionTemplate::New(fl_sha_GetDefaultNoTextureShader));
    global->Set("Shader", shader);
}
Beispiel #26
0
void _main(const char *fname)
{
    v8::V8::Initialize();

    v8::Platform *platform = v8::platform::CreateDefaultPlatform();
    v8::V8::InitializePlatform(platform);

    isolate = v8::Isolate::New();
    v8::Locker locker(isolate);
    v8::Isolate::Scope isolate_scope(isolate);

    v8::HandleScope handle_scope(isolate);

    v8::Local<v8::Context> _context = v8::Context::New(isolate);
    v8::Context::Scope context_scope(_context);

    v8::Local<v8::Object> glob = _context->Global();
    global_base::class_info().Attach(glob, NULL);

    Function_base::class_info().Attach(
        glob->Get(v8::String::NewFromUtf8(isolate, "Function"))->ToObject()->GetPrototype()->ToObject(),
        NULL);

    s_context.Reset(isolate, _context);
    s_global.Reset(isolate, glob);

    JSFiber *fb = new JSFiber();
    {
        JSFiber::scope s(fb);
        s_topSandbox = new SandBox();

        s_topSandbox->initRoot();
        if (fname)
            s.m_hr = s_topSandbox->run(fname);
        else
            s.m_hr = s_topSandbox->repl();
    }

    process_base::exit(0);

    isolate->Dispose();

    v8::V8::ShutdownPlatform();
    delete platform;

    s_context.Reset();
}
Beispiel #27
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SQLExceptionTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "SQLException", v8::Persistent<v8::FunctionTemplate>(), V8SQLException::internalFieldCount,
        SQLExceptionAttrs, WTF_ARRAY_LENGTH(SQLExceptionAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, SQLExceptionConsts, WTF_ARRAY_LENGTH(SQLExceptionConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
v8::Handle<v8::Value> V8Location::replaceAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.Location.replace._get");
    static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
    v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8Location::GetTemplate(), info.This());
    if (holder.IsEmpty()) {
        // can only reach here by 'object.__proto__.func', and it should passed
        // domain security check already
        return privateTemplate->GetFunction();
    }
    Location* imp = V8Location::toNative(holder);
    if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false)) {
        static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8::Handle<v8::Value>(), v8::Signature::New(V8Location::GetRawTemplate())));
        return sharedTemplate->GetFunction();
    }
    return privateTemplate->GetFunction();
}
v8::Persistent<v8::FunctionTemplate> V8HTMLAudioElementConstructor::GetTemplate()
{
    static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
    if (!cachedTemplate.IsEmpty())
        return cachedTemplate;

    v8::HandleScope scope;
    v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLAudioElementConstructorCallback);

    v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
    instance->SetInternalFieldCount(V8HTMLAudioElement::internalFieldCount);
    result->SetClassName(v8::String::New("HTMLAudioElement"));
    result->Inherit(V8HTMLAudioElement::GetTemplate());

    cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
    return cachedTemplate;
}
Beispiel #30
0
v8::Persistent<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
{
    static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
    if (!cachedTemplate.IsEmpty())
        return cachedTemplate;

    v8::HandleScope scope;
    v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(V8TestNamedConstructorConstructorCallback);

    v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
    instance->SetInternalFieldCount(V8TestNamedConstructor::internalFieldCount);
    result->SetClassName(v8::String::NewSymbol("TestNamedConstructor"));
    result->Inherit(V8TestNamedConstructor::GetTemplate(isolate, currentWorldType));

    cachedTemplate.Reset(isolate, result);
    return cachedTemplate;
}