博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
WebKit之binding案例分析(testMediaQueryListListener.idl)
阅读量:4026 次
发布时间:2019-05-24

本文共 10182 字,大约阅读时间需要 33 分钟。

## testMediaQueryListListener.idl

module test {    interface TestMediaQueryListListener {        void method(in MediaQueryListListener listener);    };}
## JSTestMediaQueryListListener.h

#ifndef JSTestMediaQueryListListener_h#define JSTestMediaQueryListListener_h#include "JSDOMBinding.h"#include 
#include
#include
namespace WebCore {class TestMediaQueryListListener;class JSTestMediaQueryListListener : public DOMObjectWithGlobalPointer { typedef DOMObjectWithGlobalPointer Base;public: JSTestMediaQueryListListener(NonNullPassRefPtr
, JSDOMGlobalObject*, PassRefPtr
); static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; static PassRefPtr
createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); TestMediaQueryListListener* impl() const { return m_impl.get(); }private: RefPtr
m_impl;protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;};JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestMediaQueryListListener*);TestMediaQueryListListener* toTestMediaQueryListListener(JSC::JSValue);class JSTestMediaQueryListListenerPrototype : public JSC::JSObjectWithGlobalObject { typedef JSC::JSObjectWithGlobalObject Base;public: static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); static const JSC::ClassInfo s_info; virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static PassRefPtr
createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } JSTestMediaQueryListListenerPrototype(JSC::JSGlobalObject* globalObject, NonNullPassRefPtr
structure) : JSC::JSObjectWithGlobalObject(globalObject, structure) { }protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;};// FunctionsJSC::EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod(JSC::ExecState*);// AttributesJSC::JSValue jsTestMediaQueryListListenerConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);} // namespace WebCore#endif

## JSTestMediaQueryListListener.cpp

