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

Side by Side Diff: Source/bindings/scripts/header.template

Issue 17572008: WIP IDL compiler rewrite (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: non-callback headers working Created 7 years, 6 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 #ifndef {{v8_class_name}}_h
22 #define {{v8_class_name}}_h
23
24 {{conditional_if}}
25 {% for filename in includes -%}
26 #include "{{filename}}"
27 {% endfor %}
28 namespace WebCore {
29
30 {% if is_constructor_template_of_event %}
31 class Dictionary;
32 {% endif %}
33
34 {% for definition in namespace_WebCore_definitions -%}
35 {{definition | indent(4, true)}}
36 {% endfor %}
37
38 class {{v8_class_name}} {
39 public:
40 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e);
41 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*);
42 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType);
43 static {{impl_class_name}}* toNative(v8::Handle<v8::Object> object)
44 {
45 return reinterpret_cast<{{impl_class_name}}*>(object->GetAlignedPointerF romInternalField(v8DOMWrapperObjectIndex));
46 }
47 static void derefObject(void*);
48 static WrapperTypeInfo info;
49 {% if needs_opaque_root_for_gc %}
50 static void* opaqueRootForGC(void*, v8::Isolate*);
51 {% endif %}
52 {% if inherits_extended_attribute_active_dom_object %}
53 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
54 {% endif %}
55 {% if inherits_extended_attribute_event_target %}
56 static EventTarget* toEventTarget(v8::Handle<v8::Object>);
57 {% endif %}
58 {% for definition in operation_definitions -%}
59 {{definition | indent(4, true)}}
60 {% endfor %}
61 {% if is_constructable %}
62 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
63 {% endif %}
64 {% for definition in attribute_definitions -%}
65 {{definition | indent(4, true)}}
66 {% endfor %}
67
68 {% for definition in custom_internal_field_indices -%}
69 {{definition | indent(4, true)}}
70 {% endfor %}
71
72 static void installPerContextProperties(v8::Handle<v8::Object>, {{impl_class _name}}*, v8::Isolate*){{install_per_context_properties_body}}
73 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8: :Isolate*){{install_per_context_prototype_properties_body}}
74
75 private:
76 {% if wrap %}
77 friend v8::Handle<v8::Object> wrap({{impl_class_name}}*, v8::Handle<v8::Obje ct> creationContext, v8::Isolate*);
78 static v8::Handle<v8::Object> createWrapper({{impl_class_name_as_parameter}} , v8::Handle<v8::Object> creationContext, v8::Isolate*);
79 {% endif %}
80
81 };
82
83 template<>
84 class WrapperTypeTraits<{{impl_class_name}} > {
85 public:
86 static WrapperTypeInfo* info() { return &{{v8_class_name}}::info; }
87 };
88
89 {% if generate_to_v8 %}
90 class {{impl_class_name}};
91 v8::Handle<v8::Value> toV8({{impl_class_name}}*, v8::Handle<v8::Object> creation Context, v8::Isolate*);
92 v8::Handle<v8::Value> toV8ForMainWorld({{impl_class_name}}*, v8::Handle<v8::Obje ct> creationContext, v8::Isolate*);
93
94 template<class HolderContainer, class Wrappable>
95 inline v8::Handle<v8::Value> toV8Fast({{impl_class_name}}* impl, const HolderCon tainer& container, Wrappable*)
96 {
97 return toV8(impl, container.Holder(), container.GetIsolate());
98 }
99
100 template<class HolderContainer, class Wrappable>
101 inline v8::Handle<v8::Value> toV8FastForMainWorld({{impl_class_name}}* impl, con st HolderContainer& container, Wrappable*)
102 {
103 return toV8ForMainWorld(impl, container.Holder(), container.GetIsolate());
104 }
105 {% endif %}
106
107 {% if wrap %}
108 {% if custom_wrap %}
109 v8::Handle<v8::Object> wrap({{impl_class_name}}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate*);
110 {% else %}
111 inline v8::Handle<v8::Object> wrap({{impl_class_name}}* impl, v8::Handle<v8::Obj ect> creationContext, v8::Isolate* isolate)
112 {
113 ASSERT(impl);
114 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
115 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
116 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl);
117 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have
118 // the same object de-ref functions, though, so use that as the basis of the check.
119 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == {{v8_class_name}}::info.derefObjectFunction);
120 }
121 return {{v8_class_name}}::{{ custom_wrap and "wrap" or "createWrapper" }}(im pl, creationContext, isolate);
122 }
123 {% endif %}
124 {% endif %}
125
126 {% if wrap %}
127 inline v8::Handle<v8::Value> toV8({{impl_class_name}}* impl, v8::Handle<v8::Obje ct> creationContext, v8::Isolate* isolate)
128 {
129 if (UNLIKELY(!impl))
130 return v8NullWithCheck(isolate);
131 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
132 if (!wrapper.IsEmpty())
133 return wrapper;
134 return wrap(impl, creationContext, isolate);
135 }
136
137 inline v8::Handle<v8::Value> toV8ForMainWorld({{impl_class_name}}* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate)
138 {
139 ASSERT(worldType(isolate) == MainWorld);
140 if (UNLIKELY(!impl))
141 return v8NullWithCheck(isolate);
142 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
143 if (!wrapper.IsEmpty())
144 return wrapper;
145 return wrap(impl, creationContext, isolate);
146 }
147
148 template<class HolderContainer, class Wrappable>
149 inline v8::Handle<v8::Value> toV8Fast({{impl_class_name}}* impl, const HolderCon tainer& container, Wrappable* wrappable)
150 {
151 if (UNLIKELY(!impl))
152 return v8Null(container.GetIsolate());
153 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe r, wrappable);
154 if (!wrapper.IsEmpty())
155 return wrapper;
156 return wrap(impl, container.Holder(), container.GetIsolate());
157 }
158
159 template<class HolderContainer, class Wrappable>
160 inline v8::Handle<v8::Value> toV8FastForMainWorld({{impl_class_name}}* impl, con st HolderContainer& container, Wrappable* wrappable)
161 {
162 ASSERT(worldType(container.GetIsolate()) == MainWorld);
163 if (UNLIKELY(!impl))
164 return v8Null(container.GetIsolate());
165 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
166 if (!wrapper.IsEmpty())
167 return wrapper;
168 return wrap(impl, container.Holder(), container.GetIsolate());
169 }
170
171 template<class HolderContainer, class Wrappable>
172 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< {{impl_class_name} } > impl, const HolderContainer& container, Wrappable* wrappable)
173 {
174 return toV8FastForMainWorld(impl.get(), container, wrappable);
175 }
176 {% endif %}
177
178
179 template<class HolderContainer, class Wrappable>
180 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< {{impl_class_name}} > impl, co nst HolderContainer& container, Wrappable* wrappable)
181 {
182 return toV8Fast(impl.get(), container, wrappable);
183 }
184
185 inline v8::Handle<v8::Value> toV8(PassRefPtr< {{impl_class_name}} > impl, v8::Ha ndle<v8::Object> creationContext, v8::Isolate* isolate)
186 {
187 return toV8(impl.get(), creationContext, isolate);
188 }
189
190 {% if is_constructor_template_of_event %}
191 bool fill{{impl_class_name}}Init({{impl_class_name}}Init&, const Dictionary&);
192 {% endif %}
193
194 }
195
196 {{conditional_endif}}
197
198 #endif // {{v8_class_name}}_h
199
200
OLDNEW
« no previous file with comments | « Source/bindings/scripts/generate_bindings.py ('k') | Source/bindings/scripts/implementation.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698