| 1 | /* |
| 2 | * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/ |
| 27 | #include <wtf/Platform.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h`/ |
| 28 | #include "JSCallbackFunction.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h`/ |
| 29 | |
| 30 | #include "APIShims.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/API/APIShims.h`/ |
| 31 | #include "APICast.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h`/ |
| 32 | #include "CodeBlock.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.h`/ |
| 33 | #include "JSFunction.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.h`/ |
| 34 | #include "FunctionPrototype.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/FunctionPrototype.h`/ |
| 35 | #include <runtime/JSGlobalObject.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h`/ |
| 36 | #include <runtime/JSLock.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSLock.h`/ |
| 37 | #include <wtf/Vector.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h`/ |
| 38 | |
| 39 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 40 | |
| 41 | ASSERT_CLASS_FITS_IN_CELLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.h:42:9`!(JSCallbackFunction); |
| 42 | |
| 43 | const ClassInfocxx . . $ QTJSC/ClassInfo# JSCallbackFunctioncxx . . $ QTJSC/JSCallbackFunction#::infocxx . . $ QTJSC/JSCallbackFunction#info. = { "CallbackFunction", &InternalFunctioncxx . . $ QTJSC/InternalFunction#::infocxx . . $ QTJSC/InternalFunction#info., 0, 0 }; |
| 44 | |
| 45 | JSCallbackFunctioncxx . . $ QTJSC/JSCallbackFunction#::JSCallbackFunctioncxx . . $ QTJSC/JSCallbackFunction#JSCallbackFunction(ddcb345153d8e3e5).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectCallAsFunctionCallback callback, const Identifiercxx . . $ QTJSC/Identifier#& name) |
| 46 | : InternalFunctioncxx . . $ QTJSC/InternalFunction#(&exec->globalDatacxx . . $ QTJSC/ExecState#globalData(ae00a65ac2fd4a61).(), exec->lexicalGlobalObjectcxx . . $ QTJSC/ExecState#lexicalGlobalObject(3d50c730b5e26899).()->callbackFunctionStructurecxx . . $ QTJSC/JSGlobalObject#callbackFunctionStructure(a25848528202c7a).(), name) |
| 47 | , m_callbackcxx . . $ QTJSC/JSCallbackFunction#m_callback.(callback) |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | JSValuecxx . . $ QTJSC/JSValue# JSCallbackFunctioncxx . . $ QTJSC/JSCallbackFunction#::callcxx . . $ QTJSC/JSCallbackFunction#call(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#* functionObject, JSValuecxx . . $ QTJSC/JSValue# thisValue, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 52 | { |
| 53 | JSContextRefcxx . . $ JSContextRef# execRef = toRefcxx . . $ toRef(90ae1fbacdaa4c37).(exec); |
| 54 | JSObjectRefcxx . . $ JSObjectRef# functionRef = toRefcxx . . $ toRef(d2164949e0d73831).(functionObject); |
| 55 | JSObjectRefcxx . . $ JSObjectRef# thisObjRef = toRefcxx . . $ toRef(d2164949e0d73831).(thisValue.toThisObjectcxx . . $ QTJSC/JSValue#toThisObject(8709ed4849a165ab).(exec)); |
| 56 | |
| 57 | int argumentCount = static_cast<int>(args.sizecxx . . $ QTJSC/ArgList#size(fe4d2d262d4164a8).()); |
| 58 | Vectorcxx . . $ Vector#<JSValueRefcxx . . $ JSValueRef#, 16> arguments(argumentCount); |
| 59 | for (int i = 0; i < argumentCount; i++) |
| 60 | arguments[i] = toRefcxx . . $ toRef(df99c259cd5b7643).(exec, args.atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(i)); |
| 61 | |
| 62 | JSValueRefcxx . . $ JSValueRef# exception = 0; |
| 63 | JSValueRefcxx . . $ JSValueRef# result; |
| 64 | { |
| 65 | APICallbackShimcxx . . $ QTJSC/APICallbackShim# callbackShimcxx . . $ QTJSC/APICallbackShim#APICallbackShim(d2cb180e190a9680).(exec); |
| 66 | result = static_cast<JSCallbackFunction*>(functionObject)->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception); |
| 67 | } |
| 68 | if (exception) |
| 69 | exec->setExceptioncxx . . $ QTJSC/ExecState#setException(5c2ac18db087b3e6).(toJScxx . . $ toJS(c1f9d3957c3f3cd7).(exec, exception)); |
| 70 | |
| 71 | return toJScxx . . $ toJS(c1f9d3957c3f3cd7).(exec, result); |
| 72 | } |
| 73 | |
| 74 | CallTypecxx . . $ QTJSC/CallType# JSCallbackFunctioncxx . . $ QTJSC/JSCallbackFunction#::getCallDatacxx . . $ QTJSC/JSCallbackFunction#getCallData(9482040cf952d29d).(CallDatacxx . . $ QTJSC/CallData#& callData) |
| 75 | { |
| 76 | callData.nativecxx . . $ QTJSC/CallData#native..functioncxx . . $ QTJSC/CallData#$anonymous_type_0#function. =cxx . . $ QTJSC/NativeFuncWrapper#`operator=`(d9f3a0596fbce81c). callcxx . . $ QTJSC/JSCallbackFunction#call(cac2aec6ecb9506b).; |
| 77 | return CallTypeHostcxx . . $ QTJSC/CallTypeHost.; |
| 78 | } |
| 79 | |
| 80 | } // namespace JSC |