| /* |
| * Copyright (c) 2015, 2016 Ericsson AB. All rights reserved. |
| * Copyright (c) 2016 Apple Inc. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * 1. Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
| * |
| * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| * THE POSSIBILITY OF SUCH DAMAGE. |
| * |
| */ |
| |
| // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for |
| // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py |
| |
| #include "config.h" |
| #include "RTCPeerConnectionInternalsBuiltins.h" |
| |
| #if ENABLE(WEB_RTC) |
| |
| #include "WebCoreJSClientData.h" |
| #include <heap/HeapInlines.h> |
| #include <runtime/Executable.h> |
| #include <runtime/Intrinsic.h> |
| #include <runtime/JSCJSValueInlines.h> |
| #include <runtime/JSCellInlines.h> |
| #include <runtime/StructureInlines.h> |
| #include <runtime/VM.h> |
| |
| namespace WebCore { |
| |
| const JSC::ConstructAbility s_rtcPeerConnectionInternalsEnqueueOperationCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| const int s_rtcPeerConnectionInternalsEnqueueOperationCodeLength = 481; |
| static const JSC::Intrinsic s_rtcPeerConnectionInternalsEnqueueOperationCodeIntrinsic = JSC::NoIntrinsic; |
| const char* s_rtcPeerConnectionInternalsEnqueueOperationCode = |
| "(function (peerConnection, operation)\n" \ |
| "{\n" \ |
| " \"use strict\";\n" \ |
| " const operations = peerConnection.@operations;\n" \ |
| " function runNext() {\n" \ |
| " operations.@shift();\n" \ |
| " if (operations.length)\n" \ |
| " operations[0]();\n" \ |
| " };\n" \ |
| " return new @Promise(function (resolve, reject) {\n" \ |
| " operations.@push(function() {\n" \ |
| " operation().@then(resolve, reject).@then(runNext, runNext);\n" \ |
| " });\n" \ |
| " if (operations.length == 1)\n" \ |
| " operations[0]();\n" \ |
| " });\n" \ |
| "})\n" \ |
| ; |
| |
| const JSC::ConstructAbility s_rtcPeerConnectionInternalsObjectAndCallbacksOverloadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| const int s_rtcPeerConnectionInternalsObjectAndCallbacksOverloadCodeLength = 1498; |
| static const JSC::Intrinsic s_rtcPeerConnectionInternalsObjectAndCallbacksOverloadCodeIntrinsic = JSC::NoIntrinsic; |
| const char* s_rtcPeerConnectionInternalsObjectAndCallbacksOverloadCode = |
| "(function (args, functionName, objectInfo, promiseMode, legacyMode)\n" \ |
| "{\n" \ |
| " \"use strict\";\n" \ |
| " let argsCount = args.length;\n" \ |
| " let objectArg = args[0];\n" \ |
| " let objectArgOk = false;\n" \ |
| " if (!argsCount) {\n" \ |
| " if (!objectInfo.defaultsToNull)\n" \ |
| " return @Promise.@reject(new @TypeError(\"Not enough arguments\"));\n" \ |
| " objectArg = null;\n" \ |
| " objectArgOk = true;\n" \ |
| " argsCount = 1;\n" \ |
| " } else {\n" \ |
| " const hasMatchingType = objectArg instanceof objectInfo.constructor;\n" \ |
| " objectArgOk = objectInfo.defaultsToNull ? (objectArg === null || typeof objectArg === \"undefined\" || hasMatchingType) : hasMatchingType;\n" \ |
| " }\n" \ |
| " if (!objectArgOk)\n" \ |
| " return @Promise.@reject(new @TypeError(`Argument 1 ('${objectInfo.argName}') to RTCPeerConnection.${functionName} must be an instance of ${objectInfo.argType}`));\n" \ |
| " if (argsCount === 1)\n" \ |
| " return promiseMode(objectArg);\n" \ |
| " if (argsCount < 3)\n" \ |
| " return @Promise.@reject(new @TypeError(\"Not enough arguments\"));\n" \ |
| " const successCallback = args[1];\n" \ |
| " const errorCallback = args[2];\n" \ |
| " if (typeof successCallback !== \"function\")\n" \ |
| " return @Promise.@reject(new @TypeError(`Argument 2 ('successCallback') to RTCPeerConnection.${functionName} must be a function`));\n" \ |
| " if (typeof errorCallback !== \"function\")\n" \ |
| " return @Promise.@reject(new @TypeError(`Argument 3 ('errorCallback') to RTCPeerConnection.${functionName} must be a function`));\n" \ |
| " return legacyMode(objectArg, successCallback, errorCallback);\n" \ |
| "})\n" \ |
| ; |
| |
| const JSC::ConstructAbility s_rtcPeerConnectionInternalsCallbacksAndDictionaryOverloadCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| const int s_rtcPeerConnectionInternalsCallbacksAndDictionaryOverloadCodeLength = 1090; |
| static const JSC::Intrinsic s_rtcPeerConnectionInternalsCallbacksAndDictionaryOverloadCodeIntrinsic = JSC::NoIntrinsic; |
| const char* s_rtcPeerConnectionInternalsCallbacksAndDictionaryOverloadCode = |
| "(function (args, functionName, promiseMode, legacyMode)\n" \ |
| "{\n" \ |
| " \"use strict\";\n" \ |
| " if (args.length <= 1) {\n" \ |
| " const options = args[0];\n" \ |
| " if (args.length && !@isDictionary(options))\n" \ |
| " return @Promise.@reject(new @TypeError(`Argument 1 ('options') to RTCPeerConnection.${functionName} must be a Dictionary`));\n" \ |
| " return promiseMode(options);\n" \ |
| " }\n" \ |
| " const successCallback = args[0];\n" \ |
| " const errorCallback = args[1];\n" \ |
| " const options = args[2];\n" \ |
| " if (typeof successCallback !== \"function\")\n" \ |
| " return @Promise.@reject(new @TypeError(`Argument 1 ('successCallback') to RTCPeerConnection.${functionName} must be a function`));\n" \ |
| " if (typeof errorCallback !== \"function\")\n" \ |
| " return @Promise.@reject(new @TypeError(`Argument 2 ('errorCallback') to RTCPeerConnection.${functionName} must be a function`));\n" \ |
| " if (args.length > 2 && !@isDictionary(options))\n" \ |
| " return @Promise.@reject(new @TypeError(`Argument 3 ('options') to RTCPeerConnection.${functionName} must be a Dictionary`));\n" \ |
| " return legacyMode(successCallback, errorCallback, args[2]);\n" \ |
| "})\n" \ |
| ; |
| |
| const JSC::ConstructAbility s_rtcPeerConnectionInternalsIsRTCPeerConnectionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| const int s_rtcPeerConnectionInternalsIsRTCPeerConnectionCodeLength = 108; |
| static const JSC::Intrinsic s_rtcPeerConnectionInternalsIsRTCPeerConnectionCodeIntrinsic = JSC::NoIntrinsic; |
| const char* s_rtcPeerConnectionInternalsIsRTCPeerConnectionCode = |
| "(function (connection)\n" \ |
| "{\n" \ |
| " \"use strict\";\n" \ |
| " return @isObject(connection) && !!connection.@operations;\n" \ |
| "})\n" \ |
| ; |
| |
| |
| #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \ |
| JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ |
| {\ |
| JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ |
| return clientData->builtinFunctions().rtcPeerConnectionInternalsBuiltins().codeName##Executable()->link(vm, clientData->builtinFunctions().rtcPeerConnectionInternalsBuiltins().codeName##Source(), Nullopt, s_##codeName##Intrinsic); \ |
| } |
| WEBCORE_FOREACH_RTCPEERCONNECTIONINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) |
| #undef DEFINE_BUILTIN_GENERATOR |
| |
| |
| } // namespace WebCore |
| |
| #endif // ENABLE(WEB_RTC) |