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

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

Issue 24053003: Support partial interface for test support idls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
OLDNEW
(Empty)
1 /*
2 This file is part of the Blink open source project.
3 This file has been auto-generated by CodeGeneratorV8.pm. 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 #include "V8TestSupportTestInterface.h"
23
24 #include "RuntimeEnabledFeatures.h"
25 #include "V8Node.h"
26 #include "V8TestObject.h"
27 #include "bindings/tests/idls/test_support/TestSupportTestPartialInterface.h"
28 #include "bindings/v8/ExceptionState.h"
29 #include "bindings/v8/ScriptController.h"
30 #include "bindings/v8/V8Binding.h"
31 #include "bindings/v8/V8DOMConfiguration.h"
32 #include "bindings/v8/V8DOMWrapper.h"
33 #include "core/dom/ContextFeatures.h"
34 #include "core/dom/Document.h"
35 #include "core/page/Frame.h"
36 #include "core/platform/chromium/TraceEvent.h"
37 #include "wtf/GetPtr.h"
38 #include "wtf/RefPtr.h"
39 #include "wtf/UnusedParam.h"
40
41 namespace WebCore {
42
43 static void initializeScriptWrappableForInterface(TestSupportTestInterface* obje ct)
44 {
45 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
46 ScriptWrappable::setTypeInfoInObject(object, &V8TestSupportTestInterface ::info);
47 else
48 ASSERT_NOT_REACHED();
49 }
50
51 } // namespace WebCore
52
53 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows:
54 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
55 // in the global namespace.
56 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe edback/details/664619/the-namespace-of-local-function-declarations-in-c)
57 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSupportTestInterf ace* object)
58 {
59 WebCore::initializeScriptWrappableForInterface(object);
60 }
61
62 namespace WebCore {
63 WrapperTypeInfo V8TestSupportTestInterface::info = { V8TestSupportTestInterface: :GetTemplate, V8TestSupportTestInterface::derefObject, 0, 0, 0, V8TestSupportTes tInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
64
65 namespace TestSupportTestInterfaceV8Internal {
66
67 template <typename T> void V8_USE(T) { }
68
69 #if ENABLE(Condition11) || ENABLE(Condition12)
70
71 static void supplementalStaticReadOnlyAttrAttributeGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
72 {
73 v8SetReturnValueInt(info, TestSupportTestPartialInterface::supplementalStati cReadOnlyAttr());
74 return;
75 }
76
77 #endif // ENABLE(Condition11) || ENABLE(Condition12)
78
79 #if ENABLE(Condition11) || ENABLE(Condition12)
80
81 static void supplementalStaticReadOnlyAttrAttributeGetterCallback(v8::Local<v8:: String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
82 {
83 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
84 TestSupportTestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttributeG etter(name, info);
85 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
86 }
87
88 #endif // ENABLE(Condition11) || ENABLE(Condition12)
89
90 #if ENABLE(Condition11) || ENABLE(Condition12)
91
92 static void supplementalStaticAttrAttributeGetter(v8::Local<v8::String> name, co nst v8::PropertyCallbackInfo<v8::Value>& info)
93 {
94 v8SetReturnValueString(info, TestSupportTestPartialInterface::supplementalSt aticAttr(), info.GetIsolate());
95 return;
96 }
97
98 #endif // ENABLE(Condition11) || ENABLE(Condition12)
99
100 #if ENABLE(Condition11) || ENABLE(Condition12)
101
102 static void supplementalStaticAttrAttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
103 {
104 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
105 TestSupportTestInterfaceV8Internal::supplementalStaticAttrAttributeGetter(na me, info);
106 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
107 }
108
109 #endif // ENABLE(Condition11) || ENABLE(Condition12)
110
111 #if ENABLE(Condition11) || ENABLE(Condition12)
112
113 static void supplementalStaticAttrAttributeSetter(v8::Local<v8::String> name, v8 ::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
114 {
115 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
116 TestSupportTestPartialInterface::setSupplementalStaticAttr(v);
117 return;
118 }
119
120 #endif // ENABLE(Condition11) || ENABLE(Condition12)
121
122 #if ENABLE(Condition11) || ENABLE(Condition12)
123
124 static void supplementalStaticAttrAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
125 {
126 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
127 TestSupportTestInterfaceV8Internal::supplementalStaticAttrAttributeSetter(na me, value, info);
128 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
129 }
130
131 #endif // ENABLE(Condition11) || ENABLE(Condition12)
132
133 #if ENABLE(Condition11) || ENABLE(Condition12)
134
135 static void supplementalStr1AttributeGetter(v8::Local<v8::String> name, const v8 ::PropertyCallbackInfo<v8::Value>& info)
136 {
137 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
138 v8SetReturnValueString(info, TestSupportTestPartialInterface::supplementalSt r1(imp), info.GetIsolate());
139 return;
140 }
141
142 #endif // ENABLE(Condition11) || ENABLE(Condition12)
143
144 #if ENABLE(Condition11) || ENABLE(Condition12)
145
146 static void supplementalStr1AttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
147 {
148 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
149 TestSupportTestInterfaceV8Internal::supplementalStr1AttributeGetter(name, in fo);
150 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
151 }
152
153 #endif // ENABLE(Condition11) || ENABLE(Condition12)
154
155 #if ENABLE(Condition11) || ENABLE(Condition12)
156
157 static void supplementalStr2AttributeGetter(v8::Local<v8::String> name, const v8 ::PropertyCallbackInfo<v8::Value>& info)
158 {
159 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
160 v8SetReturnValueString(info, TestSupportTestPartialInterface::supplementalSt r2(imp), info.GetIsolate());
161 return;
162 }
163
164 #endif // ENABLE(Condition11) || ENABLE(Condition12)
165
166 #if ENABLE(Condition11) || ENABLE(Condition12)
167
168 static void supplementalStr2AttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
169 {
170 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
171 TestSupportTestInterfaceV8Internal::supplementalStr2AttributeGetter(name, in fo);
172 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
173 }
174
175 #endif // ENABLE(Condition11) || ENABLE(Condition12)
176
177 #if ENABLE(Condition11) || ENABLE(Condition12)
178
179 static void supplementalStr2AttributeSetter(v8::Local<v8::String> name, v8::Loca l<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
180 {
181 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
182 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
183 TestSupportTestPartialInterface::setSupplementalStr2(imp, v);
184 return;
185 }
186
187 #endif // ENABLE(Condition11) || ENABLE(Condition12)
188
189 #if ENABLE(Condition11) || ENABLE(Condition12)
190
191 static void supplementalStr2AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
192 {
193 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
194 TestSupportTestInterfaceV8Internal::supplementalStr2AttributeSetter(name, va lue, info);
195 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
196 }
197
198 #endif // ENABLE(Condition11) || ENABLE(Condition12)
199
200 #if ENABLE(Condition11) || ENABLE(Condition12)
201
202 static void supplementalStr3AttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
203 {
204 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
205 V8TestSupportTestInterface::supplementalStr3AttributeGetterCustom(name, info );
206 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
207 }
208
209 #endif // ENABLE(Condition11) || ENABLE(Condition12)
210
211 #if ENABLE(Condition11) || ENABLE(Condition12)
212
213 static void supplementalStr3AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
214 {
215 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
216 V8TestSupportTestInterface::supplementalStr3AttributeSetterCustom(name, valu e, info);
217 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
218 }
219
220 #endif // ENABLE(Condition11) || ENABLE(Condition12)
221
222 #if ENABLE(Condition11) || ENABLE(Condition12)
223
224 static void supplementalNodeAttributeGetter(v8::Local<v8::String> name, const v8 ::PropertyCallbackInfo<v8::Value>& info)
225 {
226 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
227 v8SetReturnValueFast(info, TestSupportTestPartialInterface::supplementalNode (imp), imp);
228 return;
229 }
230
231 #endif // ENABLE(Condition11) || ENABLE(Condition12)
232
233 #if ENABLE(Condition11) || ENABLE(Condition12)
234
235 static void supplementalNodeAttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
236 {
237 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
238 TestSupportTestInterfaceV8Internal::supplementalNodeAttributeGetter(name, in fo);
239 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
240 }
241
242 #endif // ENABLE(Condition11) || ENABLE(Condition12)
243
244 #if ENABLE(Condition11) || ENABLE(Condition12)
245
246 static void supplementalNodeAttributeSetter(v8::Local<v8::String> name, v8::Loca l<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
247 {
248 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
249 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
250 TestSupportTestPartialInterface::setSupplementalNode(imp, WTF::getPtr(v));
251 return;
252 }
253
254 #endif // ENABLE(Condition11) || ENABLE(Condition12)
255
256 #if ENABLE(Condition11) || ENABLE(Condition12)
257
258 static void supplementalNodeAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
259 {
260 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
261 TestSupportTestInterfaceV8Internal::supplementalNodeAttributeSetter(name, va lue, info);
262 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
263 }
264
265 #endif // ENABLE(Condition11) || ENABLE(Condition12)
266
267 #if ENABLE(Condition11) || ENABLE(Condition12)
268
269 static void Node13AttributeGetter(v8::Local<v8::String> name, const v8::Property CallbackInfo<v8::Value>& info)
270 {
271 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
272 v8SetReturnValueFast(info, TestSupportTestPartialInterface::node13(imp), imp );
273 return;
274 }
275
276 #endif // ENABLE(Condition11) || ENABLE(Condition12)
277
278 #if ENABLE(Condition11) || ENABLE(Condition12)
279
280 static void Node13AttributeGetterCallback(v8::Local<v8::String> name, const v8:: PropertyCallbackInfo<v8::Value>& info)
281 {
282 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
283 TestSupportTestInterfaceV8Internal::Node13AttributeGetter(name, info);
284 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
285 }
286
287 #endif // ENABLE(Condition11) || ENABLE(Condition12)
288
289 #if ENABLE(Condition11) || ENABLE(Condition12)
290
291 static void Node13AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu e> value, const v8::PropertyCallbackInfo<void>& info)
292 {
293 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
294 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
295 TestSupportTestPartialInterface::setNode13(imp, WTF::getPtr(v));
296 return;
297 }
298
299 #endif // ENABLE(Condition11) || ENABLE(Condition12)
300
301 #if ENABLE(Condition11) || ENABLE(Condition12)
302
303 static void Node13AttributeSetterCallback(v8::Local<v8::String> name, v8::Local< v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
304 {
305 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
306 TestSupportTestInterfaceV8Internal::Node13AttributeSetter(name, value, info) ;
307 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
308 }
309
310 #endif // ENABLE(Condition11) || ENABLE(Condition12)
311
312 #if ENABLE(Condition11) || ENABLE(Condition12)
313
314 static void Node14AttributeGetter(v8::Local<v8::String> name, const v8::Property CallbackInfo<v8::Value>& info)
315 {
316 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
317 v8SetReturnValueFast(info, TestSupportTestPartialInterface::node14(imp), imp );
318 return;
319 }
320
321 #endif // ENABLE(Condition11) || ENABLE(Condition12)
322
323 #if ENABLE(Condition11) || ENABLE(Condition12)
324
325 static void Node14AttributeGetterCallback(v8::Local<v8::String> name, const v8:: PropertyCallbackInfo<v8::Value>& info)
326 {
327 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
328 TestSupportTestInterfaceV8Internal::Node14AttributeGetter(name, info);
329 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
330 }
331
332 #endif // ENABLE(Condition11) || ENABLE(Condition12)
333
334 #if ENABLE(Condition11) || ENABLE(Condition12)
335
336 static void Node14AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu e> value, const v8::PropertyCallbackInfo<void>& info)
337 {
338 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
339 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
340 TestSupportTestPartialInterface::setNode14(imp, WTF::getPtr(v));
341 return;
342 }
343
344 #endif // ENABLE(Condition11) || ENABLE(Condition12)
345
346 #if ENABLE(Condition11) || ENABLE(Condition12)
347
348 static void Node14AttributeSetterCallback(v8::Local<v8::String> name, v8::Local< v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
349 {
350 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
351 TestSupportTestInterfaceV8Internal::Node14AttributeSetter(name, value, info) ;
352 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
353 }
354
355 #endif // ENABLE(Condition11) || ENABLE(Condition12)
356
357 #if ENABLE(Condition11) || ENABLE(Condition12)
358
359 static void Node15AttributeGetter(v8::Local<v8::String> name, const v8::Property CallbackInfo<v8::Value>& info)
360 {
361 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
362 v8SetReturnValueFast(info, TestSupportTestPartialInterface::node15(imp), imp );
363 return;
364 }
365
366 #endif // ENABLE(Condition11) || ENABLE(Condition12)
367
368 #if ENABLE(Condition11) || ENABLE(Condition12)
369
370 static void Node15AttributeGetterCallback(v8::Local<v8::String> name, const v8:: PropertyCallbackInfo<v8::Value>& info)
371 {
372 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
373 TestSupportTestInterfaceV8Internal::Node15AttributeGetter(name, info);
374 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
375 }
376
377 #endif // ENABLE(Condition11) || ENABLE(Condition12)
378
379 #if ENABLE(Condition11) || ENABLE(Condition12)
380
381 static void Node15AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu e> value, const v8::PropertyCallbackInfo<void>& info)
382 {
383 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(info.Ho lder());
384 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
385 TestSupportTestPartialInterface::setNode15(imp, WTF::getPtr(v));
386 return;
387 }
388
389 #endif // ENABLE(Condition11) || ENABLE(Condition12)
390
391 #if ENABLE(Condition11) || ENABLE(Condition12)
392
393 static void Node15AttributeSetterCallback(v8::Local<v8::String> name, v8::Local< v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
394 {
395 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
396 TestSupportTestInterfaceV8Internal::Node15AttributeSetter(name, value, info) ;
397 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
398 }
399
400 #endif // ENABLE(Condition11) || ENABLE(Condition12)
401
402 #if ENABLE(Condition11) || ENABLE(Condition12)
403
404 static void supplementalMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args)
405 {
406 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(args.Ho lder());
407 TestSupportTestPartialInterface::supplementalMethod1(imp);
408
409 return;
410 }
411
412 #endif // ENABLE(Condition11) || ENABLE(Condition12)
413
414 #if ENABLE(Condition11) || ENABLE(Condition12)
415
416 static void supplementalMethod1MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
417 {
418 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
419 TestSupportTestInterfaceV8Internal::supplementalMethod1Method(args);
420 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
421 }
422
423 #endif // ENABLE(Condition11) || ENABLE(Condition12)
424
425 #if ENABLE(Condition11) || ENABLE(Condition12)
426
427 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& args)
428 {
429 if (UNLIKELY(args.Length() < 2)) {
430 throwNotEnoughArgumentsError(args.GetIsolate());
431 return;
432 }
433 TestSupportTestInterface* imp = V8TestSupportTestInterface::toNative(args.Ho lder());
434 ExceptionState es(args.GetIsolate());
435 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]);
436 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[1], args.Ge tIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(args[1])) : 0);
437 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
438 RefPtr<TestObj> result = TestSupportTestPartialInterface::supplementalMethod 2(scriptContext, imp, strArg, objArg, es);
439 if (es.throwIfNeeded())
440 return;
441 v8SetReturnValue(args, result.release(), args.Holder());
442 return;
443 }
444
445 #endif // ENABLE(Condition11) || ENABLE(Condition12)
446
447 #if ENABLE(Condition11) || ENABLE(Condition12)
448
449 static void supplementalMethod2MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
450 {
451 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
452 TestSupportTestInterfaceV8Internal::supplementalMethod2Method(args);
453 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
454 }
455
456 #endif // ENABLE(Condition11) || ENABLE(Condition12)
457
458 #if ENABLE(Condition11) || ENABLE(Condition12)
459
460 static void supplementalMethod3MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
461 {
462 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
463 V8TestSupportTestInterface::supplementalMethod3MethodCustom(args);
464 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
465 }
466
467 #endif // ENABLE(Condition11) || ENABLE(Condition12)
468
469 #if ENABLE(Condition11) || ENABLE(Condition12)
470
471 static void supplementalMethod4Method(const v8::FunctionCallbackInfo<v8::Value>& args)
472 {
473 TestSupportTestPartialInterface::supplementalMethod4();
474
475 return;
476 }
477
478 #endif // ENABLE(Condition11) || ENABLE(Condition12)
479
480 #if ENABLE(Condition11) || ENABLE(Condition12)
481
482 static void supplementalMethod4MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
483 {
484 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
485 TestSupportTestInterfaceV8Internal::supplementalMethod4Method(args);
486 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
487 }
488
489 #endif // ENABLE(Condition11) || ENABLE(Condition12)
490
491 } // namespace TestSupportTestInterfaceV8Internal
492
493 static const V8DOMConfiguration::AttributeConfiguration V8TestSupportTestInterfa ceAttributes[] = {
494 #if ENABLE(Condition11) || ENABLE(Condition12)
495 {"supplementalStaticReadOnlyAttr", TestSupportTestInterfaceV8Internal::suppl ementalStaticReadOnlyAttrAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::Ac cessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
496 #endif // ENABLE(Condition11) || ENABLE(Condition12)
497 #if ENABLE(Condition11) || ENABLE(Condition12)
498 {"supplementalStaticAttr", TestSupportTestInterfaceV8Internal::supplementalS taticAttrAttributeGetterCallback, TestSupportTestInterfaceV8Internal::supplement alStaticAttrAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8: :DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
499 #endif // ENABLE(Condition11) || ENABLE(Condition12)
500 #if ENABLE(Condition11) || ENABLE(Condition12)
501 {"supplementalStr1", TestSupportTestInterfaceV8Internal::supplementalStr1Att ributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), s tatic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
502 #endif // ENABLE(Condition11) || ENABLE(Condition12)
503 #if ENABLE(Condition11) || ENABLE(Condition12)
504 {"supplementalStr2", TestSupportTestInterfaceV8Internal::supplementalStr2Att ributeGetterCallback, TestSupportTestInterfaceV8Internal::supplementalStr2Attrib uteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_ cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
505 #endif // ENABLE(Condition11) || ENABLE(Condition12)
506 #if ENABLE(Condition11) || ENABLE(Condition12)
507 {"supplementalStr3", TestSupportTestInterfaceV8Internal::supplementalStr3Att ributeGetterCallback, TestSupportTestInterfaceV8Internal::supplementalStr3Attrib uteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_ cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
508 #endif // ENABLE(Condition11) || ENABLE(Condition12)
509 #if ENABLE(Condition11) || ENABLE(Condition12)
510 {"supplementalNode", TestSupportTestInterfaceV8Internal::supplementalNodeAtt ributeGetterCallback, TestSupportTestInterfaceV8Internal::supplementalNodeAttrib uteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_ cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
511 #endif // ENABLE(Condition11) || ENABLE(Condition12)
512 };
513
514 static const V8DOMConfiguration::MethodConfiguration V8TestSupportTestInterfaceM ethods[] = {
515 #if ENABLE(Condition11) || ENABLE(Condition12)
516 {"supplementalMethod1", TestSupportTestInterfaceV8Internal::supplementalMeth od1MethodCallback, 0, 0},
517 #endif // ENABLE(Condition11) || ENABLE(Condition12)
518 #if ENABLE(Condition11) || ENABLE(Condition12)
519 {"supplementalMethod3", TestSupportTestInterfaceV8Internal::supplementalMeth od3MethodCallback, 0, 0},
520 #endif // ENABLE(Condition11) || ENABLE(Condition12)
521 };
522
523 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestSupportTestInterfaceTempl ate(v8::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldTyp e currentWorldType)
524 {
525 desc->ReadOnlyPrototype();
526
527 v8::Local<v8::Signature> defaultSignature;
528 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "TestSu pportTestInterface", v8::Local<v8::FunctionTemplate>(), V8TestSupportTestInterfa ce::internalFieldCount,
529 V8TestSupportTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestSupportTest InterfaceAttributes),
530 V8TestSupportTestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestSupportTestInt erfaceMethods), isolate, currentWorldType);
531 UNUSED_PARAM(defaultSignature);
532 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
533 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
534 UNUSED_PARAM(instance);
535 UNUSED_PARAM(proto);
536
537 #if ENABLE(Condition11) || ENABLE(Condition12)
538 if (RuntimeEnabledFeatures::condition13Enabled()) {
539 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
540 {"Node13", TestSupportTestInterfaceV8Internal::Node13AttributeGetterCall back, TestSupportTestInterfaceV8Internal::Node13AttributeSetterCallback, 0, 0, 0 , static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute >(v8::None), 0 /* on instance */};
541 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura tion, isolate, currentWorldType);
542 }
543
544 #endif // ENABLE(Condition11) || ENABLE(Condition12)
545 static const V8DOMConfiguration::ConstantConfiguration V8TestSupportTestInte rfaceConstants[] = {
546 {"SUPPLEMENTALCONSTANT1", 1},
547 {"SUPPLEMENTALCONSTANT2", 2},
548 };
549 V8DOMConfiguration::installConstants(desc, proto, V8TestSupportTestInterface Constants, WTF_ARRAY_LENGTH(V8TestSupportTestInterfaceConstants), isolate);
550 COMPILE_ASSERT(1 == TestSupportTestPartialInterface::SUPPLEMENTALCONSTANT1, TheValueOfTestSupportTestInterface_SUPPLEMENTALCONSTANT1DoesntMatchWithImplement ation);
551 COMPILE_ASSERT(2 == TestSupportTestPartialInterface::CONST_IMPL, TheValueOfT estSupportTestInterface_CONST_IMPLDoesntMatchWithImplementation);
552 #if ENABLE(Condition11) || ENABLE(Condition12)
553
554 // Custom Signature 'supplementalMethod2'
555 const int supplementalMethod2Argc = 2;
556 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2 Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r awTemplate(&V8TestObject::info, currentWorldType) };
557 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New( desc, supplementalMethod2Argc, supplementalMethod2Argv);
558 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat e::New(TestSupportTestInterfaceV8Internal::supplementalMethod2MethodCallback, v8 Undefined(), supplementalMethod2Signature, 2));
559 #endif // ENABLE(Condition11) || ENABLE(Condition12)
560 #if ENABLE(Condition11) || ENABLE(Condition12)
561 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate ::New(TestSupportTestInterfaceV8Internal::supplementalMethod4MethodCallback, v8U ndefined(), v8::Local<v8::Signature>(), 0));
562 #endif // ENABLE(Condition11) || ENABLE(Condition12)
563
564 // Custom toString template
565 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate());
566 return desc;
567 }
568
569 v8::Handle<v8::FunctionTemplate> V8TestSupportTestInterface::GetTemplate(v8::Iso late* isolate, WrapperWorldType currentWorldType)
570 {
571 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
572 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&info);
573 if (result != data->templateMap(currentWorldType).end())
574 return result->value.newLocal(isolate);
575
576 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
577 v8::HandleScope handleScope(isolate);
578 v8::Handle<v8::FunctionTemplate> templ =
579 ConfigureV8TestSupportTestInterfaceTemplate(data->rawTemplate(&info, cur rentWorldType), isolate, currentWorldType);
580 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function Template>(isolate, templ));
581 return handleScope.Close(templ);
582 }
583
584 bool V8TestSupportTestInterface::HasInstance(v8::Handle<v8::Value> value, v8::Is olate* isolate, WrapperWorldType currentWorldType)
585 {
586 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWor ldType);
587 }
588
589 bool V8TestSupportTestInterface::HasInstanceInAnyWorld(v8::Handle<v8::Value> val ue, v8::Isolate* isolate)
590 {
591 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld)
592 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWo rld)
593 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorl d);
594 }
595
596 void V8TestSupportTestInterface::installPerContextProperties(v8::Handle<v8::Obje ct> instance, TestSupportTestInterface* impl, v8::Isolate* isolate)
597 {
598 v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetProto type());
599
600 #if ENABLE(Condition11) || ENABLE(Condition12)
601 if (ContextFeatures::condition14Enabled(impl->document())) {
602 static const V8DOMConfiguration::AttributeConfiguration attributeConf iguration =\
603 {"Node14", TestSupportTestInterfaceV8Internal::Node14AttributeGetterCall back, TestSupportTestInterfaceV8Internal::Node14AttributeSetterCallback, 0, 0, 0 , static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute >(v8::None), 0 /* on instance */};
604 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura tion, isolate);
605 }
606 #endif // ENABLE(Condition11) || ENABLE(Condition12)
607
608 #if ENABLE(Condition11) || ENABLE(Condition12)
609 if (ContextFeatures::condition16Enabled(impl->document()) && RuntimeEnabledF eatures::condition15Enabled()) {
610 static const V8DOMConfiguration::AttributeConfiguration attributeConf iguration =\
611 {"Node15", TestSupportTestInterfaceV8Internal::Node15AttributeGetterCall back, TestSupportTestInterfaceV8Internal::Node15AttributeSetterCallback, 0, 0, 0 , static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute >(v8::None), 0 /* on instance */};
612 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura tion, isolate);
613 }
614 #endif // ENABLE(Condition11) || ENABLE(Condition12)
615 }
616
617 v8::Handle<v8::Object> V8TestSupportTestInterface::createWrapper(PassRefPtr<Test SupportTestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
618 {
619 ASSERT(impl.get());
620 ASSERT(!DOMDataStore::containsWrapper<V8TestSupportTestInterface>(impl.get() , isolate));
621 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
622 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
623 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have
624 // the same object de-ref functions, though, so use that as the basis of the check.
625 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == info.derefObjectFunction);
626 }
627
628 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &info, toInternalPointer(impl.get()), isolate);
629 if (UNLIKELY(wrapper.IsEmpty()))
630 return wrapper;
631
632 installPerContextProperties(wrapper, impl.get(), isolate);
633 V8DOMWrapper::associateObjectWithWrapper<V8TestSupportTestInterface>(impl, & info, wrapper, isolate, WrapperConfiguration::Independent);
634 return wrapper;
635 }
636
637 void V8TestSupportTestInterface::derefObject(void* object)
638 {
639 fromInternalPointer(object)->deref();
640 }
641
642 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698