| 1 | /* |
| 2 | * Copyright (c) 2015 Canon Inc. |
| 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 "ReadableStreamDefaultControllerBuiltins.h" |
| 33 | |
| 34 | #if ENABLE(STREAMS_API) |
| 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_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 48 | const int s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeLength = 376; |
| 49 | static const JSC::Intrinsic s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCodeIntrinsic = JSC::NoIntrinsic; |
| 50 | const char* const s_readableStreamDefaultControllerInitializeReadableStreamDefaultControllerCode = |
| 51 | "(function (stream, underlyingSource, size, highWaterMark)\n" \ |
| 52 | "{\n" \ |
| 53 | " \"use strict\";\n" \ |
| 54 | "\n" \ |
| 55 | " if (arguments.length !== 5 && arguments[4] !== @isReadableStream)\n" \ |
| 56 | " @throwTypeError(\"ReadableStreamDefaultController constructor should not be called directly\");\n" \ |
| 57 | "\n" \ |
| 58 | " return @privateInitializeReadableStreamDefaultController.@call(this, stream, underlyingSource, size, highWaterMark);\n" \ |
| 59 | "})\n" \ |
| 60 | ; |
| 61 | |
| 62 | const JSC::ConstructAbility s_readableStreamDefaultControllerEnqueueCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 63 | const int s_readableStreamDefaultControllerEnqueueCodeLength = 412; |
| 64 | static const JSC::Intrinsic s_readableStreamDefaultControllerEnqueueCodeIntrinsic = JSC::NoIntrinsic; |
| 65 | const char* const s_readableStreamDefaultControllerEnqueueCode = |
| 66 | "(function (chunk)\n" \ |
| 67 | "{\n" \ |
| 68 | " \"use strict\";\n" \ |
| 69 | "\n" \ |
| 70 | " if (!@isReadableStreamDefaultController(this))\n" \ |
| 71 | " throw @makeThisTypeError(\"ReadableStreamDefaultController\", \"enqueue\");\n" \ |
| 72 | "\n" \ |
| 73 | " if (!@readableStreamDefaultControllerCanCloseOrEnqueue(this))\n" \ |
| 74 | " @throwTypeError(\"ReadableStreamDefaultController is not in a state where chunk can be enqueued\");\n" \ |
| 75 | "\n" \ |
| 76 | " return @readableStreamDefaultControllerEnqueue(this, chunk);\n" \ |
| 77 | "})\n" \ |
| 78 | ; |
| 79 | |
| 80 | const JSC::ConstructAbility s_readableStreamDefaultControllerErrorCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 81 | const int s_readableStreamDefaultControllerErrorCodeLength = 228; |
| 82 | static const JSC::Intrinsic s_readableStreamDefaultControllerErrorCodeIntrinsic = JSC::NoIntrinsic; |
| 83 | const char* const s_readableStreamDefaultControllerErrorCode = |
| 84 | "(function (error)\n" \ |
| 85 | "{\n" \ |
| 86 | " \"use strict\";\n" \ |
| 87 | "\n" \ |
| 88 | " if (!@isReadableStreamDefaultController(this))\n" \ |
| 89 | " throw @makeThisTypeError(\"ReadableStreamDefaultController\", \"error\");\n" \ |
| 90 | "\n" \ |
| 91 | " @readableStreamDefaultControllerError(this, error);\n" \ |
| 92 | "})\n" \ |
| 93 | ; |
| 94 | |
| 95 | const JSC::ConstructAbility s_readableStreamDefaultControllerCloseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 96 | const int s_readableStreamDefaultControllerCloseCodeLength = 384; |
| 97 | static const JSC::Intrinsic s_readableStreamDefaultControllerCloseCodeIntrinsic = JSC::NoIntrinsic; |
| 98 | const char* const s_readableStreamDefaultControllerCloseCode = |
| 99 | "(function ()\n" \ |
| 100 | "{\n" \ |
| 101 | " \"use strict\";\n" \ |
| 102 | "\n" \ |
| 103 | " if (!@isReadableStreamDefaultController(this))\n" \ |
| 104 | " throw @makeThisTypeError(\"ReadableStreamDefaultController\", \"close\");\n" \ |
| 105 | "\n" \ |
| 106 | " if (!@readableStreamDefaultControllerCanCloseOrEnqueue(this))\n" \ |
| 107 | " @throwTypeError(\"ReadableStreamDefaultController is not in a state where it can be closed\");\n" \ |
| 108 | "\n" \ |
| 109 | " @readableStreamDefaultControllerClose(this);\n" \ |
| 110 | "})\n" \ |
| 111 | ; |
| 112 | |
| 113 | const JSC::ConstructAbility s_readableStreamDefaultControllerDesiredSizeCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |
| 114 | const int s_readableStreamDefaultControllerDesiredSizeCodeLength = 240; |
| 115 | static const JSC::Intrinsic s_readableStreamDefaultControllerDesiredSizeCodeIntrinsic = JSC::NoIntrinsic; |
| 116 | const char* const s_readableStreamDefaultControllerDesiredSizeCode = |
| 117 | "(function ()\n" \ |
| 118 | "{\n" \ |
| 119 | " \"use strict\";\n" \ |
| 120 | "\n" \ |
| 121 | " if (!@isReadableStreamDefaultController(this))\n" \ |
| 122 | " throw @makeGetterTypeError(\"ReadableStreamDefaultController\", \"desiredSize\");\n" \ |
| 123 | "\n" \ |
| 124 | " return @readableStreamDefaultControllerGetDesiredSize(this);\n" \ |
| 125 | "})\n" \ |
| 126 | ; |
| 127 | |
| 128 | |
| 129 | #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ |
| 130 | JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ |
| 131 | {\ |
| 132 | JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ |
| 133 | return clientData->builtinFunctions().readableStreamDefaultControllerBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().readableStreamDefaultControllerBuiltins().codeName##Source(), WTF::nullopt, s_##codeName##Intrinsic); \ |
| 134 | } |
| 135 | WEBCORE_FOREACH_READABLESTREAMDEFAULTCONTROLLER_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) |
| 136 | #undef DEFINE_BUILTIN_GENERATOR |
| 137 | |
| 138 | |
| 139 | } // namespace WebCore |
| 140 | |
| 141 | #endif // ENABLE(STREAMS_API) |
| 142 | |