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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/core/NodeOrNodeList.h

Issue 1961883002: Generate separate files for union type containers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #ifndef NodeOrNodeList_h
8 #define NodeOrNodeList_h
9
10 #include "bindings/core/v8/Dictionary.h"
11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/V8Binding.h"
13 #include "core/CoreExport.h"
14 #include "platform/heap/Handle.h"
15
16 namespace blink {
17
18 class Node;
19 class NodeList;
20
21 class CORE_EXPORT NodeOrNodeList final {
22 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
23 public:
24 NodeOrNodeList();
25 bool isNull() const { return m_type == SpecificTypeNone; }
26
27 bool isNode() const { return m_type == SpecificTypeNode; }
28 Node* getAsNode() const;
29 void setNode(Node*);
30 static NodeOrNodeList fromNode(Node*);
31
32 bool isNodeList() const { return m_type == SpecificTypeNodeList; }
33 NodeList* getAsNodeList() const;
34 void setNodeList(NodeList*);
35 static NodeOrNodeList fromNodeList(NodeList*);
36
37 NodeOrNodeList(const NodeOrNodeList&);
38 ~NodeOrNodeList();
39 NodeOrNodeList& operator=(const NodeOrNodeList&);
40 DECLARE_TRACE();
41
42 private:
43 enum SpecificTypes {
44 SpecificTypeNone,
45 SpecificTypeNode,
46 SpecificTypeNodeList,
47 };
48 SpecificTypes m_type;
49
50 Member<Node> m_node;
51 Member<NodeList> m_nodeList;
52
53 friend CORE_EXPORT v8::Local<v8::Value> toV8(const NodeOrNodeList&, v8::Loca l<v8::Object>, v8::Isolate*);
54 };
55
56 class V8NodeOrNodeList final {
57 public:
58 CORE_EXPORT static void toImpl(v8::Isolate*, v8::Local<v8::Value>, NodeOrNod eList&, UnionTypeConversionMode, ExceptionState&);
59 };
60
61 CORE_EXPORT v8::Local<v8::Value> toV8(const NodeOrNodeList&, v8::Local<v8::Objec t>, v8::Isolate*);
62
63 template <class CallbackInfo>
64 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, NodeOrNodeList& i mpl)
65 {
66 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
67 }
68
69 template <>
70 struct NativeValueTraits<NodeOrNodeList> {
71 CORE_EXPORT static NodeOrNodeList nativeValue(v8::Isolate*, v8::Local<v8::Va lue>, ExceptionState&);
72 };
73
74 } // namespace blink
75
76 // We need to set canInitializeWithMemset=true because HeapVector supports
77 // items that can initialize with memset or have a vtable. It is safe to
78 // set canInitializeWithMemset=true for a union type object in practice.
79 // See https://codereview.chromium.org/1118993002/#msg5 for more details.
80 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::NodeOrNodeList);
81
82 #endif // NodeOrNodeList_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698