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

Side by Side Diff: Source/bindings/tests/results/core/UnionTypesCore.h

Issue 953123003: IDL: Put generated union type containers in separate files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #ifndef UnionTypeCore_h 7 #ifndef UnionTypeCore_h
8 #define UnionTypeCore_h 8 #define UnionTypeCore_h
9 9
10 #include "bindings/core/v8/Dictionary.h" 10 #include "bindings/core/v8/ArrayBufferOrArrayBufferViewOrDictionary.h"
11 #include "bindings/core/v8/ExceptionState.h" 11 #include "bindings/core/v8/BooleanOrStringOrUnrestrictedDouble.h"
12 #include "bindings/core/v8/V8Binding.h" 12 #include "bindings/core/v8/DoubleOrString.h"
13 #include "platform/heap/Handle.h" 13 #include "bindings/core/v8/NodeOrNodeList.h"
14 14 #include "bindings/core/v8/StringOrArrayBufferOrArrayBufferView.h"
15 namespace blink { 15 #include "bindings/core/v8/StringOrDouble.h"
16 16 #include "bindings/core/v8/StringOrStringSequence.h"
17 class DOMUint8Array; 17 #include "bindings/core/v8/TestEnumOrDouble.h"
18 class Node; 18 #include "bindings/core/v8/TestInterface2OrUint8Array.h"
19 class NodeList; 19 #include "bindings/core/v8/TestInterfaceGarbageCollectedOrString.h"
20 class TestArrayBuffer; 20 #include "bindings/core/v8/TestInterfaceOrLong.h"
21 class TestArrayBufferView; 21 #include "bindings/core/v8/TestInterfaceOrTestInterfaceEmpty.h"
22 class TestDictionary; 22 #include "bindings/core/v8/TestInterfaceWillBeGarbageCollectedOrTestDictionary.h "
23 class TestInterface2; 23 #include "bindings/core/v8/UnrestrictedDoubleOrString.h"
24 class TestInterfaceEmpty;
25 class TestInterfaceGarbageCollected;
26 class TestInterfaceImplementation;
27 class TestInterfaceWillBeGarbageCollected;
28
29 class ArrayBufferOrArrayBufferViewOrDictionary final {
30 ALLOW_ONLY_INLINE_ALLOCATION();
31 public:
32 ArrayBufferOrArrayBufferViewOrDictionary();
33 bool isNull() const { return m_type == SpecificTypeNone; }
34
35 bool isArrayBuffer() const { return m_type == SpecificTypeArrayBuffer; }
36 PassRefPtr<TestArrayBuffer> getAsArrayBuffer() const;
37 void setArrayBuffer(PassRefPtr<TestArrayBuffer>);
38 static ArrayBufferOrArrayBufferViewOrDictionary fromArrayBuffer(PassRefPtr<T estArrayBuffer>);
39
40 bool isArrayBufferView() const { return m_type == SpecificTypeArrayBufferVie w; }
41 PassRefPtr<TestArrayBufferView> getAsArrayBufferView() const;
42 void setArrayBufferView(PassRefPtr<TestArrayBufferView>);
43 static ArrayBufferOrArrayBufferViewOrDictionary fromArrayBufferView(PassRefP tr<TestArrayBufferView>);
44
45 bool isDictionary() const { return m_type == SpecificTypeDictionary; }
46 Dictionary getAsDictionary() const;
47 void setDictionary(Dictionary);
48 static ArrayBufferOrArrayBufferViewOrDictionary fromDictionary(Dictionary);
49
50 private:
51 enum SpecificTypes {
52 SpecificTypeNone,
53 SpecificTypeArrayBuffer,
54 SpecificTypeArrayBufferView,
55 SpecificTypeDictionary,
56 };
57 SpecificTypes m_type;
58
59 RefPtr<TestArrayBuffer> m_arrayBuffer;
60 RefPtr<TestArrayBufferView> m_arrayBufferView;
61 Dictionary m_dictionary;
62
63 friend v8::Local<v8::Value> toV8(const ArrayBufferOrArrayBufferViewOrDiction ary&, v8::Local<v8::Object>, v8::Isolate*);
64 };
65
66 class V8ArrayBufferOrArrayBufferViewOrDictionary final {
67 public:
68 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, ArrayBufferOrArrayBuf ferViewOrDictionary&, ExceptionState&);
69 };
70
71 v8::Local<v8::Value> toV8(const ArrayBufferOrArrayBufferViewOrDictionary&, v8::L ocal<v8::Object>, v8::Isolate*);
72
73 template <class CallbackInfo>
74 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ArrayBufferOrArra yBufferViewOrDictionary& impl)
75 {
76 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
77 }
78
79 template <>
80 struct NativeValueTraits<ArrayBufferOrArrayBufferViewOrDictionary> {
81 static ArrayBufferOrArrayBufferViewOrDictionary nativeValue(const v8::Local< v8::Value>&, v8::Isolate*, ExceptionState&);
82 };
83
84 class BooleanOrStringOrUnrestrictedDouble final {
85 ALLOW_ONLY_INLINE_ALLOCATION();
86 public:
87 BooleanOrStringOrUnrestrictedDouble();
88 bool isNull() const { return m_type == SpecificTypeNone; }
89
90 bool isBoolean() const { return m_type == SpecificTypeBoolean; }
91 bool getAsBoolean() const;
92 void setBoolean(bool);
93 static BooleanOrStringOrUnrestrictedDouble fromBoolean(bool);
94
95 bool isString() const { return m_type == SpecificTypeString; }
96 String getAsString() const;
97 void setString(String);
98 static BooleanOrStringOrUnrestrictedDouble fromString(String);
99
100 bool isUnrestrictedDouble() const { return m_type == SpecificTypeUnrestricte dDouble; }
101 double getAsUnrestrictedDouble() const;
102 void setUnrestrictedDouble(double);
103 static BooleanOrStringOrUnrestrictedDouble fromUnrestrictedDouble(double);
104
105 private:
106 enum SpecificTypes {
107 SpecificTypeNone,
108 SpecificTypeBoolean,
109 SpecificTypeString,
110 SpecificTypeUnrestrictedDouble,
111 };
112 SpecificTypes m_type;
113
114 bool m_boolean;
115 String m_string;
116 double m_unrestrictedDouble;
117
118 friend v8::Local<v8::Value> toV8(const BooleanOrStringOrUnrestrictedDouble&, v8::Local<v8::Object>, v8::Isolate*);
119 };
120
121 class V8BooleanOrStringOrUnrestrictedDouble final {
122 public:
123 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, BooleanOrStringOrUnre strictedDouble&, ExceptionState&);
124 };
125
126 v8::Local<v8::Value> toV8(const BooleanOrStringOrUnrestrictedDouble&, v8::Local< v8::Object>, v8::Isolate*);
127
128 template <class CallbackInfo>
129 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, BooleanOrStringOr UnrestrictedDouble& impl)
130 {
131 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
132 }
133
134 template <>
135 struct NativeValueTraits<BooleanOrStringOrUnrestrictedDouble> {
136 static BooleanOrStringOrUnrestrictedDouble nativeValue(const v8::Local<v8::V alue>&, v8::Isolate*, ExceptionState&);
137 };
138
139 class DoubleOrString final {
140 ALLOW_ONLY_INLINE_ALLOCATION();
141 public:
142 DoubleOrString();
143 bool isNull() const { return m_type == SpecificTypeNone; }
144
145 bool isDouble() const { return m_type == SpecificTypeDouble; }
146 double getAsDouble() const;
147 void setDouble(double);
148 static DoubleOrString fromDouble(double);
149
150 bool isString() const { return m_type == SpecificTypeString; }
151 String getAsString() const;
152 void setString(String);
153 static DoubleOrString fromString(String);
154
155 private:
156 enum SpecificTypes {
157 SpecificTypeNone,
158 SpecificTypeDouble,
159 SpecificTypeString,
160 };
161 SpecificTypes m_type;
162
163 double m_double;
164 String m_string;
165
166 friend v8::Local<v8::Value> toV8(const DoubleOrString&, v8::Local<v8::Object >, v8::Isolate*);
167 };
168
169 class V8DoubleOrString final {
170 public:
171 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, DoubleOrString&, Exce ptionState&);
172 };
173
174 v8::Local<v8::Value> toV8(const DoubleOrString&, v8::Local<v8::Object>, v8::Isol ate*);
175
176 template <class CallbackInfo>
177 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, DoubleOrString& i mpl)
178 {
179 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
180 }
181
182 template <>
183 struct NativeValueTraits<DoubleOrString> {
184 static DoubleOrString nativeValue(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
185 };
186
187 class NodeOrNodeList final {
188 ALLOW_ONLY_INLINE_ALLOCATION();
189 public:
190 NodeOrNodeList();
191 bool isNull() const { return m_type == SpecificTypeNone; }
192
193 bool isNode() const { return m_type == SpecificTypeNode; }
194 PassRefPtrWillBeRawPtr<Node> getAsNode() const;
195 void setNode(PassRefPtrWillBeRawPtr<Node>);
196 static NodeOrNodeList fromNode(PassRefPtrWillBeRawPtr<Node>);
197
198 bool isNodeList() const { return m_type == SpecificTypeNodeList; }
199 PassRefPtrWillBeRawPtr<NodeList> getAsNodeList() const;
200 void setNodeList(PassRefPtrWillBeRawPtr<NodeList>);
201 static NodeOrNodeList fromNodeList(PassRefPtrWillBeRawPtr<NodeList>);
202
203 DECLARE_TRACE();
204
205 private:
206 enum SpecificTypes {
207 SpecificTypeNone,
208 SpecificTypeNode,
209 SpecificTypeNodeList,
210 };
211 SpecificTypes m_type;
212
213 RefPtrWillBeMember<Node> m_node;
214 RefPtrWillBeMember<NodeList> m_nodeList;
215
216 friend v8::Local<v8::Value> toV8(const NodeOrNodeList&, v8::Local<v8::Object >, v8::Isolate*);
217 };
218
219 class V8NodeOrNodeList final {
220 public:
221 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, NodeOrNodeList&, Exce ptionState&);
222 };
223
224 v8::Local<v8::Value> toV8(const NodeOrNodeList&, v8::Local<v8::Object>, v8::Isol ate*);
225
226 template <class CallbackInfo>
227 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, NodeOrNodeList& i mpl)
228 {
229 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
230 }
231
232 template <>
233 struct NativeValueTraits<NodeOrNodeList> {
234 static NodeOrNodeList nativeValue(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
235 };
236
237 class StringOrArrayBufferOrArrayBufferView final {
238 ALLOW_ONLY_INLINE_ALLOCATION();
239 public:
240 StringOrArrayBufferOrArrayBufferView();
241 bool isNull() const { return m_type == SpecificTypeNone; }
242
243 bool isString() const { return m_type == SpecificTypeString; }
244 String getAsString() const;
245 void setString(String);
246 static StringOrArrayBufferOrArrayBufferView fromString(String);
247
248 bool isArrayBuffer() const { return m_type == SpecificTypeArrayBuffer; }
249 PassRefPtr<TestArrayBuffer> getAsArrayBuffer() const;
250 void setArrayBuffer(PassRefPtr<TestArrayBuffer>);
251 static StringOrArrayBufferOrArrayBufferView fromArrayBuffer(PassRefPtr<TestA rrayBuffer>);
252
253 bool isArrayBufferView() const { return m_type == SpecificTypeArrayBufferVie w; }
254 PassRefPtr<TestArrayBufferView> getAsArrayBufferView() const;
255 void setArrayBufferView(PassRefPtr<TestArrayBufferView>);
256 static StringOrArrayBufferOrArrayBufferView fromArrayBufferView(PassRefPtr<T estArrayBufferView>);
257
258 private:
259 enum SpecificTypes {
260 SpecificTypeNone,
261 SpecificTypeString,
262 SpecificTypeArrayBuffer,
263 SpecificTypeArrayBufferView,
264 };
265 SpecificTypes m_type;
266
267 String m_string;
268 RefPtr<TestArrayBuffer> m_arrayBuffer;
269 RefPtr<TestArrayBufferView> m_arrayBufferView;
270
271 friend v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView& , v8::Local<v8::Object>, v8::Isolate*);
272 };
273
274 class V8StringOrArrayBufferOrArrayBufferView final {
275 public:
276 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, StringOrArrayBufferOr ArrayBufferView&, ExceptionState&);
277 };
278
279 v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView&, v8::Local <v8::Object>, v8::Isolate*);
280
281 template <class CallbackInfo>
282 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, StringOrArrayBuff erOrArrayBufferView& impl)
283 {
284 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
285 }
286
287 template <>
288 struct NativeValueTraits<StringOrArrayBufferOrArrayBufferView> {
289 static StringOrArrayBufferOrArrayBufferView nativeValue(const v8::Local<v8:: Value>&, v8::Isolate*, ExceptionState&);
290 };
291
292 class StringOrDouble final {
293 ALLOW_ONLY_INLINE_ALLOCATION();
294 public:
295 StringOrDouble();
296 bool isNull() const { return m_type == SpecificTypeNone; }
297
298 bool isString() const { return m_type == SpecificTypeString; }
299 String getAsString() const;
300 void setString(String);
301 static StringOrDouble fromString(String);
302
303 bool isDouble() const { return m_type == SpecificTypeDouble; }
304 double getAsDouble() const;
305 void setDouble(double);
306 static StringOrDouble fromDouble(double);
307
308 private:
309 enum SpecificTypes {
310 SpecificTypeNone,
311 SpecificTypeString,
312 SpecificTypeDouble,
313 };
314 SpecificTypes m_type;
315
316 String m_string;
317 double m_double;
318
319 friend v8::Local<v8::Value> toV8(const StringOrDouble&, v8::Local<v8::Object >, v8::Isolate*);
320 };
321
322 class V8StringOrDouble final {
323 public:
324 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, StringOrDouble&, Exce ptionState&);
325 };
326
327 v8::Local<v8::Value> toV8(const StringOrDouble&, v8::Local<v8::Object>, v8::Isol ate*);
328
329 template <class CallbackInfo>
330 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, StringOrDouble& i mpl)
331 {
332 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
333 }
334
335 template <>
336 struct NativeValueTraits<StringOrDouble> {
337 static StringOrDouble nativeValue(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
338 };
339
340 class StringOrStringSequence final {
341 ALLOW_ONLY_INLINE_ALLOCATION();
342 public:
343 StringOrStringSequence();
344 bool isNull() const { return m_type == SpecificTypeNone; }
345
346 bool isString() const { return m_type == SpecificTypeString; }
347 String getAsString() const;
348 void setString(String);
349 static StringOrStringSequence fromString(String);
350
351 bool isStringSequence() const { return m_type == SpecificTypeStringSequence; }
352 const Vector<String>& getAsStringSequence() const;
353 void setStringSequence(const Vector<String>&);
354 static StringOrStringSequence fromStringSequence(const Vector<String>&);
355
356 private:
357 enum SpecificTypes {
358 SpecificTypeNone,
359 SpecificTypeString,
360 SpecificTypeStringSequence,
361 };
362 SpecificTypes m_type;
363
364 String m_string;
365 Vector<String> m_stringSequence;
366
367 friend v8::Local<v8::Value> toV8(const StringOrStringSequence&, v8::Local<v8 ::Object>, v8::Isolate*);
368 };
369
370 class V8StringOrStringSequence final {
371 public:
372 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, StringOrStringSequenc e&, ExceptionState&);
373 };
374
375 v8::Local<v8::Value> toV8(const StringOrStringSequence&, v8::Local<v8::Object>, v8::Isolate*);
376
377 template <class CallbackInfo>
378 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, StringOrStringSeq uence& impl)
379 {
380 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
381 }
382
383 template <>
384 struct NativeValueTraits<StringOrStringSequence> {
385 static StringOrStringSequence nativeValue(const v8::Local<v8::Value>&, v8::I solate*, ExceptionState&);
386 };
387
388 class TestEnumOrDouble final {
389 ALLOW_ONLY_INLINE_ALLOCATION();
390 public:
391 TestEnumOrDouble();
392 bool isNull() const { return m_type == SpecificTypeNone; }
393
394 bool isTestEnum() const { return m_type == SpecificTypeTestEnum; }
395 String getAsTestEnum() const;
396 void setTestEnum(String);
397 static TestEnumOrDouble fromTestEnum(String);
398
399 bool isDouble() const { return m_type == SpecificTypeDouble; }
400 double getAsDouble() const;
401 void setDouble(double);
402 static TestEnumOrDouble fromDouble(double);
403
404 private:
405 enum SpecificTypes {
406 SpecificTypeNone,
407 SpecificTypeTestEnum,
408 SpecificTypeDouble,
409 };
410 SpecificTypes m_type;
411
412 String m_testEnum;
413 double m_double;
414
415 friend v8::Local<v8::Value> toV8(const TestEnumOrDouble&, v8::Local<v8::Obje ct>, v8::Isolate*);
416 };
417
418 class V8TestEnumOrDouble final {
419 public:
420 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestEnumOrDouble&, Ex ceptionState&);
421 };
422
423 v8::Local<v8::Value> toV8(const TestEnumOrDouble&, v8::Local<v8::Object>, v8::Is olate*);
424
425 template <class CallbackInfo>
426 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestEnumOrDouble& impl)
427 {
428 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
429 }
430
431 template <>
432 struct NativeValueTraits<TestEnumOrDouble> {
433 static TestEnumOrDouble nativeValue(const v8::Local<v8::Value>&, v8::Isolate *, ExceptionState&);
434 };
435
436 class TestInterface2OrUint8Array final {
437 ALLOW_ONLY_INLINE_ALLOCATION();
438 public:
439 TestInterface2OrUint8Array();
440 bool isNull() const { return m_type == SpecificTypeNone; }
441
442 bool isTestInterface2() const { return m_type == SpecificTypeTestInterface2; }
443 PassRefPtr<TestInterface2> getAsTestInterface2() const;
444 void setTestInterface2(PassRefPtr<TestInterface2>);
445 static TestInterface2OrUint8Array fromTestInterface2(PassRefPtr<TestInterfac e2>);
446
447 bool isUint8Array() const { return m_type == SpecificTypeUint8Array; }
448 PassRefPtr<DOMUint8Array> getAsUint8Array() const;
449 void setUint8Array(PassRefPtr<DOMUint8Array>);
450 static TestInterface2OrUint8Array fromUint8Array(PassRefPtr<DOMUint8Array>);
451
452 private:
453 enum SpecificTypes {
454 SpecificTypeNone,
455 SpecificTypeTestInterface2,
456 SpecificTypeUint8Array,
457 };
458 SpecificTypes m_type;
459
460 RefPtr<TestInterface2> m_testInterface2;
461 RefPtr<DOMUint8Array> m_uint8Array;
462
463 friend v8::Local<v8::Value> toV8(const TestInterface2OrUint8Array&, v8::Loca l<v8::Object>, v8::Isolate*);
464 };
465
466 class V8TestInterface2OrUint8Array final {
467 public:
468 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestInterface2OrUint8 Array&, ExceptionState&);
469 };
470
471 v8::Local<v8::Value> toV8(const TestInterface2OrUint8Array&, v8::Local<v8::Objec t>, v8::Isolate*);
472
473 template <class CallbackInfo>
474 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterface2OrU int8Array& impl)
475 {
476 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
477 }
478
479 template <>
480 struct NativeValueTraits<TestInterface2OrUint8Array> {
481 static TestInterface2OrUint8Array nativeValue(const v8::Local<v8::Value>&, v 8::Isolate*, ExceptionState&);
482 };
483
484 class TestInterfaceGarbageCollectedOrString final {
485 ALLOW_ONLY_INLINE_ALLOCATION();
486 public:
487 TestInterfaceGarbageCollectedOrString();
488 bool isNull() const { return m_type == SpecificTypeNone; }
489
490 bool isTestInterfaceGarbageCollected() const { return m_type == SpecificType TestInterfaceGarbageCollected; }
491 TestInterfaceGarbageCollected* getAsTestInterfaceGarbageCollected() const;
492 void setTestInterfaceGarbageCollected(TestInterfaceGarbageCollected*);
493 static TestInterfaceGarbageCollectedOrString fromTestInterfaceGarbageCollect ed(TestInterfaceGarbageCollected*);
494
495 bool isString() const { return m_type == SpecificTypeString; }
496 String getAsString() const;
497 void setString(String);
498 static TestInterfaceGarbageCollectedOrString fromString(String);
499
500 DECLARE_TRACE();
501
502 private:
503 enum SpecificTypes {
504 SpecificTypeNone,
505 SpecificTypeTestInterfaceGarbageCollected,
506 SpecificTypeString,
507 };
508 SpecificTypes m_type;
509
510 Member<TestInterfaceGarbageCollected> m_testInterfaceGarbageCollected;
511 String m_string;
512
513 friend v8::Local<v8::Value> toV8(const TestInterfaceGarbageCollectedOrString &, v8::Local<v8::Object>, v8::Isolate*);
514 };
515
516 class V8TestInterfaceGarbageCollectedOrString final {
517 public:
518 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestInterfaceGarbageC ollectedOrString&, ExceptionState&);
519 };
520
521 v8::Local<v8::Value> toV8(const TestInterfaceGarbageCollectedOrString&, v8::Loca l<v8::Object>, v8::Isolate*);
522
523 template <class CallbackInfo>
524 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceGarb ageCollectedOrString& impl)
525 {
526 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
527 }
528
529 template <>
530 struct NativeValueTraits<TestInterfaceGarbageCollectedOrString> {
531 static TestInterfaceGarbageCollectedOrString nativeValue(const v8::Local<v8: :Value>&, v8::Isolate*, ExceptionState&);
532 };
533
534 class TestInterfaceOrLong final {
535 ALLOW_ONLY_INLINE_ALLOCATION();
536 public:
537 TestInterfaceOrLong();
538 bool isNull() const { return m_type == SpecificTypeNone; }
539
540 bool isTestInterface() const { return m_type == SpecificTypeTestInterface; }
541 PassRefPtr<TestInterfaceImplementation> getAsTestInterface() const;
542 void setTestInterface(PassRefPtr<TestInterfaceImplementation>);
543 static TestInterfaceOrLong fromTestInterface(PassRefPtr<TestInterfaceImpleme ntation>);
544
545 bool isLong() const { return m_type == SpecificTypeLong; }
546 int getAsLong() const;
547 void setLong(int);
548 static TestInterfaceOrLong fromLong(int);
549
550 private:
551 enum SpecificTypes {
552 SpecificTypeNone,
553 SpecificTypeTestInterface,
554 SpecificTypeLong,
555 };
556 SpecificTypes m_type;
557
558 RefPtr<TestInterfaceImplementation> m_testInterface;
559 int m_long;
560
561 friend v8::Local<v8::Value> toV8(const TestInterfaceOrLong&, v8::Local<v8::O bject>, v8::Isolate*);
562 };
563
564 class V8TestInterfaceOrLong final {
565 public:
566 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestInterfaceOrLong&, ExceptionState&);
567 };
568
569 v8::Local<v8::Value> toV8(const TestInterfaceOrLong&, v8::Local<v8::Object>, v8: :Isolate*);
570
571 template <class CallbackInfo>
572 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceOrLo ng& impl)
573 {
574 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
575 }
576
577 template <>
578 struct NativeValueTraits<TestInterfaceOrLong> {
579 static TestInterfaceOrLong nativeValue(const v8::Local<v8::Value>&, v8::Isol ate*, ExceptionState&);
580 };
581
582 class TestInterfaceOrTestInterfaceEmpty final {
583 ALLOW_ONLY_INLINE_ALLOCATION();
584 public:
585 TestInterfaceOrTestInterfaceEmpty();
586 bool isNull() const { return m_type == SpecificTypeNone; }
587
588 bool isTestInterface() const { return m_type == SpecificTypeTestInterface; }
589 PassRefPtr<TestInterfaceImplementation> getAsTestInterface() const;
590 void setTestInterface(PassRefPtr<TestInterfaceImplementation>);
591 static TestInterfaceOrTestInterfaceEmpty fromTestInterface(PassRefPtr<TestIn terfaceImplementation>);
592
593 bool isTestInterfaceEmpty() const { return m_type == SpecificTypeTestInterfa ceEmpty; }
594 PassRefPtr<TestInterfaceEmpty> getAsTestInterfaceEmpty() const;
595 void setTestInterfaceEmpty(PassRefPtr<TestInterfaceEmpty>);
596 static TestInterfaceOrTestInterfaceEmpty fromTestInterfaceEmpty(PassRefPtr<T estInterfaceEmpty>);
597
598 private:
599 enum SpecificTypes {
600 SpecificTypeNone,
601 SpecificTypeTestInterface,
602 SpecificTypeTestInterfaceEmpty,
603 };
604 SpecificTypes m_type;
605
606 RefPtr<TestInterfaceImplementation> m_testInterface;
607 RefPtr<TestInterfaceEmpty> m_testInterfaceEmpty;
608
609 friend v8::Local<v8::Value> toV8(const TestInterfaceOrTestInterfaceEmpty&, v 8::Local<v8::Object>, v8::Isolate*);
610 };
611
612 class V8TestInterfaceOrTestInterfaceEmpty final {
613 public:
614 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestInterfaceOrTestIn terfaceEmpty&, ExceptionState&);
615 };
616
617 v8::Local<v8::Value> toV8(const TestInterfaceOrTestInterfaceEmpty&, v8::Local<v8 ::Object>, v8::Isolate*);
618
619 template <class CallbackInfo>
620 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceOrTe stInterfaceEmpty& impl)
621 {
622 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
623 }
624
625 template <>
626 struct NativeValueTraits<TestInterfaceOrTestInterfaceEmpty> {
627 static TestInterfaceOrTestInterfaceEmpty nativeValue(const v8::Local<v8::Val ue>&, v8::Isolate*, ExceptionState&);
628 };
629
630 class TestInterfaceWillBeGarbageCollectedOrTestDictionary final {
631 ALLOW_ONLY_INLINE_ALLOCATION();
632 public:
633 TestInterfaceWillBeGarbageCollectedOrTestDictionary();
634 bool isNull() const { return m_type == SpecificTypeNone; }
635
636 bool isTestInterfaceWillBeGarbageCollected() const { return m_type == Specif icTypeTestInterfaceWillBeGarbageCollected; }
637 PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> getAsTestInterfa ceWillBeGarbageCollected() const;
638 void setTestInterfaceWillBeGarbageCollected(PassRefPtrWillBeRawPtr<TestInter faceWillBeGarbageCollected>);
639 static TestInterfaceWillBeGarbageCollectedOrTestDictionary fromTestInterface WillBeGarbageCollected(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollecte d>);
640
641 bool isTestDictionary() const { return m_type == SpecificTypeTestDictionary; }
642 TestDictionary getAsTestDictionary() const;
643 void setTestDictionary(TestDictionary);
644 static TestInterfaceWillBeGarbageCollectedOrTestDictionary fromTestDictionar y(TestDictionary);
645
646 DECLARE_TRACE();
647
648 private:
649 enum SpecificTypes {
650 SpecificTypeNone,
651 SpecificTypeTestInterfaceWillBeGarbageCollected,
652 SpecificTypeTestDictionary,
653 };
654 SpecificTypes m_type;
655
656 RefPtrWillBeMember<TestInterfaceWillBeGarbageCollected> m_testInterfaceWillB eGarbageCollected;
657 TestDictionary m_testDictionary;
658
659 friend v8::Local<v8::Value> toV8(const TestInterfaceWillBeGarbageCollectedOr TestDictionary&, v8::Local<v8::Object>, v8::Isolate*);
660 };
661
662 class V8TestInterfaceWillBeGarbageCollectedOrTestDictionary final {
663 public:
664 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestInterfaceWillBeGa rbageCollectedOrTestDictionary&, ExceptionState&);
665 };
666
667 v8::Local<v8::Value> toV8(const TestInterfaceWillBeGarbageCollectedOrTestDiction ary&, v8::Local<v8::Object>, v8::Isolate*);
668
669 template <class CallbackInfo>
670 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceWill BeGarbageCollectedOrTestDictionary& impl)
671 {
672 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
673 }
674
675 template <>
676 struct NativeValueTraits<TestInterfaceWillBeGarbageCollectedOrTestDictionary> {
677 static TestInterfaceWillBeGarbageCollectedOrTestDictionary nativeValue(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
678 };
679
680 class UnrestrictedDoubleOrString final {
681 ALLOW_ONLY_INLINE_ALLOCATION();
682 public:
683 UnrestrictedDoubleOrString();
684 bool isNull() const { return m_type == SpecificTypeNone; }
685
686 bool isUnrestrictedDouble() const { return m_type == SpecificTypeUnrestricte dDouble; }
687 double getAsUnrestrictedDouble() const;
688 void setUnrestrictedDouble(double);
689 static UnrestrictedDoubleOrString fromUnrestrictedDouble(double);
690
691 bool isString() const { return m_type == SpecificTypeString; }
692 String getAsString() const;
693 void setString(String);
694 static UnrestrictedDoubleOrString fromString(String);
695
696 private:
697 enum SpecificTypes {
698 SpecificTypeNone,
699 SpecificTypeUnrestrictedDouble,
700 SpecificTypeString,
701 };
702 SpecificTypes m_type;
703
704 double m_unrestrictedDouble;
705 String m_string;
706
707 friend v8::Local<v8::Value> toV8(const UnrestrictedDoubleOrString&, v8::Loca l<v8::Object>, v8::Isolate*);
708 };
709
710 class V8UnrestrictedDoubleOrString final {
711 public:
712 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, UnrestrictedDoubleOrS tring&, ExceptionState&);
713 };
714
715 v8::Local<v8::Value> toV8(const UnrestrictedDoubleOrString&, v8::Local<v8::Objec t>, v8::Isolate*);
716
717 template <class CallbackInfo>
718 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, UnrestrictedDoubl eOrString& impl)
719 {
720 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
721 }
722
723 template <>
724 struct NativeValueTraits<UnrestrictedDoubleOrString> {
725 static UnrestrictedDoubleOrString nativeValue(const v8::Local<v8::Value>&, v 8::Isolate*, ExceptionState&);
726 };
727
728 class V8DoubleOrStringOrNull final {
729 public:
730 static void toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, Doubl eOrString& impl, ExceptionState& exceptionState)
731 {
732 if (isUndefinedOrNull(v8Value))
733 return;
734 V8DoubleOrString::toImpl(isolate, v8Value, impl, exceptionState);
735 }
736 };
737
738 } // namespace blink
739 24
740 #endif // UnionTypeCore_h 25 #endif // UnionTypeCore_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698