OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
6 | 6 |
7 #include "V8TestInterfaceConstructor.h" | 7 #include "V8TestInterfaceConstructor.h" |
8 | 8 |
9 #include "bindings/core/v8/Dictionary.h" | 9 #include "bindings/core/v8/Dictionary.h" |
10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 namespace TestInterfaceConstructorV8Internal { | 53 namespace TestInterfaceConstructorV8Internal { |
54 | 54 |
55 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) | 55 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) |
56 { | 56 { |
57 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); | 57 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); |
58 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 58 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
59 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | 59 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); |
60 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; | 60 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; |
61 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(scriptStat
e, executionContext, document, exceptionState); | 61 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(scriptStat
e, executionContext, document, exceptionState); |
62 if (exceptionState.hadException()) { | 62 if (exceptionState.hadException()) { |
63 exceptionState.throwIfNeeded(); | |
64 return; | 63 return; |
65 } | 64 } |
66 v8::Local<v8::Object> wrapper = info.Holder(); | 65 v8::Local<v8::Object> wrapper = info.Holder(); |
67 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructor::wrapperTypeInfo, wrapper); | 66 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructor::wrapperTypeInfo, wrapper); |
68 v8SetReturnValue(info, wrapper); | 67 v8SetReturnValue(info, wrapper); |
69 } | 68 } |
70 | 69 |
71 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) | 70 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) |
72 { | 71 { |
73 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); | 72 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); |
74 double doubleArg; | 73 double doubleArg; |
75 V8StringResource<> stringArg; | 74 V8StringResource<> stringArg; |
76 TestInterfaceEmpty* testInterfaceEmptyArg; | 75 TestInterfaceEmpty* testInterfaceEmptyArg; |
77 Dictionary dictionaryArg; | 76 Dictionary dictionaryArg; |
78 Vector<String> sequenceStringArg; | 77 Vector<String> sequenceStringArg; |
79 Vector<Dictionary> sequenceDictionaryArg; | 78 Vector<Dictionary> sequenceDictionaryArg; |
80 HeapVector<LongOrTestDictionary> sequenceLongOrTestDictionaryArg; | 79 HeapVector<LongOrTestDictionary> sequenceLongOrTestDictionaryArg; |
81 Dictionary optionalDictionaryArg; | 80 Dictionary optionalDictionaryArg; |
82 TestInterfaceEmpty* optionalTestInterfaceEmptyArg; | 81 TestInterfaceEmpty* optionalTestInterfaceEmptyArg; |
83 { | 82 { |
84 doubleArg = toRestrictedDouble(info.GetIsolate(), info[0], exceptionStat
e); | 83 doubleArg = toRestrictedDouble(info.GetIsolate(), info[0], exceptionStat
e); |
85 if (exceptionState.throwIfNeeded()) | 84 if (exceptionState.hadException()) |
86 return; | 85 return; |
87 stringArg = info[1]; | 86 stringArg = info[1]; |
88 if (!stringArg.prepare()) | 87 if (!stringArg.prepare()) |
89 return; | 88 return; |
90 testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.G
etIsolate(), info[2]); | 89 testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.G
etIsolate(), info[2]); |
91 if (!testInterfaceEmptyArg) { | 90 if (!testInterfaceEmptyArg) { |
92 exceptionState.throwTypeError("parameter 3 is not of type 'TestInter
faceEmpty'."); | 91 exceptionState.throwTypeError("parameter 3 is not of type 'TestInter
faceEmpty'."); |
93 exceptionState.throwIfNeeded(); | |
94 return; | 92 return; |
95 } | 93 } |
96 if (!isUndefinedOrNull(info[3]) && !info[3]->IsObject()) { | 94 if (!isUndefinedOrNull(info[3]) && !info[3]->IsObject()) { |
97 exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not
an object."); | 95 exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not
an object."); |
98 exceptionState.throwIfNeeded(); | |
99 return; | 96 return; |
100 } | 97 } |
101 dictionaryArg = Dictionary(info[3], info.GetIsolate(), exceptionState); | 98 dictionaryArg = Dictionary(info[3], info.GetIsolate(), exceptionState); |
102 if (exceptionState.throwIfNeeded()) | 99 if (exceptionState.hadException()) |
103 return; | 100 return; |
104 sequenceStringArg = toImplArray<Vector<String>>(info[4], 5, info.GetIsol
ate(), exceptionState); | 101 sequenceStringArg = toImplArray<Vector<String>>(info[4], 5, info.GetIsol
ate(), exceptionState); |
105 if (exceptionState.throwIfNeeded()) | 102 if (exceptionState.hadException()) |
106 return; | 103 return; |
107 sequenceDictionaryArg = toImplArray<Vector<Dictionary>>(info[5], 6, info
.GetIsolate(), exceptionState); | 104 sequenceDictionaryArg = toImplArray<Vector<Dictionary>>(info[5], 6, info
.GetIsolate(), exceptionState); |
108 if (exceptionState.throwIfNeeded()) | 105 if (exceptionState.hadException()) |
109 return; | 106 return; |
110 sequenceLongOrTestDictionaryArg = toImplArray<HeapVector<LongOrTestDicti
onary>>(info[6], 7, info.GetIsolate(), exceptionState); | 107 sequenceLongOrTestDictionaryArg = toImplArray<HeapVector<LongOrTestDicti
onary>>(info[6], 7, info.GetIsolate(), exceptionState); |
111 if (exceptionState.throwIfNeeded()) | 108 if (exceptionState.hadException()) |
112 return; | 109 return; |
113 if (!isUndefinedOrNull(info[7]) && !info[7]->IsObject()) { | 110 if (!isUndefinedOrNull(info[7]) && !info[7]->IsObject()) { |
114 exceptionState.throwTypeError("parameter 8 ('optionalDictionaryArg')
is not an object."); | 111 exceptionState.throwTypeError("parameter 8 ('optionalDictionaryArg')
is not an object."); |
115 exceptionState.throwIfNeeded(); | |
116 return; | 112 return; |
117 } | 113 } |
118 optionalDictionaryArg = Dictionary(info[7], info.GetIsolate(), exception
State); | 114 optionalDictionaryArg = Dictionary(info[7], info.GetIsolate(), exception
State); |
119 if (exceptionState.throwIfNeeded()) | 115 if (exceptionState.hadException()) |
120 return; | 116 return; |
121 optionalTestInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeChec
k(info.GetIsolate(), info[8]); | 117 optionalTestInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeChec
k(info.GetIsolate(), info[8]); |
122 if (!optionalTestInterfaceEmptyArg) { | 118 if (!optionalTestInterfaceEmptyArg) { |
123 exceptionState.throwTypeError("parameter 9 is not of type 'TestInter
faceEmpty'."); | 119 exceptionState.throwTypeError("parameter 9 is not of type 'TestInter
faceEmpty'."); |
124 exceptionState.throwIfNeeded(); | |
125 return; | 120 return; |
126 } | 121 } |
127 } | 122 } |
128 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 123 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
129 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | 124 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); |
130 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; | 125 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; |
131 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(scriptStat
e, executionContext, document, doubleArg, stringArg, testInterfaceEmptyArg, dict
ionaryArg, sequenceStringArg, sequenceDictionaryArg, sequenceLongOrTestDictionar
yArg, optionalDictionaryArg, optionalTestInterfaceEmptyArg, exceptionState); | 126 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(scriptStat
e, executionContext, document, doubleArg, stringArg, testInterfaceEmptyArg, dict
ionaryArg, sequenceStringArg, sequenceDictionaryArg, sequenceLongOrTestDictionar
yArg, optionalDictionaryArg, optionalTestInterfaceEmptyArg, exceptionState); |
132 if (exceptionState.hadException()) { | 127 if (exceptionState.hadException()) { |
133 exceptionState.throwIfNeeded(); | |
134 return; | 128 return; |
135 } | 129 } |
136 v8::Local<v8::Object> wrapper = info.Holder(); | 130 v8::Local<v8::Object> wrapper = info.Holder(); |
137 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructor::wrapperTypeInfo, wrapper); | 131 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructor::wrapperTypeInfo, wrapper); |
138 v8SetReturnValue(info, wrapper); | 132 v8SetReturnValue(info, wrapper); |
139 } | 133 } |
140 | 134 |
141 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info) | 135 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info) |
142 { | 136 { |
143 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); | 137 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); |
144 V8StringResource<> arg; | 138 V8StringResource<> arg; |
145 V8StringResource<> optArg; | 139 V8StringResource<> optArg; |
146 { | 140 { |
147 int numArgsPassed = info.Length(); | 141 int numArgsPassed = info.Length(); |
148 while (numArgsPassed > 0) { | 142 while (numArgsPassed > 0) { |
149 if (!info[numArgsPassed - 1]->IsUndefined()) | 143 if (!info[numArgsPassed - 1]->IsUndefined()) |
150 break; | 144 break; |
151 --numArgsPassed; | 145 --numArgsPassed; |
152 } | 146 } |
153 arg = info[0]; | 147 arg = info[0]; |
154 if (!arg.prepare()) | 148 if (!arg.prepare()) |
155 return; | 149 return; |
156 if (UNLIKELY(numArgsPassed <= 1)) { | 150 if (UNLIKELY(numArgsPassed <= 1)) { |
157 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 151 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
158 ExecutionContext* executionContext = currentExecutionContext(info.Ge
tIsolate()); | 152 ExecutionContext* executionContext = currentExecutionContext(info.Ge
tIsolate()); |
159 Document& document = *toDocument(currentExecutionContext(info.GetIso
late())); | 153 Document& document = *toDocument(currentExecutionContext(info.GetIso
late())); |
160 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(sc
riptState, executionContext, document, arg, exceptionState); | 154 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(sc
riptState, executionContext, document, arg, exceptionState); |
161 if (exceptionState.hadException()) { | 155 if (exceptionState.hadException()) { |
162 exceptionState.throwIfNeeded(); | |
163 return; | 156 return; |
164 } | 157 } |
165 v8::Local<v8::Object> wrapper = info.Holder(); | 158 v8::Local<v8::Object> wrapper = info.Holder(); |
166 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInter
faceConstructor::wrapperTypeInfo, wrapper); | 159 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInter
faceConstructor::wrapperTypeInfo, wrapper); |
167 v8SetReturnValue(info, wrapper); | 160 v8SetReturnValue(info, wrapper); |
168 return; | 161 return; |
169 } | 162 } |
170 optArg = info[1]; | 163 optArg = info[1]; |
171 if (!optArg.prepare()) | 164 if (!optArg.prepare()) |
172 return; | 165 return; |
173 } | 166 } |
174 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 167 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
175 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | 168 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); |
176 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; | 169 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; |
177 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(scriptStat
e, executionContext, document, arg, optArg, exceptionState); | 170 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(scriptStat
e, executionContext, document, arg, optArg, exceptionState); |
178 if (exceptionState.hadException()) { | 171 if (exceptionState.hadException()) { |
179 exceptionState.throwIfNeeded(); | |
180 return; | 172 return; |
181 } | 173 } |
182 v8::Local<v8::Object> wrapper = info.Holder(); | 174 v8::Local<v8::Object> wrapper = info.Holder(); |
183 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructor::wrapperTypeInfo, wrapper); | 175 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructor::wrapperTypeInfo, wrapper); |
184 v8SetReturnValue(info, wrapper); | 176 v8SetReturnValue(info, wrapper); |
185 } | 177 } |
186 | 178 |
187 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& info) | 179 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& info) |
188 { | 180 { |
189 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); | 181 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); |
190 V8StringResource<> arg; | 182 V8StringResource<> arg; |
191 V8StringResource<> arg2; | 183 V8StringResource<> arg2; |
192 V8StringResource<> arg3; | 184 V8StringResource<> arg3; |
193 { | 185 { |
194 arg = info[0]; | 186 arg = info[0]; |
195 if (!arg.prepare()) | 187 if (!arg.prepare()) |
196 return; | 188 return; |
197 arg2 = info[1]; | 189 arg2 = info[1]; |
198 if (!arg2.prepare()) | 190 if (!arg2.prepare()) |
199 return; | 191 return; |
200 arg3 = info[2]; | 192 arg3 = info[2]; |
201 if (!arg3.prepare()) | 193 if (!arg3.prepare()) |
202 return; | 194 return; |
203 } | 195 } |
204 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 196 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
205 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | 197 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); |
206 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; | 198 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; |
207 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(scriptStat
e, executionContext, document, arg, arg2, arg3, exceptionState); | 199 TestInterfaceConstructor* impl = TestInterfaceConstructor::create(scriptStat
e, executionContext, document, arg, arg2, arg3, exceptionState); |
208 if (exceptionState.hadException()) { | 200 if (exceptionState.hadException()) { |
209 exceptionState.throwIfNeeded(); | |
210 return; | 201 return; |
211 } | 202 } |
212 v8::Local<v8::Object> wrapper = info.Holder(); | 203 v8::Local<v8::Object> wrapper = info.Holder(); |
213 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructor::wrapperTypeInfo, wrapper); | 204 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructor::wrapperTypeInfo, wrapper); |
214 v8SetReturnValue(info, wrapper); | 205 v8SetReturnValue(info, wrapper); |
215 } | 206 } |
216 | 207 |
217 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 208 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
218 { | 209 { |
219 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); | 210 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 break; | 247 break; |
257 case 9: | 248 case 9: |
258 if (true) { | 249 if (true) { |
259 TestInterfaceConstructorV8Internal::constructor2(info); | 250 TestInterfaceConstructorV8Internal::constructor2(info); |
260 return; | 251 return; |
261 } | 252 } |
262 break; | 253 break; |
263 default: | 254 default: |
264 if (info.Length() >= 0) { | 255 if (info.Length() >= 0) { |
265 setArityTypeError(exceptionState, "[0, 1, 2, 3, 7, 8, 9]", info.Leng
th()); | 256 setArityTypeError(exceptionState, "[0, 1, 2, 3, 7, 8, 9]", info.Leng
th()); |
266 exceptionState.throwIfNeeded(); | |
267 return; | 257 return; |
268 } | 258 } |
269 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i
nfo.Length())); | 259 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i
nfo.Length())); |
270 exceptionState.throwIfNeeded(); | |
271 return; | 260 return; |
272 } | 261 } |
273 exceptionState.throwTypeError("No matching constructor signature."); | 262 exceptionState.throwTypeError("No matching constructor signature."); |
274 exceptionState.throwIfNeeded(); | |
275 } | 263 } |
276 | 264 |
277 } // namespace TestInterfaceConstructorV8Internal | 265 } // namespace TestInterfaceConstructorV8Internal |
278 | 266 |
279 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial | 267 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial |
280 // and does not depend on another global objects. | 268 // and does not depend on another global objects. |
281 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 269 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
282 #pragma clang diagnostic push | 270 #pragma clang diagnostic push |
283 #pragma clang diagnostic ignored "-Wglobal-constructors" | 271 #pragma clang diagnostic ignored "-Wglobal-constructors" |
284 #endif | 272 #endif |
285 const WrapperTypeInfo V8TestInterfaceConstructorConstructor::wrapperTypeInfo = {
gin::kEmbedderBlink, V8TestInterfaceConstructorConstructor::domTemplate, V8Test
InterfaceConstructor::trace, V8TestInterfaceConstructor::traceWrappers, 0, V8Tes
tInterfaceConstructor::preparePrototypeAndInterfaceObject, nullptr, "TestInterfa
ceConstructor", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo:
:ObjectClassId, WrapperTypeInfo::NotInheritFromActiveScriptWrappable, WrapperTyp
eInfo::NotInheritFromEventTarget, WrapperTypeInfo::Independent }; | 273 const WrapperTypeInfo V8TestInterfaceConstructorConstructor::wrapperTypeInfo = {
gin::kEmbedderBlink, V8TestInterfaceConstructorConstructor::domTemplate, V8Test
InterfaceConstructor::trace, V8TestInterfaceConstructor::traceWrappers, 0, V8Tes
tInterfaceConstructor::preparePrototypeAndInterfaceObject, nullptr, "TestInterfa
ceConstructor", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo:
:ObjectClassId, WrapperTypeInfo::NotInheritFromActiveScriptWrappable, WrapperTyp
eInfo::NotInheritFromEventTarget, WrapperTypeInfo::Independent }; |
286 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 274 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
287 #pragma clang diagnostic pop | 275 #pragma clang diagnostic pop |
288 #endif | 276 #endif |
289 | 277 |
290 static void V8TestInterfaceConstructorConstructorCallback(const v8::FunctionCall
backInfo<v8::Value>& info) | 278 static void V8TestInterfaceConstructorConstructorCallback(const v8::FunctionCall
backInfo<v8::Value>& info) |
291 { | 279 { |
292 if (!info.IsConstructCall()) { | 280 if (!info.IsConstructCall()) { |
293 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::c
onstructorNotCallableAsFunction("Audio")); | 281 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::c
onstructorNotCallableAsFunction("Audio")); |
294 return; | 282 return; |
295 } | 283 } |
296 | 284 |
297 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { | 285 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { |
298 v8SetReturnValue(info, info.Holder()); | 286 v8SetReturnValue(info, info.Holder()); |
299 return; | 287 return; |
300 } | 288 } |
301 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); | 289 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); |
302 if (UNLIKELY(info.Length() < 1)) { | 290 if (UNLIKELY(info.Length() < 1)) { |
303 setMinimumArityTypeError(exceptionState, 1, info.Length()); | 291 setMinimumArityTypeError(exceptionState, 1, info.Length()); |
304 exceptionState.throwIfNeeded(); | |
305 return; | 292 return; |
306 } | 293 } |
307 V8StringResource<> arg; | 294 V8StringResource<> arg; |
308 V8StringResource<> optArg; | 295 V8StringResource<> optArg; |
309 { | 296 { |
310 int numArgsPassed = info.Length(); | 297 int numArgsPassed = info.Length(); |
311 while (numArgsPassed > 0) { | 298 while (numArgsPassed > 0) { |
312 if (!info[numArgsPassed - 1]->IsUndefined()) | 299 if (!info[numArgsPassed - 1]->IsUndefined()) |
313 break; | 300 break; |
314 --numArgsPassed; | 301 --numArgsPassed; |
315 } | 302 } |
316 arg = info[0]; | 303 arg = info[0]; |
317 if (!arg.prepare()) | 304 if (!arg.prepare()) |
318 return; | 305 return; |
319 if (UNLIKELY(numArgsPassed <= 1)) { | 306 if (UNLIKELY(numArgsPassed <= 1)) { |
320 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 307 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
321 ExecutionContext* executionContext = currentExecutionContext(info.Ge
tIsolate()); | 308 ExecutionContext* executionContext = currentExecutionContext(info.Ge
tIsolate()); |
322 Document& document = *toDocument(currentExecutionContext(info.GetIso
late())); | 309 Document& document = *toDocument(currentExecutionContext(info.GetIso
late())); |
323 TestInterfaceConstructor* impl = TestInterfaceConstructor::createFor
JSConstructor(scriptState, executionContext, document, arg, exceptionState); | 310 TestInterfaceConstructor* impl = TestInterfaceConstructor::createFor
JSConstructor(scriptState, executionContext, document, arg, exceptionState); |
324 if (exceptionState.hadException()) { | 311 if (exceptionState.hadException()) { |
325 exceptionState.throwIfNeeded(); | |
326 return; | 312 return; |
327 } | 313 } |
328 v8::Local<v8::Object> wrapper = info.Holder(); | 314 v8::Local<v8::Object> wrapper = info.Holder(); |
329 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInter
faceConstructorConstructor::wrapperTypeInfo, wrapper); | 315 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInter
faceConstructorConstructor::wrapperTypeInfo, wrapper); |
330 v8SetReturnValue(info, wrapper); | 316 v8SetReturnValue(info, wrapper); |
331 return; | 317 return; |
332 } | 318 } |
333 optArg = info[1]; | 319 optArg = info[1]; |
334 if (!optArg.prepare()) | 320 if (!optArg.prepare()) |
335 return; | 321 return; |
336 } | 322 } |
337 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 323 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
338 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | 324 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); |
339 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; | 325 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; |
340 TestInterfaceConstructor* impl = TestInterfaceConstructor::createForJSConstr
uctor(scriptState, executionContext, document, arg, optArg, exceptionState); | 326 TestInterfaceConstructor* impl = TestInterfaceConstructor::createForJSConstr
uctor(scriptState, executionContext, document, arg, optArg, exceptionState); |
341 if (exceptionState.hadException()) { | 327 if (exceptionState.hadException()) { |
342 exceptionState.throwIfNeeded(); | |
343 return; | 328 return; |
344 } | 329 } |
345 v8::Local<v8::Object> wrapper = info.Holder(); | 330 v8::Local<v8::Object> wrapper = info.Holder(); |
346 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructorConstructor::wrapperTypeInfo, wrapper); | 331 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestInterfaceCons
tructorConstructor::wrapperTypeInfo, wrapper); |
347 v8SetReturnValue(info, wrapper); | 332 v8SetReturnValue(info, wrapper); |
348 } | 333 } |
349 | 334 |
350 v8::Local<v8::FunctionTemplate> V8TestInterfaceConstructorConstructor::domTempla
te(v8::Isolate* isolate, const DOMWrapperWorld& world) | 335 v8::Local<v8::FunctionTemplate> V8TestInterfaceConstructorConstructor::domTempla
te(v8::Isolate* isolate, const DOMWrapperWorld& world) |
351 { | 336 { |
352 static int domTemplateKey; // This address is used for a key to look up the
dom template. | 337 static int domTemplateKey; // This address is used for a key to look up the
dom template. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 { | 394 { |
410 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | 395 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); |
411 } | 396 } |
412 | 397 |
413 TestInterfaceConstructor* V8TestInterfaceConstructor::toImplWithTypeCheck(v8::Is
olate* isolate, v8::Local<v8::Value> value) | 398 TestInterfaceConstructor* V8TestInterfaceConstructor::toImplWithTypeCheck(v8::Is
olate* isolate, v8::Local<v8::Value> value) |
414 { | 399 { |
415 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : nullptr; | 400 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : nullptr; |
416 } | 401 } |
417 | 402 |
418 } // namespace blink | 403 } // namespace blink |
OLD | NEW |