#include "config.h"#include "JSTestMediaQueryListListener.h"#include "ExceptionCode.h"#include "JSDOMBinding.h"#include "MediaQueryListListener.h"#include "TestMediaQueryListListener.h"#include 
#include
using namespace JSC;namespace WebCore {ASSERT_CLASS_FITS_IN_CELL(JSTestMediaQueryListListener);/* Hash table */#if ENABLE(JIT)#define THUNK_GENERATOR(generator) , generator#else#define THUNK_GENERATOR(generator)#endifstatic const HashTableValue JSTestMediaQueryListListenerTableValues[2] ={ { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast
(jsTestMediaQueryListListenerConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) }};#undef THUNK_GENERATORstatic JSC_CONST_HASHTABLE HashTable JSTestMediaQueryListListenerTable = { 2, 1, JSTestMediaQueryListListenerTableValues, 0 };/* Hash table for constructor */#if ENABLE(JIT)#define THUNK_GENERATOR(generator) , generator#else#define THUNK_GENERATOR(generator)#endifstatic const HashTableValue JSTestMediaQueryListListenerConstructorTableValues[1] ={ { 0, 0, 0, 0 THUNK_GENERATOR(0) }};#undef THUNK_GENERATORstatic JSC_CONST_HASHTABLE HashTable JSTestMediaQueryListListenerConstructorTable = { 1, 0, JSTestMediaQueryListListenerConstructorTableValues, 0 };class JSTestMediaQueryListListenerConstructor : public DOMConstructorObject {public: JSTestMediaQueryListListenerConstructor(JSC::ExecState*, JSDOMGlobalObject*); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; static PassRefPtr
createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); }protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;};const ClassInfo JSTestMediaQueryListListenerConstructor::s_info = { "TestMediaQueryListListenerConstructor", &DOMConstructorObject::s_info, &JSTestMediaQueryListListenerConstructorTable, 0 };JSTestMediaQueryListListenerConstructor::JSTestMediaQueryListListenerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) : DOMConstructorObject(JSTestMediaQueryListListenerConstructor::createStructure(globalObject->globalData(), globalObject->objectPrototype()), globalObject){ ASSERT(inherits(&s_info)); putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestMediaQueryListListenerPrototype::self(exec, globalObject), DontDelete | ReadOnly);}bool JSTestMediaQueryListListenerConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot){ return getStaticValueSlot
(exec, &JSTestMediaQueryListListenerConstructorTable, this, propertyName, slot);}bool JSTestMediaQueryListListenerConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor){ return getStaticValueDescriptor
(exec, &JSTestMediaQueryListListenerConstructorTable, this, propertyName, descriptor);}/* Hash table for prototype */#if ENABLE(JIT)#define THUNK_GENERATOR(generator) , generator#else#define THUNK_GENERATOR(generator)#endifstatic const HashTableValue JSTestMediaQueryListListenerPrototypeTableValues[2] ={ { "method", DontDelete | Function, (intptr_t)static_cast
(jsTestMediaQueryListListenerPrototypeFunctionMethod), (intptr_t)1 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) }};#undef THUNK_GENERATORstatic JSC_CONST_HASHTABLE HashTable JSTestMediaQueryListListenerPrototypeTable = { 2, 1, JSTestMediaQueryListListenerPrototypeTableValues, 0 };const ClassInfo JSTestMediaQueryListListenerPrototype::s_info = { "TestMediaQueryListListenerPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSTestMediaQueryListListenerPrototypeTable, 0 };JSObject* JSTestMediaQueryListListenerPrototype::self(ExecState* exec, JSGlobalObject* globalObject){ return getDOMPrototype
(exec, globalObject);}bool JSTestMediaQueryListListenerPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot){ return getStaticFunctionSlot
(exec, &JSTestMediaQueryListListenerPrototypeTable, this, propertyName, slot);}bool JSTestMediaQueryListListenerPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor){ return getStaticFunctionDescriptor
(exec, &JSTestMediaQueryListListenerPrototypeTable, this, propertyName, descriptor);}const ClassInfo JSTestMediaQueryListListener::s_info = { "TestMediaQueryListListener", &DOMObjectWithGlobalPointer::s_info, &JSTestMediaQueryListListenerTable, 0 };JSTestMediaQueryListListener::JSTestMediaQueryListListener(NonNullPassRefPtr
structure, JSDOMGlobalObject* globalObject, PassRefPtr
impl) : DOMObjectWithGlobalPointer(structure, globalObject) , m_impl(impl){ ASSERT(inherits(&s_info));}JSObject* JSTestMediaQueryListListener::createPrototype(ExecState* exec, JSGlobalObject* globalObject){ return new (exec) JSTestMediaQueryListListenerPrototype(globalObject, JSTestMediaQueryListListenerPrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype()));}bool JSTestMediaQueryListListener::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot){ return getStaticValueSlot
(exec, &JSTestMediaQueryListListenerTable, this, propertyName, slot);}bool JSTestMediaQueryListListener::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor){ return getStaticValueDescriptor
(exec, &JSTestMediaQueryListListenerTable, this, propertyName, descriptor);}JSValue jsTestMediaQueryListListenerConstructor(ExecState* exec, JSValue slotBase, const Identifier&){ JSTestMediaQueryListListener* domObject = static_cast
(asObject(slotBase)); return JSTestMediaQueryListListener::getConstructor(exec, domObject->globalObject());}JSValue JSTestMediaQueryListListener::getConstructor(ExecState* exec, JSGlobalObject* globalObject){ return getDOMConstructor
(exec, static_cast
(globalObject));}EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod(ExecState* exec){ JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestMediaQueryListListener::s_info)) return throwVMTypeError(exec); JSTestMediaQueryListListener* castedThis = static_cast
(asObject(thisValue)); TestMediaQueryListListener* imp = static_cast
(castedThis->impl()); RefPtr
listener(MediaQueryListListener::create(ScriptValue(exec->globalData(), exec->argument(0)))); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->method(listener); return JSValue::encode(jsUndefined());}JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestMediaQueryListListener* object){ return getDOMObjectWrapper
(exec, globalObject, object);}TestMediaQueryListListener* toTestMediaQueryListListener(JSC::JSValue value){ return value.inherits(&JSTestMediaQueryListListener::s_info) ? static_cast
(asObject(value))->impl() : 0;}}

转载地址:http://gdvbi.baihongyu.com/

你可能感兴趣的文章
IP校验和详解
查看>>
C++中使用Mongo执行count和distinct运算
查看>>
一些socket的编程经验
查看>>
socket编程中select的使用
查看>>
C++获取文件大小常用技巧分享
查看>>
未来5年大机遇:做贩卖多巴胺的超级玩家
查看>>
关于AIS编码解码的两个小问题
查看>>
GitHub 万星推荐:黑客成长技术清单
查看>>
可以在线C++编译的工具站点
查看>>
关于无人驾驶的过去、现在以及未来,看这篇文章就够了!
查看>>
所谓的进步和提升,就是完成认知升级
查看>>
昨夜今晨最大八卦终于坐实——人类首次直接探测到了引力波
查看>>
如何优雅、机智地和新公司谈薪水?
查看>>
为什么读了很多书,却学不到什么东西?
查看>>
长文干货:如何轻松应对工作中最棘手的13种场景?
查看>>
如何确保自己的Mac数据安全呢?这里有四个“小秘诀”
查看>>
如何用好碎片化时间,让思维更有效率?
查看>>
第一性原理:戳中问题本质的人是怎么思考的?
查看>>
No.147 - LeetCode1108
查看>>
No.148 - LeetCode771
查看>>