Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceConstructor.cpp

Issue 557203002: Added core and modules to binding tests results for binding modularization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #include "config.h"
8 #include "V8TestInterfaceConstructor.h"
9
10 #include "bindings/core/v8/Dictionary.h"
11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/V8DOMConfiguration.h"
13 #include "bindings/core/v8/V8HiddenValue.h"
14 #include "bindings/core/v8/V8ObjectConstructor.h"
15 #include "bindings/tests/v8/V8TestInterfaceEmpty.h"
16 #include "core/dom/ContextFeatures.h"
17 #include "core/dom/Document.h"
18 #include "core/frame/LocalDOMWindow.h"
19 #include "core/frame/UseCounter.h"
20 #include "platform/RuntimeEnabledFeatures.h"
21 #include "platform/TraceEvent.h"
22 #include "wtf/GetPtr.h"
23 #include "wtf/RefPtr.h"
24
25 namespace blink {
26
27 const WrapperTypeInfo V8TestInterfaceConstructor::wrapperTypeInfo = { gin::kEmbe dderBlink, V8TestInterfaceConstructor::domTemplate, V8TestInterfaceConstructor:: refObject, V8TestInterfaceConstructor::derefObject, V8TestInterfaceConstructor:: createPersistentHandle, 0, 0, 0, V8TestInterfaceConstructor::installConditionall yEnabledMethods, V8TestInterfaceConstructor::installConditionallyEnabledProperti es, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClass Id, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
28
29 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac eConstructor.h.
30 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
31 // bindings/core/v8/ScriptWrappable.h.
32 const WrapperTypeInfo& TestInterfaceConstructor::s_wrapperTypeInfo = V8TestInter faceConstructor::wrapperTypeInfo;
33
34 namespace TestInterfaceConstructorV8Internal {
35
36 template <typename T> void V8_USE(T) { }
37
38 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
39 {
40 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate());
41 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
42 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ;
43 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(exe cutionContext, document, exceptionState);
44 if (exceptionState.hadException()) {
45 exceptionState.throwIfNeeded();
46 return;
47 }
48 v8::Handle<v8::Object> wrapper = info.Holder();
49 impl->associateWithWrapper(&V8TestInterfaceConstructor::wrapperTypeInfo, wra pper, info.GetIsolate());
50 v8SetReturnValue(info, wrapper);
51 }
52
53 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
54 {
55 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate());
56 double doubleArg;
57 V8StringResource<> stringArg;
58 TestInterfaceEmpty* testInterfaceEmptyArg;
59 Dictionary dictionaryArg;
60 Vector<String> sequenceStringArg;
61 Vector<Dictionary> sequenceDictionaryArg;
62 Dictionary optionalDictionaryArg;
63 TestInterfaceEmpty* optionalTestInterfaceEmptyArg;
64 {
65 v8::TryCatch block;
66 V8RethrowTryCatchScope rethrow(block);
67 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue()));
68 TOSTRING_VOID_INTERNAL(stringArg, info[1]);
69 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toIm plWithTypeCheck(info.GetIsolate(), info[2]));
70 TONATIVE_VOID_INTERNAL(dictionaryArg, Dictionary(info[3], info.GetIsolat e()));
71 if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) {
72 exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an object.");
73 exceptionState.throwIfNeeded();
74 return;
75 }
76 TONATIVE_VOID_INTERNAL(sequenceStringArg, toImplArray<String>(info[4], 5 , info.GetIsolate()));
77 TONATIVE_VOID_INTERNAL(sequenceDictionaryArg, toImplArray<Dictionary>(in fo[5], 6, info.GetIsolate()));
78 TONATIVE_VOID_INTERNAL(optionalDictionaryArg, Dictionary(info[6], info.G etIsolate()));
79 if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg .isObject()) {
80 exceptionState.throwTypeError("parameter 7 ('optionalDictionaryArg') is not an object.");
81 exceptionState.throwIfNeeded();
82 return;
83 }
84 TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmptyArg, V8TestInterfaceEmp ty::toImplWithTypeCheck(info.GetIsolate(), info[7]));
85 }
86 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
87 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ;
88 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(exe cutionContext, document, doubleArg, stringArg, testInterfaceEmptyArg, dictionary Arg, sequenceStringArg, sequenceDictionaryArg, optionalDictionaryArg, optionalTe stInterfaceEmptyArg, exceptionState);
89 if (exceptionState.hadException()) {
90 exceptionState.throwIfNeeded();
91 return;
92 }
93 v8::Handle<v8::Object> wrapper = info.Holder();
94 impl->associateWithWrapper(&V8TestInterfaceConstructor::wrapperTypeInfo, wra pper, info.GetIsolate());
95 v8SetReturnValue(info, wrapper);
96 }
97
98 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info)
99 {
100 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate());
101 V8StringResource<> arg;
102 V8StringResource<> optArg;
103 {
104 TOSTRING_VOID_INTERNAL(arg, info[0]);
105 if (UNLIKELY(info.Length() <= 1)) {
106 ExecutionContext* executionContext = currentExecutionContext(info.Ge tIsolate());
107 Document& document = *toDocument(currentExecutionContext(info.GetIso late()));
108 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::cr eate(executionContext, document, arg, exceptionState);
109 if (exceptionState.hadException()) {
110 exceptionState.throwIfNeeded();
111 return;
112 }
113 v8::Handle<v8::Object> wrapper = info.Holder();
114 impl->associateWithWrapper(&V8TestInterfaceConstructor::wrapperTypeI nfo, wrapper, info.GetIsolate());
115 v8SetReturnValue(info, wrapper);
116 return;
117 }
118 TOSTRING_VOID_INTERNAL(optArg, info[1]);
119 }
120 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
121 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ;
122 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(exe cutionContext, document, arg, optArg, exceptionState);
123 if (exceptionState.hadException()) {
124 exceptionState.throwIfNeeded();
125 return;
126 }
127 v8::Handle<v8::Object> wrapper = info.Holder();
128 impl->associateWithWrapper(&V8TestInterfaceConstructor::wrapperTypeInfo, wra pper, info.GetIsolate());
129 v8SetReturnValue(info, wrapper);
130 }
131
132 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& info)
133 {
134 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate());
135 V8StringResource<> arg;
136 V8StringResource<> arg2;
137 V8StringResource<> arg3;
138 {
139 TOSTRING_VOID_INTERNAL(arg, info[0]);
140 TOSTRING_VOID_INTERNAL(arg2, info[1]);
141 TOSTRING_VOID_INTERNAL(arg3, info[2]);
142 }
143 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
144 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ;
145 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(exe cutionContext, document, arg, arg2, arg3, exceptionState);
146 if (exceptionState.hadException()) {
147 exceptionState.throwIfNeeded();
148 return;
149 }
150 v8::Handle<v8::Object> wrapper = info.Holder();
151 impl->associateWithWrapper(&V8TestInterfaceConstructor::wrapperTypeInfo, wra pper, info.GetIsolate());
152 v8SetReturnValue(info, wrapper);
153 }
154
155 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
156 {
157 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate());
158 switch (std::min(8, info.Length())) {
159 case 0:
160 if (true) {
161 TestInterfaceConstructorV8Internal::constructor1(info);
162 return;
163 }
164 break;
165 case 1:
166 if (true) {
167 TestInterfaceConstructorV8Internal::constructor3(info);
168 return;
169 }
170 break;
171 case 2:
172 if (true) {
173 TestInterfaceConstructorV8Internal::constructor3(info);
174 return;
175 }
176 break;
177 case 3:
178 if (true) {
179 TestInterfaceConstructorV8Internal::constructor4(info);
180 return;
181 }
182 break;
183 case 6:
184 if (true) {
185 TestInterfaceConstructorV8Internal::constructor2(info);
186 return;
187 }
188 break;
189 case 7:
190 if (true) {
191 TestInterfaceConstructorV8Internal::constructor2(info);
192 return;
193 }
194 break;
195 case 8:
196 if (true) {
197 TestInterfaceConstructorV8Internal::constructor2(info);
198 return;
199 }
200 break;
201 default:
202 if (info.Length() >= 0) {
203 throwArityTypeError(exceptionState, "[0, 1, 2, 3, 6, 7, 8]", info.Le ngth());
204 return;
205 }
206 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length()));
207 exceptionState.throwIfNeeded();
208 return;
209 }
210 exceptionState.throwTypeError("No matching constructor signature.");
211 exceptionState.throwIfNeeded();
212 }
213
214 } // namespace TestInterfaceConstructorV8Internal
215
216 const WrapperTypeInfo V8TestInterfaceConstructorConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceConstructorConstructor::domTemplate, V8Test InterfaceConstructor::refObject, V8TestInterfaceConstructor::derefObject, V8Test InterfaceConstructor::createPersistentHandle, 0, 0, 0, V8TestInterfaceConstructo r::installConditionallyEnabledMethods, V8TestInterfaceConstructor::installCondit ionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, Wrappe rTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCoun tedObject };
217
218 static void V8TestInterfaceConstructorConstructorCallback(const v8::FunctionCall backInfo<v8::Value>& info)
219 {
220 if (!info.IsConstructCall()) {
221 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab leAsFunction("Audio"), info.GetIsolate());
222 return;
223 }
224
225 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis tingObject) {
226 v8SetReturnValue(info, info.Holder());
227 return;
228 }
229 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate());
230 if (UNLIKELY(info.Length() < 1)) {
231 setMinimumArityTypeError(exceptionState, 1, info.Length());
232 exceptionState.throwIfNeeded();
233 return;
234 }
235 V8StringResource<> arg;
236 V8StringResource<> optArg;
237 {
238 TOSTRING_VOID_INTERNAL(arg, info[0]);
239 if (UNLIKELY(info.Length() <= 1)) {
240 ExecutionContext* executionContext = currentExecutionContext(info.Ge tIsolate());
241 Document& document = *toDocument(currentExecutionContext(info.GetIso late()));
242 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::cr eateForJSConstructor(executionContext, document, arg, exceptionState);
243 if (exceptionState.hadException()) {
244 exceptionState.throwIfNeeded();
245 return;
246 }
247 v8::Handle<v8::Object> wrapper = info.Holder();
248 impl->associateWithWrapper(&V8TestInterfaceConstructorConstructor::w rapperTypeInfo, wrapper, info.GetIsolate());
249 v8SetReturnValue(info, wrapper);
250 return;
251 }
252 TOSTRING_VOID_INTERNAL(optArg, info[1]);
253 }
254 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
255 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ;
256 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::createForJ SConstructor(executionContext, document, arg, optArg, exceptionState);
257 if (exceptionState.hadException()) {
258 exceptionState.throwIfNeeded();
259 return;
260 }
261 v8::Handle<v8::Object> wrapper = info.Holder();
262 impl->associateWithWrapper(&V8TestInterfaceConstructorConstructor::wrapperTy peInfo, wrapper, info.GetIsolate());
263 v8SetReturnValue(info, wrapper);
264 }
265
266 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructorConstructor::domTempl ate(v8::Isolate* isolate)
267 {
268 static int domTemplateKey; // This address is used for a key to look up the dom template.
269 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
270 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey);
271 if (!result.IsEmpty())
272 return result;
273
274 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate");
275 result = v8::FunctionTemplate::New(isolate, V8TestInterfaceConstructorConstr uctorCallback);
276 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
277 instanceTemplate->SetInternalFieldCount(V8TestInterfaceConstructor::internal FieldCount);
278 result->SetClassName(v8AtomicString(isolate, "TestInterfaceConstructor"));
279 result->Inherit(V8TestInterfaceConstructor::domTemplate(isolate));
280 data->setDOMTemplate(&domTemplateKey, result);
281 return result;
282 }
283
284 void V8TestInterfaceConstructor::constructorCallback(const v8::FunctionCallbackI nfo<v8::Value>& info)
285 {
286 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor");
287 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::Te stFeature);
288 if (!info.IsConstructCall()) {
289 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab leAsFunction("TestInterfaceConstructor"), info.GetIsolate());
290 return;
291 }
292
293 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis tingObject) {
294 v8SetReturnValue(info, info.Holder());
295 return;
296 }
297
298 TestInterfaceConstructorV8Internal::constructor(info);
299 }
300
301 static void installV8TestInterfaceConstructorTemplate(v8::Handle<v8::FunctionTem plate> functionTemplate, v8::Isolate* isolate)
302 {
303 functionTemplate->ReadOnlyPrototype();
304
305 v8::Local<v8::Signature> defaultSignature;
306 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceConstructor", v8::Local<v8::FunctionTemplate>(), V8TestInterf aceConstructor::internalFieldCount,
307 0, 0,
308 0, 0,
309 0, 0,
310 isolate);
311 functionTemplate->SetCallHandler(V8TestInterfaceConstructor::constructorCall back);
312 functionTemplate->SetLength(0);
313 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate();
314 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate();
315
316 // Custom toString template
317 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate());
318 }
319
320 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor::domTemplate(v8::Iso late* isolate)
321 {
322 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), installV8TestInterfaceConstructorTemplate);
323 }
324
325 bool V8TestInterfaceConstructor::hasInstance(v8::Handle<v8::Value> v8Value, v8:: Isolate* isolate)
326 {
327 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
328 }
329
330 v8::Handle<v8::Object> V8TestInterfaceConstructor::findInstanceInPrototypeChain( v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
331 {
332 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
333 }
334
335 TestInterfaceConstructor* V8TestInterfaceConstructor::toImplWithTypeCheck(v8::Is olate* isolate, v8::Handle<v8::Value> value)
336 {
337 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<TestInterfaceConstructor>() : 0;
338 }
339
340
341 void V8TestInterfaceConstructor::refObject(ScriptWrappableBase* internalPointer)
342 {
343 internalPointer->toImpl<TestInterfaceConstructor>()->ref();
344 }
345
346 void V8TestInterfaceConstructor::derefObject(ScriptWrappableBase* internalPointe r)
347 {
348 internalPointer->toImpl<TestInterfaceConstructor>()->deref();
349 }
350
351 WrapperPersistentNode* V8TestInterfaceConstructor::createPersistentHandle(Script WrappableBase* internalPointer)
352 {
353 ASSERT_NOT_REACHED();
354 return 0;
355 }
356
357 template<>
358 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
359 {
360 return toV8(impl, creationContext, isolate);
361 }
362
363 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698