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

Side by Side Diff: Source/bindings/tests/results/V8TestInterface2.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 "V8TestInterface2.h"
9
10 #include "bindings/core/v8/ExceptionState.h"
11 #include "bindings/core/v8/V8DOMConfiguration.h"
12 #include "bindings/core/v8/V8GCController.h"
13 #include "bindings/core/v8/V8HiddenValue.h"
14 #include "bindings/core/v8/V8ObjectConstructor.h"
15 #include "bindings/tests/v8/V8TestInterface.h"
16 #include "bindings/tests/v8/V8TestInterfaceEmpty.h"
17 #include "core/dom/ContextFeatures.h"
18 #include "core/dom/Document.h"
19 #include "core/dom/Element.h"
20 #include "core/frame/LocalDOMWindow.h"
21 #include "platform/RuntimeEnabledFeatures.h"
22 #include "platform/TraceEvent.h"
23 #include "wtf/GetPtr.h"
24 #include "wtf/RefPtr.h"
25
26 namespace blink {
27
28 const WrapperTypeInfo V8TestInterface2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface2::domTemplate, V8TestInterface2::refObject, V8TestInterface2::d erefObject, V8TestInterface2::createPersistentHandle, 0, 0, V8TestInterface2::vi sitDOMWrapper, V8TestInterface2::installConditionallyEnabledMethods, V8TestInter face2::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObj ectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Dependent, Wrappe rTypeInfo::RefCountedObject };
29
30 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac e2.h.
31 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
32 // bindings/core/v8/ScriptWrappable.h.
33 const WrapperTypeInfo& TestInterface2::s_wrapperTypeInfo = V8TestInterface2::wra pperTypeInfo;
34
35 namespace TestInterface2V8Internal {
36
37 template <typename T> void V8_USE(T) { }
38
39 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
40 {
41 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes tInterface2", info.Holder(), info.GetIsolate());
42 if (UNLIKELY(info.Length() < 1)) {
43 setMinimumArityTypeError(exceptionState, 1, info.Length());
44 exceptionState.throwIfNeeded();
45 return;
46 }
47 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
48 unsigned index;
49 {
50 v8::TryCatch block;
51 V8RethrowTryCatchScope rethrow(block);
52 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception State), exceptionState);
53 }
54 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
55 if (exceptionState.hadException()) {
56 exceptionState.throwIfNeeded();
57 return;
58 }
59 v8SetReturnValue(info, result.release());
60 }
61
62 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
63 {
64 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
65 TestInterface2V8Internal::itemMethod(info);
66 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
67 }
68
69 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
70 {
71 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestInterface2", info.Holder(), info.GetIsolate());
72 if (UNLIKELY(info.Length() < 2)) {
73 setMinimumArityTypeError(exceptionState, 2, info.Length());
74 exceptionState.throwIfNeeded();
75 return;
76 }
77 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
78 unsigned index;
79 V8StringResource<> value;
80 {
81 v8::TryCatch block;
82 V8RethrowTryCatchScope rethrow(block);
83 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception State), exceptionState);
84 TOSTRING_VOID_INTERNAL(value, info[1]);
85 }
86 String result = impl->setItem(index, value, exceptionState);
87 if (exceptionState.hadException()) {
88 exceptionState.throwIfNeeded();
89 return;
90 }
91 v8SetReturnValueString(info, result, info.GetIsolate());
92 }
93
94 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o)
95 {
96 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
97 TestInterface2V8Internal::setItemMethod(info);
98 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
99 }
100
101 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
102 {
103 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestInterface2", info.Holder(), info.GetIsolate());
104 if (UNLIKELY(info.Length() < 1)) {
105 setMinimumArityTypeError(exceptionState, 1, info.Length());
106 exceptionState.throwIfNeeded();
107 return;
108 }
109 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
110 unsigned index;
111 {
112 v8::TryCatch block;
113 V8RethrowTryCatchScope rethrow(block);
114 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception State), exceptionState);
115 }
116 bool result = impl->deleteItem(index, exceptionState);
117 if (exceptionState.hadException()) {
118 exceptionState.throwIfNeeded();
119 return;
120 }
121 v8SetReturnValueBool(info, result);
122 }
123
124 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
125 {
126 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
127 TestInterface2V8Internal::deleteItemMethod(info);
128 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
129 }
130
131 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
132 {
133 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate());
134 if (UNLIKELY(info.Length() < 1)) {
135 setMinimumArityTypeError(exceptionState, 1, info.Length());
136 exceptionState.throwIfNeeded();
137 return;
138 }
139 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
140 V8StringResource<> name;
141 {
142 TOSTRING_VOID_INTERNAL(name, info[0]);
143 }
144 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState);
145 if (exceptionState.hadException()) {
146 exceptionState.throwIfNeeded();
147 return;
148 }
149 v8SetReturnValue(info, result.release());
150 }
151
152 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
153 {
154 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
155 TestInterface2V8Internal::namedItemMethod(info);
156 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
157 }
158
159 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
160 {
161 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestInterface2", info.Holder(), info.GetIsolate());
162 if (UNLIKELY(info.Length() < 2)) {
163 setMinimumArityTypeError(exceptionState, 2, info.Length());
164 exceptionState.throwIfNeeded();
165 return;
166 }
167 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
168 V8StringResource<> name;
169 V8StringResource<> value;
170 {
171 TOSTRING_VOID_INTERNAL(name, info[0]);
172 TOSTRING_VOID_INTERNAL(value, info[1]);
173 }
174 String result = impl->setNamedItem(name, value, exceptionState);
175 if (exceptionState.hadException()) {
176 exceptionState.throwIfNeeded();
177 return;
178 }
179 v8SetReturnValueString(info, result, info.GetIsolate());
180 }
181
182 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value> & info)
183 {
184 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
185 TestInterface2V8Internal::setNamedItemMethod(info);
186 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
187 }
188
189 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf o)
190 {
191 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestInterface2", info.Holder(), info.GetIsolate());
192 if (UNLIKELY(info.Length() < 1)) {
193 setMinimumArityTypeError(exceptionState, 1, info.Length());
194 exceptionState.throwIfNeeded();
195 return;
196 }
197 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
198 V8StringResource<> name;
199 {
200 TOSTRING_VOID_INTERNAL(name, info[0]);
201 }
202 bool result = impl->deleteNamedItem(name, exceptionState);
203 if (exceptionState.hadException()) {
204 exceptionState.throwIfNeeded();
205 return;
206 }
207 v8SetReturnValueBool(info, result);
208 }
209
210 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val ue>& info)
211 {
212 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
213 TestInterface2V8Internal::deleteNamedItemMethod(info);
214 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
215 }
216
217 static void stringifierMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
218 {
219 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
220 v8SetReturnValueString(info, impl->stringifierMethod(), info.GetIsolate());
221 }
222
223 static void stringifierMethodMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info)
224 {
225 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
226 TestInterface2V8Internal::stringifierMethodMethod(info);
227 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
228 }
229
230 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
231 {
232 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
233 v8SetReturnValueString(info, impl->stringifierMethod(), info.GetIsolate());
234 }
235
236 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo)
237 {
238 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
239 TestInterface2V8Internal::toStringMethod(info);
240 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
241 }
242
243 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
244 {
245 RefPtr<TestInterface2> impl = TestInterface2::create();
246 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIso late());
247 v8SetReturnValue(info, wrapper);
248 }
249
250 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
251 {
252 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
253 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestInt erface2", info.Holder(), info.GetIsolate());
254 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
255 if (exceptionState.throwIfNeeded())
256 return;
257 if (!result)
258 return;
259 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
260 }
261
262 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info)
263 {
264 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
265 TestInterface2V8Internal::indexedPropertyGetter(index, info);
266 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
267 }
268
269 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
270 {
271 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
272 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
273 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestInt erface2", info.Holder(), info.GetIsolate());
274 bool result = impl->setItem(index, propertyValue, exceptionState);
275 if (exceptionState.throwIfNeeded())
276 return;
277 if (!result)
278 return;
279 v8SetReturnValue(info, v8Value);
280 }
281
282 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
283 {
284 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
285 TestInterface2V8Internal::indexedPropertySetter(index, v8Value, info);
286 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
287 }
288
289 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info)
290 {
291 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
292 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestI nterface2", info.Holder(), info.GetIsolate());
293 DeleteResult result = impl->deleteItem(index, exceptionState);
294 if (exceptionState.throwIfNeeded())
295 return;
296 if (result != DeleteUnknownProperty)
297 return v8SetReturnValueBool(info, result == DeleteSuccess);
298 }
299
300 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
301 {
302 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
303 TestInterface2V8Internal::indexedPropertyDeleter(index, info);
304 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
305 }
306
307 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info)
308 {
309 if (info.Holder()->HasRealNamedProperty(name))
310 return;
311 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
312 return;
313
314 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
315 AtomicString propertyName = toCoreAtomicString(name);
316 v8::String::Utf8Value namedProperty(name);
317 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
318 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS tate);
319 if (exceptionState.throwIfNeeded())
320 return;
321 if (!result)
322 return;
323 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
324 }
325
326 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
327 {
328 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
329 TestInterface2V8Internal::namedPropertyGetter(name, info);
330 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
331 }
332
333 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
334 {
335 if (info.Holder()->HasRealNamedProperty(name))
336 return;
337 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
338 return;
339
340 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
341 TOSTRING_VOID(V8StringResource<>, propertyName, name);
342 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
343 v8::String::Utf8Value namedProperty(name);
344 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
345 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState );
346 if (exceptionState.throwIfNeeded())
347 return;
348 if (!result)
349 return;
350 v8SetReturnValue(info, v8Value);
351 }
352
353 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
354 {
355 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
356 TestInterface2V8Internal::namedPropertySetter(name, v8Value, info);
357 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
358 }
359
360 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
361 {
362 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
363 AtomicString propertyName = toCoreAtomicString(name);
364 v8::String::Utf8Value namedProperty(name);
365 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
366 bool result = impl->namedPropertyQuery(propertyName, exceptionState);
367 if (exceptionState.throwIfNeeded())
368 return;
369 if (!result)
370 return;
371 v8SetReturnValueInt(info, v8::None);
372 }
373
374 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
375 {
376 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
377 TestInterface2V8Internal::namedPropertyQuery(name, info);
378 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
379 }
380
381 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
382 {
383 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
384 AtomicString propertyName = toCoreAtomicString(name);
385 v8::String::Utf8Value namedProperty(name);
386 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert y, "TestInterface2", info.Holder(), info.GetIsolate());
387 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState);
388 if (exceptionState.throwIfNeeded())
389 return;
390 if (result != DeleteUnknownProperty)
391 return v8SetReturnValueBool(info, result == DeleteSuccess);
392 }
393
394 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
395 {
396 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
397 TestInterface2V8Internal::namedPropertyDeleter(name, info);
398 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
399 }
400
401 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
402 {
403 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
404 Vector<String> names;
405 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInter face2", info.Holder(), info.GetIsolate());
406 impl->namedPropertyEnumerator(names, exceptionState);
407 if (exceptionState.throwIfNeeded())
408 return;
409 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ());
410 for (size_t i = 0; i < names.size(); ++i)
411 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i]));
412 v8SetReturnValue(info, v8names);
413 }
414
415 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
416 {
417 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
418 TestInterface2V8Internal::namedPropertyEnumerator(info);
419 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
420 }
421
422 } // namespace TestInterface2V8Internal
423
424 void V8TestInterface2::visitDOMWrapper(ScriptWrappableBase* internalPointer, con st v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate)
425 {
426 TestInterface2* impl = internalPointer->toImpl<TestInterface2>();
427 // The ownerNode() method may return a reference or a pointer.
428 if (Node* owner = WTF::getPtr(impl->ownerNode())) {
429 Node* root = V8GCController::opaqueRootForGC(owner, isolate);
430 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r oot)), wrapper);
431 return;
432 }
433 setObjectGroup(internalPointer, wrapper, isolate);
434 }
435
436 static const V8DOMConfiguration::MethodConfiguration V8TestInterface2Methods[] = {
437 {"item", TestInterface2V8Internal::itemMethodCallback, 0, 1, V8DOMConfigurat ion::ExposedToAllScripts},
438 {"setItem", TestInterface2V8Internal::setItemMethodCallback, 0, 2, V8DOMConf iguration::ExposedToAllScripts},
439 {"deleteItem", TestInterface2V8Internal::deleteItemMethodCallback, 0, 1, V8D OMConfiguration::ExposedToAllScripts},
440 {"namedItem", TestInterface2V8Internal::namedItemMethodCallback, 0, 1, V8DOM Configuration::ExposedToAllScripts},
441 {"setNamedItem", TestInterface2V8Internal::setNamedItemMethodCallback, 0, 2, V8DOMConfiguration::ExposedToAllScripts},
442 {"deleteNamedItem", TestInterface2V8Internal::deleteNamedItemMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
443 {"stringifierMethod", TestInterface2V8Internal::stringifierMethodMethodCallb ack, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
444 {"toString", TestInterface2V8Internal::toStringMethodCallback, 0, 0, V8DOMCo nfiguration::ExposedToAllScripts},
445 };
446
447 void V8TestInterface2::constructorCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
448 {
449 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor");
450 if (!info.IsConstructCall()) {
451 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab leAsFunction("TestInterface2"), info.GetIsolate());
452 return;
453 }
454
455 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis tingObject) {
456 v8SetReturnValue(info, info.Holder());
457 return;
458 }
459
460 TestInterface2V8Internal::constructor(info);
461 }
462
463 static void installV8TestInterface2Template(v8::Handle<v8::FunctionTemplate> fun ctionTemplate, v8::Isolate* isolate)
464 {
465 functionTemplate->ReadOnlyPrototype();
466
467 v8::Local<v8::Signature> defaultSignature;
468 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterface2", v8::Local<v8::FunctionTemplate>(), V8TestInterface2::inte rnalFieldCount,
469 0, 0,
470 0, 0,
471 V8TestInterface2Methods, WTF_ARRAY_LENGTH(V8TestInterface2Methods),
472 isolate);
473 functionTemplate->SetCallHandler(V8TestInterface2::constructorCallback);
474 functionTemplate->SetLength(0);
475 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate();
476 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate();
477 if (RuntimeEnabledFeatures::featureNameEnabled()) {
478 static const V8DOMConfiguration::ConstantConfiguration constantConfigura tion = {"CONST_VALUE_1", 1, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort} ;
479 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate , &constantConfiguration, 1, isolate);
480 }
481 COMPILE_ASSERT(1 == TestInterface2::CONST_VALUE_1, TheValueOfTestInterface2_ CONST_VALUE_1DoesntMatchWithImplementation);
482 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterfac e2V8Internal::indexedPropertyGetterCallback, TestInterface2V8Internal::indexedPr opertySetterCallback, 0, TestInterface2V8Internal::indexedPropertyDeleterCallbac k, indexedPropertyEnumerator<TestInterface2>);
483 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface2 V8Internal::namedPropertyGetterCallback, TestInterface2V8Internal::namedProperty SetterCallback, TestInterface2V8Internal::namedPropertyQueryCallback, TestInterf ace2V8Internal::namedPropertyDeleterCallback, TestInterface2V8Internal::namedPro pertyEnumeratorCallback);
484
485 // Custom toString template
486 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate());
487 }
488
489 v8::Handle<v8::FunctionTemplate> V8TestInterface2::domTemplate(v8::Isolate* isol ate)
490 {
491 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), installV8TestInterface2Template);
492 }
493
494 bool V8TestInterface2::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* i solate)
495 {
496 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
497 }
498
499 v8::Handle<v8::Object> V8TestInterface2::findInstanceInPrototypeChain(v8::Handle <v8::Value> v8Value, v8::Isolate* isolate)
500 {
501 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
502 }
503
504 TestInterface2* V8TestInterface2::toImplWithTypeCheck(v8::Isolate* isolate, v8:: Handle<v8::Value> value)
505 {
506 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<TestInterface2>() : 0;
507 }
508
509
510 void V8TestInterface2::refObject(ScriptWrappableBase* internalPointer)
511 {
512 internalPointer->toImpl<TestInterface2>()->ref();
513 }
514
515 void V8TestInterface2::derefObject(ScriptWrappableBase* internalPointer)
516 {
517 internalPointer->toImpl<TestInterface2>()->deref();
518 }
519
520 WrapperPersistentNode* V8TestInterface2::createPersistentHandle(ScriptWrappableB ase* internalPointer)
521 {
522 ASSERT_NOT_REACHED();
523 return 0;
524 }
525
526 template<>
527 v8::Handle<v8::Value> toV8NoInline(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
528 {
529 return toV8(impl, creationContext, isolate);
530 }
531
532 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface2.h ('k') | Source/bindings/tests/results/V8TestInterface3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698