码迷,mamicode.com
首页 > Web开发 > 详细

Webkit IDL的各种自定义接口

时间:2015-02-21 01:24:11      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:

[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)
    {
        ...;
    }

Webkit IDL的各种自定义接口

标签:

原文地址:http://blog.csdn.net/lichwei1983/article/details/43893089

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!