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

Side by Side Diff: Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp

Issue 13937004: Move bindings-tests to bindings/tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 /*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21 #include "config.h"
22 #if ENABLE(Condition1) || ENABLE(Condition2)
23 #include "V8TestInterface.h"
24
25 #include "BindingState.h"
26 #include "ContextFeatures.h"
27 #include "ExceptionCode.h"
28 #include "Frame.h"
29 #include "RuntimeEnabledFeatures.h"
30 #include "TestSupplemental.h"
31 #include "V8Binding.h"
32 #include "V8DOMWrapper.h"
33 #include "V8Node.h"
34 #include "V8TestObj.h"
35 #include <wtf/GetPtr.h>
36 #include <wtf/RefCounted.h>
37 #include <wtf/RefPtr.h>
38 #include <wtf/UnusedParam.h>
39
40 #if ENABLE(BINDING_INTEGRITY)
41 #if defined(OS_WIN)
42 #pragma warning(disable: 4483)
43 extern "C" { extern void (*const __identifier("??_7TestInterface@WebCore@@6B@")[ ])(); }
44 #else
45 extern "C" { extern void* _ZTVN7WebCore13TestInterfaceE[]; }
46 #endif
47 #endif // ENABLE(BINDING_INTEGRITY)
48
49 namespace WebCore {
50
51 #if ENABLE(BINDING_INTEGRITY)
52 // This checks if a DOM object that is about to be wrapped is valid.
53 // Specifically, it checks that a vtable of the DOM object is equal to
54 // a vtable of an expected class.
55 // Due to a dangling pointer, the DOM object you are wrapping might be
56 // already freed or realloced. If freed, the check will fail because
57 // a free list pointer should be stored at the head of the DOM object.
58 // If realloced, the check will fail because the vtable of the DOM object
59 // differs from the expected vtable (unless the same class of DOM object
60 // is realloced on the slot).
61 inline void checkTypeOrDieTrying(TestInterface* object)
62 {
63 void* actualVTablePointer = *(reinterpret_cast<void**>(object));
64 #if defined(OS_WIN)
65 void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7Test Interface@WebCore@@6B@"));
66 #else
67 void* expectedVTablePointer = &_ZTVN7WebCore13TestInterfaceE[2];
68 #endif
69 if (actualVTablePointer != expectedVTablePointer)
70 CRASH();
71 }
72 #endif // ENABLE(BINDING_INTEGRITY)
73
74 WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestIn terface::derefObject, V8TestInterface::toActiveDOMObject, 0, 0, V8TestInterface: :installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
75
76 namespace TestInterfaceV8Internal {
77
78 template <typename T> void V8_USE(T) { }
79
80 #if ENABLE(Condition11) || ENABLE(Condition12)
81
82 static v8::Handle<v8::Value> supplementalStaticReadOnlyAttrAttrGetter(v8::Local< v8::String> name, const v8::AccessorInfo& info)
83 {
84 return v8Integer(TestSupplemental::supplementalStaticReadOnlyAttr(), info.Ge tIsolate());
85 }
86
87 #endif // ENABLE(Condition11) || ENABLE(Condition12)
88
89 #if ENABLE(Condition11) || ENABLE(Condition12)
90
91 static v8::Handle<v8::Value> supplementalStaticReadOnlyAttrAttrGetterCallback(v8 ::Local<v8::String> name, const v8::AccessorInfo& info)
92 {
93 return TestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttrGetter(nam e, info);
94 }
95
96 #endif // ENABLE(Condition11) || ENABLE(Condition12)
97
98 #if ENABLE(Condition11) || ENABLE(Condition12)
99
100 static v8::Handle<v8::Value> supplementalStaticAttrAttrGetter(v8::Local<v8::Stri ng> name, const v8::AccessorInfo& info)
101 {
102 return v8String(TestSupplemental::supplementalStaticAttr(), info.GetIsolate( ), ReturnUnsafeHandle);
103 }
104
105 #endif // ENABLE(Condition11) || ENABLE(Condition12)
106
107 #if ENABLE(Condition11) || ENABLE(Condition12)
108
109 static v8::Handle<v8::Value> supplementalStaticAttrAttrGetterCallback(v8::Local< v8::String> name, const v8::AccessorInfo& info)
110 {
111 return TestInterfaceV8Internal::supplementalStaticAttrAttrGetter(name, info) ;
112 }
113
114 #endif // ENABLE(Condition11) || ENABLE(Condition12)
115
116 #if ENABLE(Condition11) || ENABLE(Condition12)
117
118 static void supplementalStaticAttrAttrSetter(v8::Local<v8::String> name, v8::Loc al<v8::Value> value, const v8::AccessorInfo& info)
119 {
120 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
121 TestSupplemental::setSupplementalStaticAttr(v);
122 return;
123 }
124
125 #endif // ENABLE(Condition11) || ENABLE(Condition12)
126
127 #if ENABLE(Condition11) || ENABLE(Condition12)
128
129 static void supplementalStaticAttrAttrSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
130 {
131 TestInterfaceV8Internal::supplementalStaticAttrAttrSetter(name, value, info) ;
132 }
133
134 #endif // ENABLE(Condition11) || ENABLE(Condition12)
135
136 #if ENABLE(Condition11) || ENABLE(Condition12)
137
138 static v8::Handle<v8::Value> supplementalStr1AttrGetter(v8::Local<v8::String> na me, const v8::AccessorInfo& info)
139 {
140 TestInterface* imp = V8TestInterface::toNative(info.Holder());
141 return v8String(TestSupplemental::supplementalStr1(imp), info.GetIsolate(), ReturnUnsafeHandle);
142 }
143
144 #endif // ENABLE(Condition11) || ENABLE(Condition12)
145
146 #if ENABLE(Condition11) || ENABLE(Condition12)
147
148 static v8::Handle<v8::Value> supplementalStr1AttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info)
149 {
150 return TestInterfaceV8Internal::supplementalStr1AttrGetter(name, info);
151 }
152
153 #endif // ENABLE(Condition11) || ENABLE(Condition12)
154
155 #if ENABLE(Condition11) || ENABLE(Condition12)
156
157 static v8::Handle<v8::Value> supplementalStr2AttrGetter(v8::Local<v8::String> na me, const v8::AccessorInfo& info)
158 {
159 TestInterface* imp = V8TestInterface::toNative(info.Holder());
160 return v8String(TestSupplemental::supplementalStr2(imp), info.GetIsolate(), ReturnUnsafeHandle);
161 }
162
163 #endif // ENABLE(Condition11) || ENABLE(Condition12)
164
165 #if ENABLE(Condition11) || ENABLE(Condition12)
166
167 static v8::Handle<v8::Value> supplementalStr2AttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info)
168 {
169 return TestInterfaceV8Internal::supplementalStr2AttrGetter(name, info);
170 }
171
172 #endif // ENABLE(Condition11) || ENABLE(Condition12)
173
174 #if ENABLE(Condition11) || ENABLE(Condition12)
175
176 static void supplementalStr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8: :Value> value, const v8::AccessorInfo& info)
177 {
178 TestInterface* imp = V8TestInterface::toNative(info.Holder());
179 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
180 TestSupplemental::setSupplementalStr2(imp, v);
181 return;
182 }
183
184 #endif // ENABLE(Condition11) || ENABLE(Condition12)
185
186 #if ENABLE(Condition11) || ENABLE(Condition12)
187
188 static void supplementalStr2AttrSetterCallback(v8::Local<v8::String> name, v8::L ocal<v8::Value> value, const v8::AccessorInfo& info)
189 {
190 TestInterfaceV8Internal::supplementalStr2AttrSetter(name, value, info);
191 }
192
193 #endif // ENABLE(Condition11) || ENABLE(Condition12)
194
195 #if ENABLE(Condition11) || ENABLE(Condition12)
196
197 static v8::Handle<v8::Value> supplementalStr3AttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info)
198 {
199 return V8TestInterface::supplementalStr3AttrGetterCustom(name, info);
200 }
201
202 #endif // ENABLE(Condition11) || ENABLE(Condition12)
203
204 #if ENABLE(Condition11) || ENABLE(Condition12)
205
206 static void supplementalStr3AttrSetterCallback(v8::Local<v8::String> name, v8::L ocal<v8::Value> value, const v8::AccessorInfo& info)
207 {
208 V8TestInterface::supplementalStr3AttrSetterCustom(name, value, info);
209 }
210
211 #endif // ENABLE(Condition11) || ENABLE(Condition12)
212
213 #if ENABLE(Condition11) || ENABLE(Condition12)
214
215 static v8::Handle<v8::Value> supplementalNodeAttrGetter(v8::Local<v8::String> na me, const v8::AccessorInfo& info)
216 {
217 TestInterface* imp = V8TestInterface::toNative(info.Holder());
218 return toV8Fast(TestSupplemental::supplementalNode(imp), info, imp);
219 }
220
221 #endif // ENABLE(Condition11) || ENABLE(Condition12)
222
223 #if ENABLE(Condition11) || ENABLE(Condition12)
224
225 static v8::Handle<v8::Value> supplementalNodeAttrGetterCallback(v8::Local<v8::St ring> name, const v8::AccessorInfo& info)
226 {
227 return TestInterfaceV8Internal::supplementalNodeAttrGetter(name, info);
228 }
229
230 #endif // ENABLE(Condition11) || ENABLE(Condition12)
231
232 #if ENABLE(Condition11) || ENABLE(Condition12)
233
234 static void supplementalNodeAttrSetter(v8::Local<v8::String> name, v8::Local<v8: :Value> value, const v8::AccessorInfo& info)
235 {
236 TestInterface* imp = V8TestInterface::toNative(info.Holder());
237 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
238 TestSupplemental::setSupplementalNode(imp, WTF::getPtr(v));
239 return;
240 }
241
242 #endif // ENABLE(Condition11) || ENABLE(Condition12)
243
244 #if ENABLE(Condition11) || ENABLE(Condition12)
245
246 static void supplementalNodeAttrSetterCallback(v8::Local<v8::String> name, v8::L ocal<v8::Value> value, const v8::AccessorInfo& info)
247 {
248 TestInterfaceV8Internal::supplementalNodeAttrSetter(name, value, info);
249 }
250
251 #endif // ENABLE(Condition11) || ENABLE(Condition12)
252
253 #if ENABLE(Condition11) || ENABLE(Condition12)
254
255 static v8::Handle<v8::Value> supplementalMethod1Method(const v8::Arguments& args )
256 {
257 TestInterface* imp = V8TestInterface::toNative(args.Holder());
258 TestSupplemental::supplementalMethod1(imp);
259 return v8Undefined();
260 }
261
262 #endif // ENABLE(Condition11) || ENABLE(Condition12)
263
264 #if ENABLE(Condition11) || ENABLE(Condition12)
265
266 static v8::Handle<v8::Value> supplementalMethod1MethodCallback(const v8::Argumen ts& args)
267 {
268 return TestInterfaceV8Internal::supplementalMethod1Method(args);
269 }
270
271 #endif // ENABLE(Condition11) || ENABLE(Condition12)
272
273 #if ENABLE(Condition11) || ENABLE(Condition12)
274
275 static v8::Handle<v8::Value> supplementalMethod2Method(const v8::Arguments& args )
276 {
277 if (args.Length() < 2)
278 return throwNotEnoughArgumentsError(args.GetIsolate());
279 TestInterface* imp = V8TestInterface::toNative(args.Holder());
280 ExceptionCode ec = 0;
281 {
282 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, strArg, args[0]);
283 V8TRYCATCH(TestObj*, objArg, V8TestObj::HasInstance(args[1], args.GetIsolate (), worldType(args.GetIsolate())) ? V8TestObj::toNative(v8::Handle<v8::Object>:: Cast(args[1])) : 0);
284 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
285 RefPtr<TestObj> result = TestSupplemental::supplementalMethod2(scriptContext , imp, strArg, objArg, ec);
286 if (UNLIKELY(ec))
287 goto fail;
288 return toV8(result.release(), args.Holder(), args.GetIsolate());
289 }
290 fail:
291 return setDOMException(ec, args.GetIsolate());
292 }
293
294 #endif // ENABLE(Condition11) || ENABLE(Condition12)
295
296 #if ENABLE(Condition11) || ENABLE(Condition12)
297
298 static v8::Handle<v8::Value> supplementalMethod2MethodCallback(const v8::Argumen ts& args)
299 {
300 return TestInterfaceV8Internal::supplementalMethod2Method(args);
301 }
302
303 #endif // ENABLE(Condition11) || ENABLE(Condition12)
304
305 #if ENABLE(Condition11) || ENABLE(Condition12)
306
307 static v8::Handle<v8::Value> supplementalMethod3MethodCallback(const v8::Argumen ts& args)
308 {
309 return V8TestInterface::supplementalMethod3MethodCustom(args);
310 }
311
312 #endif // ENABLE(Condition11) || ENABLE(Condition12)
313
314 #if ENABLE(Condition11) || ENABLE(Condition12)
315
316 static v8::Handle<v8::Value> supplementalMethod4Method(const v8::Arguments& args )
317 {
318 TestSupplemental::supplementalMethod4();
319 return v8Undefined();
320 }
321
322 #endif // ENABLE(Condition11) || ENABLE(Condition12)
323
324 #if ENABLE(Condition11) || ENABLE(Condition12)
325
326 static v8::Handle<v8::Value> supplementalMethod4MethodCallback(const v8::Argumen ts& args)
327 {
328 return TestInterfaceV8Internal::supplementalMethod4Method(args);
329 }
330
331 #endif // ENABLE(Condition11) || ENABLE(Condition12)
332
333 static v8::Handle<v8::Value> constructor(const v8::Arguments& args)
334 {
335 if (args.Length() < 1)
336 return throwNotEnoughArgumentsError(args.GetIsolate());
337
338 ExceptionCode ec = 0;
339 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str1, args[0]);
340 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str2, args[1]);
341
342 ScriptExecutionContext* context = getScriptExecutionContext();
343
344 RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, ec);
345 v8::Handle<v8::Object> wrapper = args.Holder();
346 if (ec)
347 goto fail;
348
349 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestInterface::i nfo, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
350 return wrapper;
351 fail:
352 return setDOMException(ec, args.GetIsolate());
353 }
354
355 } // namespace TestInterfaceV8Internal
356
357 static const V8DOMConfiguration::BatchedAttribute V8TestInterfaceAttrs[] = {
358 #if ENABLE(Condition11) || ENABLE(Condition12)
359 // Attribute 'supplementalStaticReadOnlyAttr' (Type: 'readonly attribute' Ex tAttr: 'Conditional ImplementedBy')
360 {"supplementalStaticReadOnlyAttr", TestInterfaceV8Internal::supplementalStat icReadOnlyAttrAttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::Acce ssControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on i nstance */},
361 #endif // ENABLE(Condition11) || ENABLE(Condition12)
362 #if ENABLE(Condition11) || ENABLE(Condition12)
363 // Attribute 'supplementalStaticAttr' (Type: 'attribute' ExtAttr: 'Condition al ImplementedBy')
364 {"supplementalStaticAttr", TestInterfaceV8Internal::supplementalStaticAttrAt trGetterCallback, TestInterfaceV8Internal::supplementalStaticAttrAttrSetterCallb ack, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_ cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
365 #endif // ENABLE(Condition11) || ENABLE(Condition12)
366 #if ENABLE(Condition11) || ENABLE(Condition12)
367 // Attribute 'supplementalStr1' (Type: 'readonly attribute' ExtAttr: 'Condit ional ImplementedBy')
368 {"supplementalStr1", TestInterfaceV8Internal::supplementalStr1AttrGetterCall back, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), sta tic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
369 #endif // ENABLE(Condition11) || ENABLE(Condition12)
370 #if ENABLE(Condition11) || ENABLE(Condition12)
371 // Attribute 'supplementalStr2' (Type: 'attribute' ExtAttr: 'Conditional Imp lementedBy')
372 {"supplementalStr2", TestInterfaceV8Internal::supplementalStr2AttrGetterCall back, TestInterfaceV8Internal::supplementalStr2AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */},
373 #endif // ENABLE(Condition11) || ENABLE(Condition12)
374 #if ENABLE(Condition11) || ENABLE(Condition12)
375 // Attribute 'supplementalStr3' (Type: 'attribute' ExtAttr: 'CustomSetter Cu stomGetter Conditional ImplementedBy')
376 {"supplementalStr3", TestInterfaceV8Internal::supplementalStr3AttrGetterCall back, TestInterfaceV8Internal::supplementalStr3AttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */},
377 #endif // ENABLE(Condition11) || ENABLE(Condition12)
378 #if ENABLE(Condition11) || ENABLE(Condition12)
379 // Attribute 'supplementalNode' (Type: 'attribute' ExtAttr: 'Conditional Imp lementedBy')
380 {"supplementalNode", TestInterfaceV8Internal::supplementalNodeAttrGetterCall back, TestInterfaceV8Internal::supplementalNodeAttrSetterCallback, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */},
381 #endif // ENABLE(Condition11) || ENABLE(Condition12)
382 };
383
384 static const V8DOMConfiguration::BatchedMethod V8TestInterfaceMethods[] = {
385 #if ENABLE(Condition11) || ENABLE(Condition12)
386 {"supplementalMethod1", TestInterfaceV8Internal::supplementalMethod1MethodCa llback, 0},
387 #endif
388 #if ENABLE(Condition11) || ENABLE(Condition12)
389 {"supplementalMethod3", TestInterfaceV8Internal::supplementalMethod3MethodCa llback, 0},
390 #endif
391 };
392
393 static const V8DOMConfiguration::BatchedConstant V8TestInterfaceConsts[] = {
394 #if ENABLE(Condition11) || ENABLE(Condition12)
395 {"SUPPLEMENTALCONSTANT1", 1},
396 #endif
397 #if ENABLE(Condition11) || ENABLE(Condition12)
398 {"SUPPLEMENTALCONSTANT2", 2},
399 #endif
400 };
401
402
403 #if ENABLE(Condition11) || ENABLE(Condition12)
404 COMPILE_ASSERT(1 == TestSupplemental::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSU PPLEMENTALCONSTANT1IsWrongUseDoNotCheckConstants);
405 #endif
406 #if ENABLE(Condition11) || ENABLE(Condition12)
407 COMPILE_ASSERT(2 == TestSupplemental::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsW rongUseDoNotCheckConstants);
408 #endif
409
410 v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args)
411 {
412 if (!args.IsConstructCall())
413 return throwTypeError("DOM object constructor cannot be called as a func tion.", args.GetIsolate());
414
415 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
416 return args.Holder();
417
418 return TestInterfaceV8Internal::constructor(args);
419 }
420
421 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: :Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType c urrentWorldType)
422 {
423 desc->ReadOnlyPrototype();
424
425 v8::Local<v8::Signature> defaultSignature;
426 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestInterfac e", v8::Persistent<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount,
427 V8TestInterfaceAttrs, WTF_ARRAY_LENGTH(V8TestInterfaceAttrs),
428 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods), isolat e, currentWorldType);
429 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
430 #if ENABLE(TEST_INTERFACE)
431 desc->SetCallHandler(V8TestInterface::constructorCallback);
432 #endif // ENABLE(TEST_INTERFACE)
433 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
434 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
435 UNUSED_PARAM(instance); // In some cases, it will not be used.
436 UNUSED_PARAM(proto); // In some cases, it will not be used.
437
438
439 // Custom Signature 'supplementalMethod2'
440 const int supplementalMethod2Argc = 2;
441 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2 Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r awTemplate(&V8TestObj::info, currentWorldType) };
442 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New( desc, supplementalMethod2Argc, supplementalMethod2Argv);
443 #if ENABLE(Condition11) || ENABLE(Condition12)
444 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat e::New(TestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Undefined() , supplementalMethod2Signature));
445 #endif // ENABLE(Condition11) || ENABLE(Condition12)
446 #if ENABLE(Condition11) || ENABLE(Condition12)
447 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate ::New(TestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>()));
448 #endif // ENABLE(Condition11) || ENABLE(Condition12)
449 V8DOMConfiguration::batchConfigureConstants(desc, proto, V8TestInterfaceCons ts, WTF_ARRAY_LENGTH(V8TestInterfaceConsts), isolate);
450
451 // Custom toString template
452 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate());
453 return desc;
454 }
455
456 v8::Persistent<v8::FunctionTemplate> V8TestInterface::GetTemplate(v8::Isolate* i solate, WrapperWorldType currentWorldType)
457 {
458 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
459 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&info);
460 if (result != data->templateMap(currentWorldType).end())
461 return result->value;
462
463 v8::HandleScope handleScope;
464 v8::Persistent<v8::FunctionTemplate> templ =
465 ConfigureV8TestInterfaceTemplate(data->rawTemplate(&info, currentWorldTy pe), isolate, currentWorldType);
466 data->templateMap(currentWorldType).add(&info, templ);
467 return templ;
468 }
469
470 bool V8TestInterface::HasInstance(v8::Handle<v8::Value> value, v8::Isolate* isol ate, WrapperWorldType currentWorldType)
471 {
472 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWor ldType);
473 }
474
475 bool V8TestInterface::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Iso late* isolate)
476 {
477 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld)
478 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWo rld)
479 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorl d);
480 }
481
482 ActiveDOMObject* V8TestInterface::toActiveDOMObject(v8::Handle<v8::Object> objec t)
483 {
484 return toNative(object);
485 }
486
487
488 v8::Handle<v8::Object> V8TestInterface::createWrapper(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
489 {
490 ASSERT(impl.get());
491 ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
492
493 #if ENABLE(BINDING_INTEGRITY)
494 checkTypeOrDieTrying(impl.get());
495 #endif
496
497 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &info, impl.get(), isolate);
498 if (UNLIKELY(wrapper.IsEmpty()))
499 return wrapper;
500
501 installPerContextProperties(wrapper, impl.get(), isolate);
502 V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, hasD ependentLifetime ? WrapperConfiguration::Dependent : WrapperConfiguration::Indep endent);
503 return wrapper;
504 }
505 void V8TestInterface::derefObject(void* object)
506 {
507 static_cast<TestInterface*>(object)->deref();
508 }
509
510 } // namespace WebCore
511
512 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698