コード例 #1
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SVGFEBlendElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "SVGFEBlendElement", V8SVGElement::GetTemplate(), V8SVGFEBlendElement::internalFieldCount,
        SVGFEBlendElementAttrs, WTF_ARRAY_LENGTH(SVGFEBlendElementAttrs),
        SVGFEBlendElementCallbacks, WTF_ARRAY_LENGTH(SVGFEBlendElementCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, SVGFEBlendElementConsts, WTF_ARRAY_LENGTH(SVGFEBlendElementConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #2
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestNodeTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::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(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
コード例 #3
0
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;
}
コード例 #4
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestEventConstructorTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

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

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #5
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;
}
コード例 #6
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
v8::Handle<v8::ObjectTemplate>
JSFeature::GetAttributesObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> attr_instance;

    if (attr_instance.IsEmpty())
    {
        attr_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        attr_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New("JSFeature_Attrs"));
        attr_instance->SetInternalFieldCount(1);
        attr_instance->SetNamedPropertyHandler(AttrPropertyCallback);
    }

    return attr_instance;
}
コード例 #7
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;
}
コード例 #8
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8WorkerLocationTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "WorkerLocation", v8::Persistent<v8::FunctionTemplate>(), V8WorkerLocation::internalFieldCount,
        WorkerLocationAttrs, WTF_ARRAY_LENGTH(WorkerLocationAttrs),
        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();
    
    proto->Set(v8::String::New("toString"), v8::FunctionTemplate::New(WorkerLocationInternal::toStringCallback, v8::Handle<v8::Value>(), defaultSignature), static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #9
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
v8::Handle<v8::ObjectTemplate>
JSFeature::GetObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> feat_instance;

    if (feat_instance.IsEmpty())
    {
        feat_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        feat_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New(GetObjectType().c_str()));
        feat_instance->SetInternalFieldCount(1);
        feat_instance->SetNamedPropertyHandler(PropertyCallback);
    }

    return feat_instance;
}
コード例 #10
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8WebKitCSSTransformValueTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "WebKitCSSTransformValue", V8CSSValueList::GetTemplate(), V8WebKitCSSTransformValue::internalFieldCount,
        WebKitCSSTransformValueAttrs, WTF_ARRAY_LENGTH(WebKitCSSTransformValueAttrs),
        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();
    
    setCollectionIndexedGetter<WebKitCSSTransformValue, CSSValue>(desc);
    batchConfigureConstants(desc, proto, WebKitCSSTransformValueConsts, WTF_ARRAY_LENGTH(WebKitCSSTransformValueConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #11
0
ファイル: JSWrappers.cpp プロジェクト: nedbrek/osgearth
v8::Handle<v8::ObjectTemplate>
JSSymbologyGeometry::GetObjectTemplate()
{
    v8::HandleScope handle_scope;

    static v8::Persistent<v8::ObjectTemplate> template_instance;

    if (template_instance.IsEmpty())
    {
        template_instance = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
        template_instance->Set(v8::String::New(V8_OBJECT_TYPE_PROPERTY), v8::String::New(GetObjectType().c_str()));
        template_instance->SetInternalFieldCount(1);
        template_instance->SetNamedPropertyHandler(PropertyCallback);
        template_instance->SetIndexedPropertyHandler(IndexedPropertyCallback);
    }

    return template_instance;
}
コード例 #12
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestMediaQueryListListenerTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestMediaQueryListListener", v8::Persistent<v8::FunctionTemplate>(), V8TestMediaQueryListListener::internalFieldCount,
        0, 0,
        V8TestMediaQueryListListenerMethods, WTF_ARRAY_LENGTH(V8TestMediaQueryListListenerMethods), isolate, currentWorldType);
    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();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
コード例 #13
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestMediaQueryListListenerTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = configureTemplate(desc, "TestMediaQueryListListener", v8::Persistent<v8::FunctionTemplate>(), V8TestMediaQueryListListener::internalFieldCount,
        0, 0,
        TestMediaQueryListListenerCallbacks, WTF_ARRAY_LENGTH(TestMediaQueryListListenerCallbacks));
    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();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #14
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TextEventTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "TextEvent",
      V8UIEvent::GetTemplate(), V8TextEvent::internalFieldCount,
      TextEvent_attrs, sizeof(TextEvent_attrs)/sizeof(*TextEvent_attrs),
      NULL, 0);
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  

  // Custom Signature 'initTextEvent'
  const int initTextEvent_argc = 5;
  v8::Handle<v8::FunctionTemplate> initTextEvent_argv[initTextEvent_argc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8DOMWindow::GetRawTemplate(), v8::Handle<v8::FunctionTemplate>() };
  v8::Handle<v8::Signature> initTextEvent_signature = v8::Signature::New(desc, initTextEvent_argc, initTextEvent_argv);
  proto->Set(v8::String::New("initTextEvent"), v8::FunctionTemplate::New(TextEventInternal::initTextEventCallback, v8::Handle<v8::Value>(), initTextEvent_signature));

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

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "InjectedScriptHost", v8::Persistent<v8::FunctionTemplate>(), V8InjectedScriptHost::internalFieldCount,
        0, 0,
        V8InjectedScriptHostCallbacks, WTF_ARRAY_LENGTH(V8InjectedScriptHostCallbacks));
    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();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.
    

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
コード例 #16
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8XMLHttpRequestUploadTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "XMLHttpRequestUpload",
      v8::Persistent<v8::FunctionTemplate>(), V8XMLHttpRequestUpload::internalFieldCount,
      XMLHttpRequestUpload_attrs, sizeof(XMLHttpRequestUpload_attrs)/sizeof(*XMLHttpRequestUpload_attrs),
      XMLHttpRequestUpload_callbacks, sizeof(XMLHttpRequestUpload_callbacks)/sizeof(*XMLHttpRequestUpload_callbacks));
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  

  // Custom Signature 'dispatchEvent'
  const int dispatchEvent_argc = 1;
  v8::Handle<v8::FunctionTemplate> dispatchEvent_argv[dispatchEvent_argc] = { V8Event::GetRawTemplate() };
  v8::Handle<v8::Signature> dispatchEvent_signature = v8::Signature::New(desc, dispatchEvent_argc, dispatchEvent_argv);
  proto->Set(v8::String::New("dispatchEvent"), v8::FunctionTemplate::New(XMLHttpRequestUploadInternal::dispatchEventCallback, v8::Handle<v8::Value>(), dispatchEvent_signature));

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

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "HTMLAnchorElement", V8HTMLElement::GetTemplate(), V8HTMLAnchorElement::internalFieldCount,
                       V8HTMLAnchorElementAttrs, WTF_ARRAY_LENGTH(V8HTMLAnchorElementAttrs),
                       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();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.

    proto->Set(v8::String::NewSymbol("toString"), v8::FunctionTemplate::New(HTMLAnchorElementV8Internal::toStringCallback, v8Undefined(), defaultSignature), static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum));

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
コード例 #18
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestSerializedScriptValueInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType worldType)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestSerializedScriptValueInterface", v8::Persistent<v8::FunctionTemplate>(), V8TestSerializedScriptValueInterface::internalFieldCount,
        V8TestSerializedScriptValueInterfaceAttrs, WTF_ARRAY_LENGTH(V8TestSerializedScriptValueInterfaceAttrs),
        V8TestSerializedScriptValueInterfaceMethods, WTF_ARRAY_LENGTH(V8TestSerializedScriptValueInterfaceMethods), isolate);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    desc->SetCallHandler(V8TestSerializedScriptValueInterface::constructorCallback);
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.
    

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

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "SVGPreserveAspectRatio", v8::Persistent<v8::FunctionTemplate>(), V8SVGPreserveAspectRatio::internalFieldCount,
        V8SVGPreserveAspectRatioAttrs, WTF_ARRAY_LENGTH(V8SVGPreserveAspectRatioAttrs),
        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();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.
    
    V8DOMConfiguration::batchConfigureConstants(desc, proto, V8SVGPreserveAspectRatioConsts, WTF_ARRAY_LENGTH(V8SVGPreserveAspectRatioConsts));

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
コード例 #20
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestSerializedScriptValueInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

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

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #21
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestCustomNamedGetterTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestCustomNamedGetter", v8::Persistent<v8::FunctionTemplate>(), V8TestCustomNamedGetter::internalFieldCount,
        0, 0,
        V8TestCustomNamedGetterCallbacks, WTF_ARRAY_LENGTH(V8TestCustomNamedGetterCallbacks), isolate);
    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();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.
    
    desc->InstanceTemplate()->SetNamedPropertyHandler(V8TestCustomNamedGetter::namedPropertyGetter, 0, 0, 0, 0);

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
コード例 #22
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SVGMarkerElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "SVGMarkerElement", V8SVGElement::GetTemplate(), V8SVGMarkerElement::internalFieldCount,
        SVGMarkerElementAttrs, WTF_ARRAY_LENGTH(SVGMarkerElementAttrs),
        SVGMarkerElementCallbacks, WTF_ARRAY_LENGTH(SVGMarkerElementCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    

    // Custom Signature 'setOrientToAngle'
    const int setOrientToAngleArgc = 1;
    v8::Handle<v8::FunctionTemplate> setOrientToAngleArgv[setOrientToAngleArgc] = { V8SVGAngle::GetRawTemplate() };
    v8::Handle<v8::Signature> setOrientToAngleSignature = v8::Signature::New(desc, setOrientToAngleArgc, setOrientToAngleArgv);
    proto->Set(v8::String::New("setOrientToAngle"), v8::FunctionTemplate::New(SVGMarkerElementInternal::setOrientToAngleCallback, v8::Handle<v8::Value>(), setOrientToAngleSignature));
    batchConfigureConstants(desc, proto, SVGMarkerElementConsts, WTF_ARRAY_LENGTH(SVGMarkerElementConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #23
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8MediaKeyErrorTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    if (!RuntimeEnabledFeatures::encryptedMediaEnabled())
        defaultSignature = V8DOMConfiguration::configureTemplate(desc, "", v8::Persistent<v8::FunctionTemplate>(), V8MediaKeyError::internalFieldCount, 0, 0, 0, 0);
    else
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "MediaKeyError", v8::Persistent<v8::FunctionTemplate>(), V8MediaKeyError::internalFieldCount,
        V8MediaKeyErrorAttrs, WTF_ARRAY_LENGTH(V8MediaKeyErrorAttrs),
        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();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.
    
    V8DOMConfiguration::batchConfigureConstants(desc, proto, V8MediaKeyErrorConsts, WTF_ARRAY_LENGTH(V8MediaKeyErrorConsts));

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
コード例 #24
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8LocationTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "Location",
      v8::Persistent<v8::FunctionTemplate>(), V8Location::internalFieldCount,
      Location_attrs, sizeof(Location_attrs)/sizeof(*Location_attrs),
      NULL, 0);
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  instance->SetAccessCheckCallbacks(V8Location::namedSecurityCheck, V8Location::indexedSecurityCheck, v8::Integer::New(V8ClassIndex::ToInt(V8ClassIndex::LOCATION)));
  instance->Set(v8::String::New("assign"), v8::FunctionTemplate::New(V8Location::assignCallback, v8::Handle<v8::Value>(), default_signature));
  instance->Set(v8::String::New("replace"), v8::FunctionTemplate::New(V8Location::replaceCallback, v8::Handle<v8::Value>(), default_signature));
  instance->Set(v8::String::New("reload"), v8::FunctionTemplate::New(V8Location::reloadCallback, v8::Handle<v8::Value>(), default_signature));
  instance->Set(v8::String::New("toString"), v8::FunctionTemplate::New(V8Location::toStringCallback, v8::Handle<v8::Value>(), default_signature), static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::DontEnum|v8::ReadOnly));
  instance->Set(v8::String::New("valueOf"), v8::FunctionTemplate::New(V8Location::valueOfCallback, v8::Handle<v8::Value>(), default_signature), static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::DontEnum|v8::ReadOnly));

  // For security reasons, these functions are on the instance instead
  // of on the prototype object to insure that they cannot be overwritten.
  instance->SetAccessor(v8::String::New("reload"), V8Location::reloadAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
  instance->SetAccessor(v8::String::New("replace"), V8Location::replaceAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
  instance->SetAccessor(v8::String::New("assign"), V8Location::assignAccessorGetter, 0, v8::Handle<v8::Value>(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));

  // Custom toString template
  desc->Set(getToStringName(), getToStringTemplate());
  return desc;
}