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

Side by Side Diff: Source/bindings/templates/interface.h

Issue 531183003: bindings: Retires manual dispatching in createV8{HTML,SVG}Wrapper, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added FIXME comments. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/modules/v8/custom/custom.gypi ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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}}. DO NOT MODIFY! 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6 6
7 #ifndef {{v8_class}}_h 7 #ifndef {{v8_class}}_h
8 #define {{v8_class}}_h 8 #define {{v8_class}}_h
9 9
10 {% filter conditional(conditional_string) %} 10 {% filter conditional(conditional_string) %}
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 {% if interface_name == 'Window' %} 160 {% if interface_name == 'Window' %}
161 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v 8::Value> key, v8::AccessType, v8::Local<v8::Value> data); 161 static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v 8::Value> key, v8::AccessType, v8::Local<v8::Value> data);
162 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data); 162 static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data);
163 {% endif %} 163 {% endif %}
164 static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8 ::Isolate*){% if has_conditional_attributes %}; 164 static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8 ::Isolate*){% if has_conditional_attributes %};
165 {% else %} { } 165 {% else %} { }
166 {% endif %} 166 {% endif %}
167 static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::I solate*){% if conditionally_enabled_methods %}; 167 static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::I solate*){% if conditionally_enabled_methods %};
168 {% else %} { } 168 {% else %} { }
169 {% endif %} 169 {% endif %}
170 {# Element wrappers #}
171 {% if interface_name == 'HTMLElement' %}
172 friend v8::Handle<v8::Object> createV8HTMLWrapper(HTMLElement*, v8::Handle<v 8::Object> creationContext, v8::Isolate*);
173 friend v8::Handle<v8::Object> createV8HTMLDirectWrapper(HTMLElement*, v8::Ha ndle<v8::Object> creationContext, v8::Isolate*);
174 {% elif interface_name == 'SVGElement' %}
175 friend v8::Handle<v8::Object> createV8SVGWrapper(SVGElement*, v8::Handle<v8: :Object> creationContext, v8::Isolate*);
176 friend v8::Handle<v8::Object> createV8SVGDirectWrapper(SVGElement*, v8::Hand le<v8::Object> creationContext, v8::Isolate*);
177 friend v8::Handle<v8::Object> createV8SVGFallbackWrapper(SVGElement*, v8::Ha ndle<v8::Object> creationContext, v8::Isolate*);
178 {% elif interface_name == 'HTMLUnknownElement' %}
179 friend v8::Handle<v8::Object> createV8HTMLFallbackWrapper(HTMLUnknownElement *, v8::Handle<v8::Object> creationContext, v8::Isolate*);
180 {% elif interface_name == 'Element' %}
181 // This is a performance optimization hack. See V8Element::wrap.
182 friend v8::Handle<v8::Object> wrap(Node*, v8::Handle<v8::Object> creationCon text, v8::Isolate*);
183 {% endif %}
184 170
185 private: 171 private:
186 {% if not has_custom_to_v8 %} 172 {% if not has_custom_to_v8 and not is_script_wrappable %}
187 friend v8::Handle<v8::Object> wrap({{cpp_class}}*, v8::Handle<v8::Object> cr eationContext, v8::Isolate*); 173 friend v8::Handle<v8::Object> wrap({{cpp_class}}*, v8::Handle<v8::Object> cr eationContext, v8::Isolate*);
188 static v8::Handle<v8::Object> createWrapper({{pass_cpp_type}}, v8::Handle<v8 ::Object> creationContext, v8::Isolate*); 174 static v8::Handle<v8::Object> createWrapper({{pass_cpp_type}}, v8::Handle<v8 ::Object> creationContext, v8::Isolate*);
189 {% endif %} 175 {% endif %}
190 }; 176 };
191 177
192 {% if has_custom_to_v8 %} 178 {% if has_custom_to_v8 %}
193 class {{cpp_class}}; 179 class {{cpp_class}};
194 v8::Handle<v8::Value> toV8({{cpp_class}}*, v8::Handle<v8::Object> creationContex t, v8::Isolate*); 180 v8::Handle<v8::Value> toV8({{cpp_class}}*, v8::Handle<v8::Object> creationContex t, v8::Isolate*);
195 181
196 template<class CallbackInfo> 182 template<class CallbackInfo>
197 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{cpp_class}}* im pl) 183 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{cpp_class}}* im pl)
198 { 184 {
199 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate())); 185 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
200 } 186 }
201 187
202 template<class CallbackInfo> 188 template<class CallbackInfo>
203 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{cpp _class}}* impl) 189 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{cpp _class}}* impl)
204 { 190 {
205 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn fo.GetIsolate())); 191 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn fo.GetIsolate()));
206 } 192 }
207 193
208 template<class CallbackInfo, class Wrappable> 194 template<class CallbackInfo, class Wrappable>
209 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, {{cpp_class}} * impl, Wrappable*) 195 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, {{cpp_class}} * impl, Wrappable*)
210 { 196 {
211 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn fo.GetIsolate())); 197 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn fo.GetIsolate()));
212 } 198 }
213 {% else %}{# has_custom_to_v8 #} 199 {% else %}{# has_custom_to_v8 #}
200 {% if is_script_wrappable %}
201 inline v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
202 {
203 return impl->wrap(creationContext, isolate);
204 }
205 {% else %}
214 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*); 206 v8::Handle<v8::Object> wrap({{cpp_class}}* impl, v8::Handle<v8::Object> creation Context, v8::Isolate*);
207 {% endif %}
215 208
216 inline v8::Handle<v8::Value> toV8({{cpp_class}}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 209 inline v8::Handle<v8::Value> toV8({{cpp_class}}* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
217 { 210 {
218 if (UNLIKELY(!impl)) 211 if (UNLIKELY(!impl))
219 return v8::Null(isolate); 212 return v8::Null(isolate);
220 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class}}>(impl, isolate); 213 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class}}>(impl, isolate);
221 if (!wrapper.IsEmpty()) 214 if (!wrapper.IsEmpty())
222 return wrapper; 215 return wrapper;
223 216
224 {% if is_script_wrappable %} 217 {% if is_script_wrappable %}
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); 285 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
293 } 286 }
294 287
295 {% if has_event_constructor %} 288 {% if has_event_constructor %}
296 bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionSta te&, const v8::FunctionCallbackInfo<v8::Value>& info, const String& = ""); 289 bool initialize{{cpp_class}}({{cpp_class}}Init&, const Dictionary&, ExceptionSta te&, const v8::FunctionCallbackInfo<v8::Value>& info, const String& = "");
297 290
298 {% endif %} 291 {% endif %}
299 } // namespace blink 292 } // namespace blink
300 {% endfilter %} 293 {% endfilter %}
301 #endif // {{v8_class}}_h 294 #endif // {{v8_class}}_h
OLDNEW
« no previous file with comments | « Source/bindings/modules/v8/custom/custom.gypi ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698