1 | /* |
2 | * Copyright (c) 2015 Canon Inc. |
3 | * Copyright (c) 2015 Igalia S.L. |
4 | * Copyright (c) 2016 Apple Inc. All rights reserved. |
5 | * |
6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions |
8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
14 | * |
15 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
25 | * THE POSSIBILITY OF SUCH DAMAGE. |
26 | * |
27 | */ |
28 | |
29 | // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for |
30 | // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py |
31 | |
32 | #pragma once |
33 | |
34 | #if ENABLE(STREAMS_API) |
35 | |
36 | #include <JavaScriptCore/BuiltinUtils.h> |
37 | #include <JavaScriptCore/Identifier.h> |
38 | #include <JavaScriptCore/JSFunction.h> |
39 | #include <JavaScriptCore/UnlinkedFunctionExecutable.h> |
40 | |
41 | namespace JSC { |
42 | class FunctionExecutable; |
43 | } |
44 | |
45 | namespace WebCore { |
46 | |
47 | /* ByteLengthQueuingStrategy */ |
48 | extern const char* const s_byteLengthQueuingStrategySizeCode; |
49 | extern const int s_byteLengthQueuingStrategySizeCodeLength; |
50 | extern const JSC::ConstructAbility s_byteLengthQueuingStrategySizeCodeConstructAbility; |
51 | extern const char* const s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCode; |
52 | extern const int s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeLength; |
53 | extern const JSC::ConstructAbility s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeConstructAbility; |
54 | |
55 | #define WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_DATA(macro) \ |
56 | macro(size, byteLengthQueuingStrategySize, 1) \ |
57 | macro(initializeByteLengthQueuingStrategy, byteLengthQueuingStrategyInitializeByteLengthQueuingStrategy, 1) \ |
58 | |
59 | #define WEBCORE_BUILTIN_BYTELENGTHQUEUINGSTRATEGY_SIZE 1 |
60 | #define WEBCORE_BUILTIN_BYTELENGTHQUEUINGSTRATEGY_INITIALIZEBYTELENGTHQUEUINGSTRATEGY 1 |
61 | |
62 | #define WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(macro) \ |
63 | macro(byteLengthQueuingStrategySizeCode, size, static_cast<const char*>(nullptr), s_byteLengthQueuingStrategySizeCodeLength) \ |
64 | macro(byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCode, initializeByteLengthQueuingStrategy, static_cast<const char*>(nullptr), s_byteLengthQueuingStrategyInitializeByteLengthQueuingStrategyCodeLength) \ |
65 | |
66 | #define WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(macro) \ |
67 | macro(initializeByteLengthQueuingStrategy) \ |
68 | macro(size) \ |
69 | |
70 | #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ |
71 | JSC::FunctionExecutable* codeName##Generator(JSC::VM&); |
72 | |
73 | WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) |
74 | #undef DECLARE_BUILTIN_GENERATOR |
75 | |
76 | class ByteLengthQueuingStrategyBuiltinsWrapper : private JSC::WeakHandleOwner { |
77 | public: |
78 | explicit ByteLengthQueuingStrategyBuiltinsWrapper(JSC::VM* vm) |
79 | : m_vm(*vm) |
80 | WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) |
81 | #define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length), { })) |
82 | WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) |
83 | #undef INITIALIZE_BUILTIN_SOURCE_MEMBERS |
84 | { |
85 | } |
86 | |
87 | #define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ |
88 | JSC::UnlinkedFunctionExecutable* name##Executable(); \ |
89 | const JSC::SourceCode& name##Source() const { return m_##name##Source; } |
90 | WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) |
91 | #undef EXPOSE_BUILTIN_EXECUTABLES |
92 | |
93 | WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) |
94 | |
95 | void exportNames(); |
96 | |
97 | private: |
98 | JSC::VM& m_vm; |
99 | |
100 | WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) |
101 | |
102 | #define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ |
103 | JSC::SourceCode m_##name##Source;\ |
104 | JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; |
105 | WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) |
106 | #undef DECLARE_BUILTIN_SOURCE_MEMBERS |
107 | |
108 | }; |
109 | |
110 | #define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ |
111 | inline JSC::UnlinkedFunctionExecutable* ByteLengthQueuingStrategyBuiltinsWrapper::name##Executable() \ |
112 | {\ |
113 | if (!m_##name##Executable) {\ |
114 | JSC::Identifier executableName = functionName##PublicName();\ |
115 | if (overriddenName)\ |
116 | executableName = JSC::Identifier::fromString(&m_vm, overriddenName);\ |
117 | m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ConstructAbility), this, &m_##name##Executable);\ |
118 | }\ |
119 | return m_##name##Executable.get();\ |
120 | } |
121 | WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) |
122 | #undef DEFINE_BUILTIN_EXECUTABLES |
123 | |
124 | inline void ByteLengthQueuingStrategyBuiltinsWrapper::exportNames() |
125 | { |
126 | #define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); |
127 | WEBCORE_FOREACH_BYTELENGTHQUEUINGSTRATEGY_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) |
128 | #undef EXPORT_FUNCTION_NAME |
129 | } |
130 | |
131 | } // namespace WebCore |
132 | |
133 | #endif // ENABLE(STREAMS_API) |
134 | |