Webkit IDL的各種自訂介面,webkitidl自訂

來源:互聯網
上載者:User

Webkit IDL的各種自訂介面,webkitidl自訂
[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)    {        ...;    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.