| 1 | /* |
| 2 | * Copyright (c) 2015, 2016 Ericsson AB. All rights reserved. |
| 3 | * Copyright (c) 2016 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 16 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| 18 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 24 | * THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for |
| 29 | // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py |
| 30 | |
| 31 | #include "config.h" |
| 32 | #include "RTCPeerConnectionBuiltins.h" |
| 33 | |
| 34 | #if ENABLE(WEB_RTC) |
| 35 | |
| 36 | #include "WebCoreJSClientData.h" |
| 37 | #include <JavaScriptCore/HeapInlines.h> |
| 38 | #include <JavaScriptCore/IdentifierInlines.h> |
| 39 | #include <JavaScriptCore/Intrinsic.h> |
| 40 | #include <JavaScriptCore/JSCJSValueInlines.h> |
| 41 | #include <JavaScriptCore/JSCellInlines.h> |
| 42 | #include <JavaScriptCore/StructureInlines.h> |
| 43 | #include <JavaScriptCore/VM.h> |
| 44 | |
| 45 | namespace WebCore { |
| 46 | |
| 47 | const JSC::ConstructAbility s_rtcPeerConnectionInitializeRTCPeerConnectionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 48 | const int s_rtcPeerConnectionInitializeRTCPeerConnectionCodeLength = 342; |
| 49 | static const JSC::Intrinsic s_rtcPeerConnectionInitializeRTCPeerConnectionCodeIntrinsic = JSC::NoIntrinsic; |
| 50 | const char* const s_rtcPeerConnectionInitializeRTCPeerConnectionCode = |
| 51 | "(function (configuration)\n" \ |
| 52 | "{\n" \ |
| 53 | " \"use strict\";\n" \ |
| 54 | "\n" \ |
| 55 | " if (configuration == null)\n" \ |
| 56 | " configuration = {};\n" \ |
| 57 | " else if (!@isObject(configuration))\n" \ |
| 58 | " @throwTypeError(\"RTCPeerConnection argument must be a valid dictionary\");\n" \ |
| 59 | "\n" \ |
| 60 | " this.@initializeWith(configuration);\n" \ |
| 61 | " @putByIdDirectPrivate(this, \"operations\", []);\n" \ |
| 62 | "\n" \ |
| 63 | " return this;\n" \ |
| 64 | "})\n" \ |
| 65 | ; |
| 66 | |
| 67 | const JSC::ConstructAbility s_rtcPeerConnectionCreateOfferCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 68 | const int s_rtcPeerConnectionCreateOfferCodeLength = 308; |
| 69 | static const JSC::Intrinsic s_rtcPeerConnectionCreateOfferCodeIntrinsic = JSC::NoIntrinsic; |
| 70 | const char* const s_rtcPeerConnectionCreateOfferCode = |
| 71 | "(function ()\n" \ |
| 72 | "{\n" \ |
| 73 | " \"use strict\";\n" \ |
| 74 | "\n" \ |
| 75 | " if (!@isRTCPeerConnection(this))\n" \ |
| 76 | " return @Promise.@reject(@makeThisTypeError(\"RTCPeerConnection\", \"createOffer\"));\n" \ |
| 77 | "\n" \ |
| 78 | " const offerOptions = arguments[0];\n" \ |
| 79 | " return @enqueueOperation(this, () => {\n" \ |
| 80 | " return this.@queuedCreateOffer(offerOptions);\n" \ |
| 81 | " });\n" \ |
| 82 | "})\n" \ |
| 83 | ; |
| 84 | |
| 85 | const JSC::ConstructAbility s_rtcPeerConnectionCreateAnswerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 86 | const int s_rtcPeerConnectionCreateAnswerCodeLength = 312; |
| 87 | static const JSC::Intrinsic s_rtcPeerConnectionCreateAnswerCodeIntrinsic = JSC::NoIntrinsic; |
| 88 | const char* const s_rtcPeerConnectionCreateAnswerCode = |
| 89 | "(function ()\n" \ |
| 90 | "{\n" \ |
| 91 | " \"use strict\";\n" \ |
| 92 | "\n" \ |
| 93 | " if (!@isRTCPeerConnection(this))\n" \ |
| 94 | " return @Promise.@reject(@makeThisTypeError(\"RTCPeerConnection\", \"createAnswer\"));\n" \ |
| 95 | "\n" \ |
| 96 | " const answerOptions = arguments[0];\n" \ |
| 97 | " return @enqueueOperation(this, () => {\n" \ |
| 98 | " return this.@queuedCreateAnswer(answerOptions);\n" \ |
| 99 | " });\n" \ |
| 100 | "})\n" \ |
| 101 | ; |
| 102 | |
| 103 | const JSC::ConstructAbility s_rtcPeerConnectionSetLocalDescriptionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 104 | const int s_rtcPeerConnectionSetLocalDescriptionCodeLength = 711; |
| 105 | static const JSC::Intrinsic s_rtcPeerConnectionSetLocalDescriptionCodeIntrinsic = JSC::NoIntrinsic; |
| 106 | const char* const s_rtcPeerConnectionSetLocalDescriptionCode = |
| 107 | "(function (description)\n" \ |
| 108 | "{\n" \ |
| 109 | " \"use strict\";\n" \ |
| 110 | "\n" \ |
| 111 | " if (!@isRTCPeerConnection(this))\n" \ |
| 112 | " return @Promise.@reject(@makeThisTypeError(\"RTCPeerConnection\", \"setLocalDescription\"));\n" \ |
| 113 | "\n" \ |
| 114 | " if (arguments.length < 1)\n" \ |
| 115 | " return @Promise.@reject(@makeTypeError(\"Not enough arguments\"));\n" \ |
| 116 | "\n" \ |
| 117 | " //\n" \ |
| 118 | " const objectInfo = {\n" \ |
| 119 | " \"constructor\": @RTCSessionDescription,\n" \ |
| 120 | " \"argName\": \"description\",\n" \ |
| 121 | " \"argType\": \"RTCSessionDescription\",\n" \ |
| 122 | " \"maybeDictionary\": \"true\"\n" \ |
| 123 | " };\n" \ |
| 124 | " return @objectOverload(description, \"setLocalDescription\", objectInfo, (description) => {\n" \ |
| 125 | " return @enqueueOperation(this, () => {\n" \ |
| 126 | " return this.@queuedSetLocalDescription(description);\n" \ |
| 127 | " });\n" \ |
| 128 | " });\n" \ |
| 129 | "})\n" \ |
| 130 | ; |
| 131 | |
| 132 | const JSC::ConstructAbility s_rtcPeerConnectionSetRemoteDescriptionCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 133 | const int s_rtcPeerConnectionSetRemoteDescriptionCodeLength = 714; |
| 134 | static const JSC::Intrinsic s_rtcPeerConnectionSetRemoteDescriptionCodeIntrinsic = JSC::NoIntrinsic; |
| 135 | const char* const s_rtcPeerConnectionSetRemoteDescriptionCode = |
| 136 | "(function (description)\n" \ |
| 137 | "{\n" \ |
| 138 | " \"use strict\";\n" \ |
| 139 | "\n" \ |
| 140 | " if (!@isRTCPeerConnection(this))\n" \ |
| 141 | " return @Promise.@reject(@makeThisTypeError(\"RTCPeerConnection\", \"setRemoteDescription\"));\n" \ |
| 142 | "\n" \ |
| 143 | " if (arguments.length < 1)\n" \ |
| 144 | " return @Promise.@reject(@makeTypeError(\"Not enough arguments\"));\n" \ |
| 145 | "\n" \ |
| 146 | " //\n" \ |
| 147 | " const objectInfo = {\n" \ |
| 148 | " \"constructor\": @RTCSessionDescription,\n" \ |
| 149 | " \"argName\": \"description\",\n" \ |
| 150 | " \"argType\": \"RTCSessionDescription\",\n" \ |
| 151 | " \"maybeDictionary\": \"true\"\n" \ |
| 152 | " };\n" \ |
| 153 | " return @objectOverload(description, \"setRemoteDescription\", objectInfo, (description) => {\n" \ |
| 154 | " return @enqueueOperation(this, () => {\n" \ |
| 155 | " return this.@queuedSetRemoteDescription(description);\n" \ |
| 156 | " });\n" \ |
| 157 | " });\n" \ |
| 158 | "})\n" \ |
| 159 | ; |
| 160 | |
| 161 | const JSC::ConstructAbility s_rtcPeerConnectionAddIceCandidateCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 162 | const int s_rtcPeerConnectionAddIceCandidateCodeLength = 705; |
| 163 | static const JSC::Intrinsic s_rtcPeerConnectionAddIceCandidateCodeIntrinsic = JSC::NoIntrinsic; |
| 164 | const char* const s_rtcPeerConnectionAddIceCandidateCode = |
| 165 | "(function (candidate)\n" \ |
| 166 | "{\n" \ |
| 167 | " \"use strict\";\n" \ |
| 168 | "\n" \ |
| 169 | " if (!@isRTCPeerConnection(this))\n" \ |
| 170 | " return @Promise.@reject(@makeThisTypeError(\"RTCPeerConnection\", \"addIceCandidate\"));\n" \ |
| 171 | "\n" \ |
| 172 | " if (arguments.length < 1)\n" \ |
| 173 | " return @Promise.@reject(@makeTypeError(\"Not enough arguments\"));\n" \ |
| 174 | "\n" \ |
| 175 | " const objectInfo = {\n" \ |
| 176 | " \"constructor\": @RTCIceCandidate,\n" \ |
| 177 | " \"argName\": \"candidate\",\n" \ |
| 178 | " \"argType\": \"RTCIceCandidate\",\n" \ |
| 179 | " \"maybeDictionary\": \"true\",\n" \ |
| 180 | " \"defaultsToNull\" : \"true\"\n" \ |
| 181 | " };\n" \ |
| 182 | " return @objectOverload(candidate, \"addIceCandidate\", objectInfo, (candidate) => {\n" \ |
| 183 | " return @enqueueOperation(this, () => {\n" \ |
| 184 | " return this.@queuedAddIceCandidate(candidate);\n" \ |
| 185 | " });\n" \ |
| 186 | " });\n" \ |
| 187 | "})\n" \ |
| 188 | ; |
| 189 | |
| 190 | |
| 191 | #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ |
| 192 | JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ |
| 193 | {\ |
| 194 | JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ |
| 195 | return clientData->builtinFunctions().rtcPeerConnectionBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().rtcPeerConnectionBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ |
| 196 | } |
| 197 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) |
| 198 | #undef DEFINE_BUILTIN_GENERATOR |
| 199 | |
| 200 | |
| 201 | } // namespace WebCore |
| 202 | |
| 203 | #endif // ENABLE(WEB_RTC) |
| 204 | |