Webkit IDL的各种自定义接口

[JSCustomToNativeObject](i), [JSCustomFinalize](i), [CustomIsReachable](i), [JSCustomMarkFunction](i), [JSCustomNamedGetterOnPrototype](i),[JSCustomPushEventHandlerScope](i), [JSCustomDefineOwnProperty](i), [JSCustomDefineOwnPropertyOnPrototype](i),[JSCustomGetOwnPropertySlotAndDescriptor](i)

概述: 这些语法让你编写JavaScriptCore相关的绑定代码,本来这些绑定代码默认会被自动生成.

用法: 

    [
        JSCustomToNativeObject,
        JSCustomFinalize,
        CustomIsReachable,
        JSCustomMarkFunction,
        JSCustomNamedGetterOnPrototype,
        JSCustomPushEventHandlerScope,
        JSCustomDefineOwnProperty,
        JSCustomDefineOwnPropertyOnPrototype,
        JSCustomGetOwnPropertySlotAndDescriptor
    ] interface XXX {
    };

你可以在这个文件里编写如下系列函数: WebCore/bindings/js/JSXXXCustom.cpp. 更多例子,请参考文件WebCore/bindings/js/JSXXXCustom.cpp

  • [JSCustomToNativeObject]: 比如,你可以编写自己的toDOMWindow(...):
    PassRefPtr<DOMWindow> toDOMWindow(JSGlobalData& globalData, JSValue value)
    {
        ...;
    }
  • [JSCustomFinalize]: 定义自己的finalize函数:
    void JSXXXOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    {
        ...;
    }
  • [CustomIsReachable]:  定义自己的isReachableFromOpaqueRoots函数:
    bool JSXXXOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, SlotVisitor& visitor)
    {
        ...;
    }
  • [JSCustomMarkFunction]: 定义自己的 JSXXX::visitChildren(...)函数:
    void JSXXX::visitChildren(JSCell* cell, SlotVisitor& visitor)
    {
        ...;
    }
  • [JSCustomNamedGetterOnPrototype]: 定义自己的 JSXXXPrototype::putDelegate(...)函数:
    bool JSXXXPrototype::putDelegate(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
    {
        ...;
    }
  • [JSCustomPushEventHandlerScope]: 定义自己的 JSXXX::pushEventHandlerScope(...)函数:
    ScopeChainNode* JSXXX::pushEventHandlerScope(ExecState* exec, ScopeChainNode* node) const
    {
        ...;
    }
  • [JSCustomDefineOwnProperty]: 定义自己的 JSXXX::defineOwnProperty(...)函数:
    bool JSXXX::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException)
    {
        ...;
    }
  • [JSCustomDefineOwnPropertyOnPrototype]:定义自己的原型属性  JSXXXPrototype::defineOwnProperty(...):
    bool JSXXXPrototype::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException)
    {
        ...;
    }
  • [JSCustomGetOwnPropertySlotAndDescriptor]: 定义自己的 JSXXX::getOwnPropertySlotDelegate(...) 以及 JSXXX::getOwnPropertyDescriptorDelegate(...)函数:
    bool JSXXX::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    {
        ...;
    }

    bool JSXXX::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
    {
        ...;
    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值