| 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 | #pragma once |
| 32 | |
| 33 | #if ENABLE(WEB_RTC) |
| 34 | |
| 35 | #include <JavaScriptCore/BuiltinUtils.h> |
| 36 | #include <JavaScriptCore/Identifier.h> |
| 37 | #include <JavaScriptCore/JSFunction.h> |
| 38 | #include <JavaScriptCore/UnlinkedFunctionExecutable.h> |
| 39 | |
| 40 | namespace JSC { |
| 41 | class FunctionExecutable; |
| 42 | } |
| 43 | |
| 44 | namespace WebCore { |
| 45 | |
| 46 | /* RTCPeerConnection */ |
| 47 | extern const char* const s_rtcPeerConnectionInitializeRTCPeerConnectionCode; |
| 48 | extern const int s_rtcPeerConnectionInitializeRTCPeerConnectionCodeLength; |
| 49 | extern const JSC::ConstructAbility s_rtcPeerConnectionInitializeRTCPeerConnectionCodeConstructAbility; |
| 50 | extern const char* const s_rtcPeerConnectionCreateOfferCode; |
| 51 | extern const int s_rtcPeerConnectionCreateOfferCodeLength; |
| 52 | extern const JSC::ConstructAbility s_rtcPeerConnectionCreateOfferCodeConstructAbility; |
| 53 | extern const char* const s_rtcPeerConnectionCreateAnswerCode; |
| 54 | extern const int s_rtcPeerConnectionCreateAnswerCodeLength; |
| 55 | extern const JSC::ConstructAbility s_rtcPeerConnectionCreateAnswerCodeConstructAbility; |
| 56 | extern const char* const s_rtcPeerConnectionSetLocalDescriptionCode; |
| 57 | extern const int s_rtcPeerConnectionSetLocalDescriptionCodeLength; |
| 58 | extern const JSC::ConstructAbility s_rtcPeerConnectionSetLocalDescriptionCodeConstructAbility; |
| 59 | extern const char* const s_rtcPeerConnectionSetRemoteDescriptionCode; |
| 60 | extern const int s_rtcPeerConnectionSetRemoteDescriptionCodeLength; |
| 61 | extern const JSC::ConstructAbility s_rtcPeerConnectionSetRemoteDescriptionCodeConstructAbility; |
| 62 | extern const char* const s_rtcPeerConnectionAddIceCandidateCode; |
| 63 | extern const int s_rtcPeerConnectionAddIceCandidateCodeLength; |
| 64 | extern const JSC::ConstructAbility s_rtcPeerConnectionAddIceCandidateCodeConstructAbility; |
| 65 | |
| 66 | #define WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_DATA(macro) \ |
| 67 | macro(initializeRTCPeerConnection, rtcPeerConnectionInitializeRTCPeerConnection, 1) \ |
| 68 | macro(createOffer, rtcPeerConnectionCreateOffer, 0) \ |
| 69 | macro(createAnswer, rtcPeerConnectionCreateAnswer, 0) \ |
| 70 | macro(setLocalDescription, rtcPeerConnectionSetLocalDescription, 1) \ |
| 71 | macro(setRemoteDescription, rtcPeerConnectionSetRemoteDescription, 1) \ |
| 72 | macro(addIceCandidate, rtcPeerConnectionAddIceCandidate, 1) \ |
| 73 | |
| 74 | #define WEBCORE_BUILTIN_RTCPEERCONNECTION_INITIALIZERTCPEERCONNECTION 1 |
| 75 | #define WEBCORE_BUILTIN_RTCPEERCONNECTION_CREATEOFFER 1 |
| 76 | #define WEBCORE_BUILTIN_RTCPEERCONNECTION_CREATEANSWER 1 |
| 77 | #define WEBCORE_BUILTIN_RTCPEERCONNECTION_SETLOCALDESCRIPTION 1 |
| 78 | #define WEBCORE_BUILTIN_RTCPEERCONNECTION_SETREMOTEDESCRIPTION 1 |
| 79 | #define WEBCORE_BUILTIN_RTCPEERCONNECTION_ADDICECANDIDATE 1 |
| 80 | |
| 81 | #define WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_CODE(macro) \ |
| 82 | macro(rtcPeerConnectionInitializeRTCPeerConnectionCode, initializeRTCPeerConnection, static_cast<const char*>(nullptr), s_rtcPeerConnectionInitializeRTCPeerConnectionCodeLength) \ |
| 83 | macro(rtcPeerConnectionCreateOfferCode, createOffer, static_cast<const char*>(nullptr), s_rtcPeerConnectionCreateOfferCodeLength) \ |
| 84 | macro(rtcPeerConnectionCreateAnswerCode, createAnswer, static_cast<const char*>(nullptr), s_rtcPeerConnectionCreateAnswerCodeLength) \ |
| 85 | macro(rtcPeerConnectionSetLocalDescriptionCode, setLocalDescription, static_cast<const char*>(nullptr), s_rtcPeerConnectionSetLocalDescriptionCodeLength) \ |
| 86 | macro(rtcPeerConnectionSetRemoteDescriptionCode, setRemoteDescription, static_cast<const char*>(nullptr), s_rtcPeerConnectionSetRemoteDescriptionCodeLength) \ |
| 87 | macro(rtcPeerConnectionAddIceCandidateCode, addIceCandidate, static_cast<const char*>(nullptr), s_rtcPeerConnectionAddIceCandidateCodeLength) \ |
| 88 | |
| 89 | #define WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_FUNCTION_NAME(macro) \ |
| 90 | macro(addIceCandidate) \ |
| 91 | macro(createAnswer) \ |
| 92 | macro(createOffer) \ |
| 93 | macro(initializeRTCPeerConnection) \ |
| 94 | macro(setLocalDescription) \ |
| 95 | macro(setRemoteDescription) \ |
| 96 | |
| 97 | #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ |
| 98 | JSC::FunctionExecutable* codeName##Generator(JSC::VM&); |
| 99 | |
| 100 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) |
| 101 | #undef DECLARE_BUILTIN_GENERATOR |
| 102 | |
| 103 | class RTCPeerConnectionBuiltinsWrapper : private JSC::WeakHandleOwner { |
| 104 | public: |
| 105 | explicit RTCPeerConnectionBuiltinsWrapper(JSC::VM* vm) |
| 106 | : m_vm(*vm) |
| 107 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) |
| 108 | #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { })) |
| 109 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) |
| 110 | #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS |
| 111 | { |
| 112 | } |
| 113 | |
| 114 | #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ |
| 115 | JSC::UnlinkedFunctionExecutable* name##Executable(); \ |
| 116 | const JSC::SourceCode& name##Source() const { return m_##name##Source; } |
| 117 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) |
| 118 | #undef EXPOSE_BUILTIN_EXECUTABLES |
| 119 | |
| 120 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) |
| 121 | |
| 122 | void exportNames(); |
| 123 | |
| 124 | private: |
| 125 | JSC::VM& m_vm; |
| 126 | |
| 127 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) |
| 128 | |
| 129 | #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ |
| 130 | JSC::SourceCode m_##name##Source;\ |
| 131 | JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; |
| 132 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) |
| 133 | #undef DECLARE_BUILTIN_SOURCE_MEMBERS |
| 134 | |
| 135 | }; |
| 136 | |
| 137 | #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ |
| 138 | inline JSC::UnlinkedFunctionExecutable* RTCPeerConnectionBuiltinsWrapper::name##Executable() \ |
| 139 | {\ |
| 140 | if (!m_##name##Executable) {\ |
| 141 | JSC::Identifier executableName = functionName##PublicName();\ |
| 142 | if (overriddenName)\ |
| 143 | executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\ |
| 144 | m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\ |
| 145 | }\ |
| 146 | return m_##name##Executable.get();\ |
| 147 | } |
| 148 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) |
| 149 | #undef DEFINE_BUILTIN_EXECUTABLES |
| 150 | |
| 151 | inline void RTCPeerConnectionBuiltinsWrapper::exportNames() |
| 152 | { |
| 153 | #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); |
| 154 | WEBCORE_FOREACH_RTCPEERCONNECTION_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) |
| 155 | #undef EXPORT_FUNCTION_NAME |
| 156 | } |
| 157 | |
| 158 | } // namespace WebCore |
| 159 | |
| 160 | #endif // ENABLE(WEB_RTC) |
| 161 | |