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

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

Issue 24053003: Support partial interface for test support idls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: patch Created 7 years, 2 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 "V8NonCoreTestInterface.h"
23
24 #include "RuntimeEnabledFeatures.h"
25 #include "V8Node.h"
26 #include "V8TestObject.h"
27 #include "bindings/tests/idls/testing/NonCoreTestPartialInterface.h"
28 #include "bindings/v8/ExceptionMessages.h"
29 #include "bindings/v8/ExceptionState.h"
30 #include "bindings/v8/ScriptController.h"
31 #include "bindings/v8/V8Binding.h"
32 #include "bindings/v8/V8DOMConfiguration.h"
33 #include "bindings/v8/V8DOMWrapper.h"
34 #include "core/dom/ContextFeatures.h"
35 #include "core/dom/Document.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(NonCoreTestInterface* object)
44 {
45 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
46 ScriptWrappable::setTypeInfoInObject(object, &V8NonCoreTestInterface::in fo);
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::NonCoreTestInterface* object)
58 {
59 WebCore::initializeScriptWrappableForInterface(object);
60 }
61
62 namespace WebCore {
63 WrapperTypeInfo V8NonCoreTestInterface::info = { V8NonCoreTestInterface::GetTemp late, V8NonCoreTestInterface::derefObject, 0, 0, 0, V8NonCoreTestInterface::inst allPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
64
65 namespace NonCoreTestInterfaceV8Internal {
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, NonCoreTestPartialInterface::supplementalStaticRea dOnlyAttr());
74 }
75
76 #endif // ENABLE(Condition11) || ENABLE(Condition12)
77
78 #if ENABLE(Condition11) || ENABLE(Condition12)
79
80 static void supplementalStaticReadOnlyAttrAttributeGetterCallback(v8::Local<v8:: String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
81 {
82 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
83 NonCoreTestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttributeGette r(name, info);
84 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
85 }
86
87 #endif // ENABLE(Condition11) || ENABLE(Condition12)
88
89 #if ENABLE(Condition11) || ENABLE(Condition12)
90
91 static void supplementalStaticAttrAttributeGetter(v8::Local<v8::String> name, co nst v8::PropertyCallbackInfo<v8::Value>& info)
92 {
93 v8SetReturnValueString(info, NonCoreTestPartialInterface::supplementalStatic Attr(), info.GetIsolate());
94 }
95
96 #endif // ENABLE(Condition11) || ENABLE(Condition12)
97
98 #if ENABLE(Condition11) || ENABLE(Condition12)
99
100 static void supplementalStaticAttrAttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
101 {
102 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
103 NonCoreTestInterfaceV8Internal::supplementalStaticAttrAttributeGetter(name, info);
104 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
105 }
106
107 #endif // ENABLE(Condition11) || ENABLE(Condition12)
108
109 #if ENABLE(Condition11) || ENABLE(Condition12)
110
111 static void supplementalStaticAttrAttributeSetter(v8::Local<v8::String> name, v8 ::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
112 {
113 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
114 NonCoreTestPartialInterface::setSupplementalStaticAttr(v);
115 }
116
117 #endif // ENABLE(Condition11) || ENABLE(Condition12)
118
119 #if ENABLE(Condition11) || ENABLE(Condition12)
120
121 static void supplementalStaticAttrAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
122 {
123 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
124 NonCoreTestInterfaceV8Internal::supplementalStaticAttrAttributeSetter(name, value, info);
125 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
126 }
127
128 #endif // ENABLE(Condition11) || ENABLE(Condition12)
129
130 #if ENABLE(Condition11) || ENABLE(Condition12)
131
132 static void supplementalStr1AttributeGetter(v8::Local<v8::String> name, const v8 ::PropertyCallbackInfo<v8::Value>& info)
133 {
134 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
135 v8SetReturnValueString(info, NonCoreTestPartialInterface::supplementalStr1(i mp), info.GetIsolate());
136 }
137
138 #endif // ENABLE(Condition11) || ENABLE(Condition12)
139
140 #if ENABLE(Condition11) || ENABLE(Condition12)
141
142 static void supplementalStr1AttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
143 {
144 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
145 NonCoreTestInterfaceV8Internal::supplementalStr1AttributeGetter(name, info);
146 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
147 }
148
149 #endif // ENABLE(Condition11) || ENABLE(Condition12)
150
151 #if ENABLE(Condition11) || ENABLE(Condition12)
152
153 static void supplementalStr2AttributeGetter(v8::Local<v8::String> name, const v8 ::PropertyCallbackInfo<v8::Value>& info)
154 {
155 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
156 v8SetReturnValueString(info, NonCoreTestPartialInterface::supplementalStr2(i mp), info.GetIsolate());
157 }
158
159 #endif // ENABLE(Condition11) || ENABLE(Condition12)
160
161 #if ENABLE(Condition11) || ENABLE(Condition12)
162
163 static void supplementalStr2AttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
164 {
165 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
166 NonCoreTestInterfaceV8Internal::supplementalStr2AttributeGetter(name, info);
167 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
168 }
169
170 #endif // ENABLE(Condition11) || ENABLE(Condition12)
171
172 #if ENABLE(Condition11) || ENABLE(Condition12)
173
174 static void supplementalStr2AttributeSetter(v8::Local<v8::String> name, v8::Loca l<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
175 {
176 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
177 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
178 NonCoreTestPartialInterface::setSupplementalStr2(imp, v);
179 }
180
181 #endif // ENABLE(Condition11) || ENABLE(Condition12)
182
183 #if ENABLE(Condition11) || ENABLE(Condition12)
184
185 static void supplementalStr2AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
186 {
187 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
188 NonCoreTestInterfaceV8Internal::supplementalStr2AttributeSetter(name, value, info);
189 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
190 }
191
192 #endif // ENABLE(Condition11) || ENABLE(Condition12)
193
194 #if ENABLE(Condition11) || ENABLE(Condition12)
195
196 static void supplementalStr3AttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
197 {
198 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
199 V8NonCoreTestInterface::supplementalStr3AttributeGetterCustom(name, info);
200 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
201 }
202
203 #endif // ENABLE(Condition11) || ENABLE(Condition12)
204
205 #if ENABLE(Condition11) || ENABLE(Condition12)
206
207 static void supplementalStr3AttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
208 {
209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
210 V8NonCoreTestInterface::supplementalStr3AttributeSetterCustom(name, value, i nfo);
211 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
212 }
213
214 #endif // ENABLE(Condition11) || ENABLE(Condition12)
215
216 #if ENABLE(Condition11) || ENABLE(Condition12)
217
218 static void supplementalNodeAttributeGetter(v8::Local<v8::String> name, const v8 ::PropertyCallbackInfo<v8::Value>& info)
219 {
220 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
221 v8SetReturnValueFast(info, NonCoreTestPartialInterface::supplementalNode(imp ), imp);
222 }
223
224 #endif // ENABLE(Condition11) || ENABLE(Condition12)
225
226 #if ENABLE(Condition11) || ENABLE(Condition12)
227
228 static void supplementalNodeAttributeGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
229 {
230 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
231 NonCoreTestInterfaceV8Internal::supplementalNodeAttributeGetter(name, info);
232 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
233 }
234
235 #endif // ENABLE(Condition11) || ENABLE(Condition12)
236
237 #if ENABLE(Condition11) || ENABLE(Condition12)
238
239 static void supplementalNodeAttributeSetter(v8::Local<v8::String> name, v8::Loca l<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
240 {
241 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
242 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
243 NonCoreTestPartialInterface::setSupplementalNode(imp, WTF::getPtr(v));
244 }
245
246 #endif // ENABLE(Condition11) || ENABLE(Condition12)
247
248 #if ENABLE(Condition11) || ENABLE(Condition12)
249
250 static void supplementalNodeAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
251 {
252 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
253 NonCoreTestInterfaceV8Internal::supplementalNodeAttributeSetter(name, value, info);
254 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
255 }
256
257 #endif // ENABLE(Condition11) || ENABLE(Condition12)
258
259 #if ENABLE(Condition11) || ENABLE(Condition12)
260
261 static void Node13AttributeGetter(v8::Local<v8::String> name, const v8::Property CallbackInfo<v8::Value>& info)
262 {
263 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
264 v8SetReturnValueFast(info, NonCoreTestPartialInterface::node13(imp), imp);
265 }
266
267 #endif // ENABLE(Condition11) || ENABLE(Condition12)
268
269 #if ENABLE(Condition11) || ENABLE(Condition12)
270
271 static void Node13AttributeGetterCallback(v8::Local<v8::String> name, const v8:: PropertyCallbackInfo<v8::Value>& info)
272 {
273 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
274 NonCoreTestInterfaceV8Internal::Node13AttributeGetter(name, info);
275 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
276 }
277
278 #endif // ENABLE(Condition11) || ENABLE(Condition12)
279
280 #if ENABLE(Condition11) || ENABLE(Condition12)
281
282 static void Node13AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu e> value, const v8::PropertyCallbackInfo<void>& info)
283 {
284 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
285 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
286 NonCoreTestPartialInterface::setNode13(imp, WTF::getPtr(v));
287 }
288
289 #endif // ENABLE(Condition11) || ENABLE(Condition12)
290
291 #if ENABLE(Condition11) || ENABLE(Condition12)
292
293 static void Node13AttributeSetterCallback(v8::Local<v8::String> name, v8::Local< v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
294 {
295 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
296 NonCoreTestInterfaceV8Internal::Node13AttributeSetter(name, value, info);
297 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
298 }
299
300 #endif // ENABLE(Condition11) || ENABLE(Condition12)
301
302 #if ENABLE(Condition11) || ENABLE(Condition12)
303
304 static void Node14AttributeGetter(v8::Local<v8::String> name, const v8::Property CallbackInfo<v8::Value>& info)
305 {
306 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
307 v8SetReturnValueFast(info, NonCoreTestPartialInterface::node14(imp), imp);
308 }
309
310 #endif // ENABLE(Condition11) || ENABLE(Condition12)
311
312 #if ENABLE(Condition11) || ENABLE(Condition12)
313
314 static void Node14AttributeGetterCallback(v8::Local<v8::String> name, const v8:: PropertyCallbackInfo<v8::Value>& info)
315 {
316 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
317 NonCoreTestInterfaceV8Internal::Node14AttributeGetter(name, info);
318 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
319 }
320
321 #endif // ENABLE(Condition11) || ENABLE(Condition12)
322
323 #if ENABLE(Condition11) || ENABLE(Condition12)
324
325 static void Node14AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu e> value, const v8::PropertyCallbackInfo<void>& info)
326 {
327 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
328 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
329 NonCoreTestPartialInterface::setNode14(imp, WTF::getPtr(v));
330 }
331
332 #endif // ENABLE(Condition11) || ENABLE(Condition12)
333
334 #if ENABLE(Condition11) || ENABLE(Condition12)
335
336 static void Node14AttributeSetterCallback(v8::Local<v8::String> name, v8::Local< v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
337 {
338 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
339 NonCoreTestInterfaceV8Internal::Node14AttributeSetter(name, value, info);
340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
341 }
342
343 #endif // ENABLE(Condition11) || ENABLE(Condition12)
344
345 #if ENABLE(Condition11) || ENABLE(Condition12)
346
347 static void Node15AttributeGetter(v8::Local<v8::String> name, const v8::Property CallbackInfo<v8::Value>& info)
348 {
349 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
350 v8SetReturnValueFast(info, NonCoreTestPartialInterface::node15(imp), imp);
351 }
352
353 #endif // ENABLE(Condition11) || ENABLE(Condition12)
354
355 #if ENABLE(Condition11) || ENABLE(Condition12)
356
357 static void Node15AttributeGetterCallback(v8::Local<v8::String> name, const v8:: PropertyCallbackInfo<v8::Value>& info)
358 {
359 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
360 NonCoreTestInterfaceV8Internal::Node15AttributeGetter(name, info);
361 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
362 }
363
364 #endif // ENABLE(Condition11) || ENABLE(Condition12)
365
366 #if ENABLE(Condition11) || ENABLE(Condition12)
367
368 static void Node15AttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Valu e> value, const v8::PropertyCallbackInfo<void>& info)
369 {
370 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(info.Holder());
371 V8TRYCATCH_VOID(Node*, v, V8Node::HasInstance(value, info.GetIsolate(), worl dType(info.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(value) ) : 0);
372 NonCoreTestPartialInterface::setNode15(imp, WTF::getPtr(v));
373 }
374
375 #endif // ENABLE(Condition11) || ENABLE(Condition12)
376
377 #if ENABLE(Condition11) || ENABLE(Condition12)
378
379 static void Node15AttributeSetterCallback(v8::Local<v8::String> name, v8::Local< v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
380 {
381 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
382 NonCoreTestInterfaceV8Internal::Node15AttributeSetter(name, value, info);
383 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
384 }
385
386 #endif // ENABLE(Condition11) || ENABLE(Condition12)
387
388 #if ENABLE(Condition11) || ENABLE(Condition12)
389
390 static void supplementalMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& args)
391 {
392 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(args.Holder());
393 NonCoreTestPartialInterface::supplementalMethod1(imp);
394
395 return;
396 }
397
398 #endif // ENABLE(Condition11) || ENABLE(Condition12)
399
400 #if ENABLE(Condition11) || ENABLE(Condition12)
401
402 static void supplementalMethod1MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
403 {
404 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
405 NonCoreTestInterfaceV8Internal::supplementalMethod1Method(args);
406 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
407 }
408
409 #endif // ENABLE(Condition11) || ENABLE(Condition12)
410
411 #if ENABLE(Condition11) || ENABLE(Condition12)
412
413 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& args)
414 {
415 if (UNLIKELY(args.Length() < 2)) {
416 throwTypeError(ExceptionMessages::failedToExecute("supplementalMethod2", "NonCoreTestInterface", ExceptionMessages::notEnoughArguments(2, args.Length()) ), args.GetIsolate());
417 return;
418 }
419 NonCoreTestInterface* imp = V8NonCoreTestInterface::toNative(args.Holder());
420 ExceptionState es(args.GetIsolate());
421 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, args[0]);
422 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::HasInstance(args[1], args.Ge tIsolate(), worldType(args.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(args[1])) : 0);
423 ScriptExecutionContext* scriptContext = getScriptExecutionContext();
424 RefPtr<TestObj> result = NonCoreTestPartialInterface::supplementalMethod2(sc riptContext, imp, strArg, objArg, es);
425 if (es.throwIfNeeded())
426 return;
427 v8SetReturnValue(args, result.release(), args.Holder());
428 return;
429 }
430
431 #endif // ENABLE(Condition11) || ENABLE(Condition12)
432
433 #if ENABLE(Condition11) || ENABLE(Condition12)
434
435 static void supplementalMethod2MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
436 {
437 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
438 NonCoreTestInterfaceV8Internal::supplementalMethod2Method(args);
439 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
440 }
441
442 #endif // ENABLE(Condition11) || ENABLE(Condition12)
443
444 #if ENABLE(Condition11) || ENABLE(Condition12)
445
446 static void supplementalMethod3MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
447 {
448 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
449 V8NonCoreTestInterface::supplementalMethod3MethodCustom(args);
450 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
451 }
452
453 #endif // ENABLE(Condition11) || ENABLE(Condition12)
454
455 #if ENABLE(Condition11) || ENABLE(Condition12)
456
457 static void supplementalMethod4Method(const v8::FunctionCallbackInfo<v8::Value>& args)
458 {
459 NonCoreTestPartialInterface::supplementalMethod4();
460
461 return;
462 }
463
464 #endif // ENABLE(Condition11) || ENABLE(Condition12)
465
466 #if ENABLE(Condition11) || ENABLE(Condition12)
467
468 static void supplementalMethod4MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
469 {
470 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
471 NonCoreTestInterfaceV8Internal::supplementalMethod4Method(args);
472 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
473 }
474
475 #endif // ENABLE(Condition11) || ENABLE(Condition12)
476
477 } // namespace NonCoreTestInterfaceV8Internal
478
479 static const V8DOMConfiguration::AttributeConfiguration V8NonCoreTestInterfaceAt tributes[] = {
480 #if ENABLE(Condition11) || ENABLE(Condition12)
481 {"supplementalStr1", NonCoreTestInterfaceV8Internal::supplementalStr1Attribu teGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stati c_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
482 #endif // ENABLE(Condition11) || ENABLE(Condition12)
483 #if ENABLE(Condition11) || ENABLE(Condition12)
484 {"supplementalStr2", NonCoreTestInterfaceV8Internal::supplementalStr2Attribu teGetterCallback, NonCoreTestInterfaceV8Internal::supplementalStr2AttributeSette rCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8: :PropertyAttribute>(v8::None), 0 /* on instance */},
485 #endif // ENABLE(Condition11) || ENABLE(Condition12)
486 #if ENABLE(Condition11) || ENABLE(Condition12)
487 {"supplementalStr3", NonCoreTestInterfaceV8Internal::supplementalStr3Attribu teGetterCallback, NonCoreTestInterfaceV8Internal::supplementalStr3AttributeSette rCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8: :PropertyAttribute>(v8::None), 0 /* on instance */},
488 #endif // ENABLE(Condition11) || ENABLE(Condition12)
489 #if ENABLE(Condition11) || ENABLE(Condition12)
490 {"supplementalNode", NonCoreTestInterfaceV8Internal::supplementalNodeAttribu teGetterCallback, NonCoreTestInterfaceV8Internal::supplementalNodeAttributeSette rCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8: :PropertyAttribute>(v8::None), 0 /* on instance */},
491 #endif // ENABLE(Condition11) || ENABLE(Condition12)
492 };
493
494 static const V8DOMConfiguration::MethodConfiguration V8NonCoreTestInterfaceMetho ds[] = {
495 #if ENABLE(Condition11) || ENABLE(Condition12)
496 {"supplementalMethod1", NonCoreTestInterfaceV8Internal::supplementalMethod1M ethodCallback, 0, 0},
497 #endif // ENABLE(Condition11) || ENABLE(Condition12)
498 #if ENABLE(Condition11) || ENABLE(Condition12)
499 {"supplementalMethod3", NonCoreTestInterfaceV8Internal::supplementalMethod3M ethodCallback, 0, 0},
500 #endif // ENABLE(Condition11) || ENABLE(Condition12)
501 };
502
503 static v8::Handle<v8::FunctionTemplate> ConfigureV8NonCoreTestInterfaceTemplate( v8::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType cu rrentWorldType)
504 {
505 desc->ReadOnlyPrototype();
506
507 v8::Local<v8::Signature> defaultSignature;
508 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "NonCor eTestInterface", v8::Local<v8::FunctionTemplate>(), V8NonCoreTestInterface::inte rnalFieldCount,
509 V8NonCoreTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8NonCoreTestInterfac eAttributes),
510 V8NonCoreTestInterfaceMethods, WTF_ARRAY_LENGTH(V8NonCoreTestInterfaceMe thods), isolate, currentWorldType);
511 UNUSED_PARAM(defaultSignature);
512 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
513 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
514 UNUSED_PARAM(instance);
515 UNUSED_PARAM(proto);
516
517 #if ENABLE(Condition11) || ENABLE(Condition12)
518 if (RuntimeEnabledFeatures::condition13Enabled()) {
519 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
520 {"Node13", NonCoreTestInterfaceV8Internal::Node13AttributeGetterCallback , NonCoreTestInterfaceV8Internal::Node13AttributeSetterCallback, 0, 0, 0, static _cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::No ne), 0 /* on instance */};
521 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura tion, isolate, currentWorldType);
522 }
523
524 #endif // ENABLE(Condition11) || ENABLE(Condition12)
525 static const V8DOMConfiguration::ConstantConfiguration V8NonCoreTestInterfac eConstants[] = {
526 {"SUPPLEMENTALCONSTANT1", 1},
527 {"SUPPLEMENTALCONSTANT2", 2},
528 };
529 V8DOMConfiguration::installConstants(desc, proto, V8NonCoreTestInterfaceCons tants, WTF_ARRAY_LENGTH(V8NonCoreTestInterfaceConstants), isolate);
530 COMPILE_ASSERT(1 == NonCoreTestPartialInterface::SUPPLEMENTALCONSTANT1, TheV alueOfNonCoreTestInterface_SUPPLEMENTALCONSTANT1DoesntMatchWithImplementation);
531 COMPILE_ASSERT(2 == NonCoreTestPartialInterface::CONST_IMPL, TheValueOfNonCo reTestInterface_CONST_IMPLDoesntMatchWithImplementation);
532 #if ENABLE(Condition11) || ENABLE(Condition12)
533
534 // Custom Signature 'supplementalMethod2'
535 const int supplementalMethod2Argc = 2;
536 v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2 Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->r awTemplate(&V8TestObject::info, currentWorldType) };
537 v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New( desc, supplementalMethod2Argc, supplementalMethod2Argv);
538 proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplat e::New(NonCoreTestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Unde fined(), supplementalMethod2Signature, 2));
539 #endif // ENABLE(Condition11) || ENABLE(Condition12)
540 #if ENABLE(Condition11) || ENABLE(Condition12)
541 desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate ::New(NonCoreTestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undef ined(), v8::Local<v8::Signature>(), 0));
542 #endif // ENABLE(Condition11) || ENABLE(Condition12)
543 #if ENABLE(Condition11) || ENABLE(Condition12)
544 desc->SetNativeDataProperty(v8::String::NewSymbol("supplementalStaticReadOnl yAttr"), NonCoreTestInterfaceV8Internal::supplementalStaticReadOnlyAttrAttribute GetterCallback, 0, v8::External::New(0), static_cast<v8::PropertyAttribute>(v8:: None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::D EFAULT));
545 #endif // ENABLE(Condition11) || ENABLE(Condition12)
546 #if ENABLE(Condition11) || ENABLE(Condition12)
547 desc->SetNativeDataProperty(v8::String::NewSymbol("supplementalStaticAttr"), NonCoreTestInterfaceV8Internal::supplementalStaticAttrAttributeGetterCallback, NonCoreTestInterfaceV8Internal::supplementalStaticAttrAttributeSetterCallback, v 8::External::New(0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8 ::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
548 #endif // ENABLE(Condition11) || ENABLE(Condition12)
549
550 // Custom toString template
551 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate());
552 return desc;
553 }
554
555 v8::Handle<v8::FunctionTemplate> V8NonCoreTestInterface::GetTemplate(v8::Isolate * isolate, WrapperWorldType currentWorldType)
556 {
557 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
558 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&info);
559 if (result != data->templateMap(currentWorldType).end())
560 return result->value.newLocal(isolate);
561
562 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
563 v8::HandleScope handleScope(isolate);
564 v8::Handle<v8::FunctionTemplate> templ =
565 ConfigureV8NonCoreTestInterfaceTemplate(data->rawTemplate(&info, current WorldType), isolate, currentWorldType);
566 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function Template>(isolate, templ));
567 return handleScope.Close(templ);
568 }
569
570 bool V8NonCoreTestInterface::HasInstance(v8::Handle<v8::Value> value, v8::Isolat e* isolate, WrapperWorldType currentWorldType)
571 {
572 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWor ldType);
573 }
574
575 bool V8NonCoreTestInterface::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate* isolate)
576 {
577 return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld)
578 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWo rld)
579 || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorl d);
580 }
581
582 void V8NonCoreTestInterface::installPerContextProperties(v8::Handle<v8::Object> instance, NonCoreTestInterface* impl, v8::Isolate* isolate)
583 {
584 v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetProto type());
585
586 #if ENABLE(Condition11) || ENABLE(Condition12)
587 if (ContextFeatures::condition14Enabled(impl->document())) {
588 static const V8DOMConfiguration::AttributeConfiguration attributeConf iguration =\
589 {"Node14", NonCoreTestInterfaceV8Internal::Node14AttributeGetterCallback , NonCoreTestInterfaceV8Internal::Node14AttributeSetterCallback, 0, 0, 0, static _cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::No ne), 0 /* on instance */};
590 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura tion, isolate);
591 }
592 #endif // ENABLE(Condition11) || ENABLE(Condition12)
593
594 #if ENABLE(Condition11) || ENABLE(Condition12)
595 if (ContextFeatures::condition16Enabled(impl->document()) && RuntimeEnabledF eatures::condition15Enabled()) {
596 static const V8DOMConfiguration::AttributeConfiguration attributeConf iguration =\
597 {"Node15", NonCoreTestInterfaceV8Internal::Node15AttributeGetterCallback , NonCoreTestInterfaceV8Internal::Node15AttributeSetterCallback, 0, 0, 0, static _cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::No ne), 0 /* on instance */};
598 V8DOMConfiguration::installAttribute(instance, proto, attributeConfigura tion, isolate);
599 }
600 #endif // ENABLE(Condition11) || ENABLE(Condition12)
601 }
602
603 v8::Handle<v8::Object> V8NonCoreTestInterface::createWrapper(PassRefPtr<NonCoreT estInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate )
604 {
605 ASSERT(impl.get());
606 ASSERT(!DOMDataStore::containsWrapper<V8NonCoreTestInterface>(impl.get(), is olate));
607 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
608 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
609 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have
610 // the same object de-ref functions, though, so use that as the basis of the check.
611 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == info.derefObjectFunction);
612 }
613
614 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &info, toInternalPointer(impl.get()), isolate);
615 if (UNLIKELY(wrapper.IsEmpty()))
616 return wrapper;
617
618 installPerContextProperties(wrapper, impl.get(), isolate);
619 V8DOMWrapper::associateObjectWithWrapper<V8NonCoreTestInterface>(impl, &info , wrapper, isolate, WrapperConfiguration::Independent);
620 return wrapper;
621 }
622
623 void V8NonCoreTestInterface::derefObject(void* object)
624 {
625 fromInternalPointer(object)->deref();
626 }
627
628 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698