Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro attribute_getter(attribute, world_suffix) %} | 2 {% macro attribute_getter(attribute, world_suffix) %} |
| 3 {% filter conditional(attribute.conditional_string) %} | 3 {% filter conditional(attribute.conditional_string) %} |
| 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
| 5 {%- if attribute.is_expose_js_accessors %} | 5 {%- if attribute.is_expose_js_accessors %} |
| 6 const v8::FunctionCallbackInfo<v8::Value>& info | 6 const v8::FunctionCallbackInfo<v8::Value>& info |
| 7 {%- else %} | 7 {%- else %} |
| 8 const v8::PropertyCallbackInfo<v8::Value>& info | 8 const v8::PropertyCallbackInfo<v8::Value>& info |
| 9 {%- endif %}) | 9 {%- endif %}) |
| 10 { | 10 { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 {# Type checking for interface types (if interface not implemented, throw | 225 {# Type checking for interface types (if interface not implemented, throw |
| 226 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} | 226 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} |
| 227 if (!isUndefinedOrNull(jsValue) && !V8{{attribute.idl_type}}::hasInstance(js Value, info.GetIsolate())) { | 227 if (!isUndefinedOrNull(jsValue) && !V8{{attribute.idl_type}}::hasInstance(js Value, info.GetIsolate())) { |
| 228 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'."); | 228 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'."); |
| 229 exceptionState.throwIfNeeded(); | 229 exceptionState.throwIfNeeded(); |
| 230 return; | 230 return; |
| 231 } | 231 } |
| 232 {% endif %} | 232 {% endif %} |
| 233 {% if attribute.put_forwards %} | 233 {% if attribute.put_forwards %} |
| 234 {{cpp_class}}* proxyImp = {{v8_class}}::toNative(info.Holder()); | 234 {{cpp_class}}* proxyImp = {{v8_class}}::toNative(info.Holder()); |
| 235 {{attribute.idl_type}}* imp = WTF::getPtr(proxyImp->{{attribute.name}}()); | 235 RefPtr<{{attribute.idl_type}}> imp = WTF::getPtr(proxyImp->{{attribute.name} }()); |
| 236 if (!imp) | 236 if (!imp) |
| 237 return; | 237 return; |
| 238 {% elif not attribute.is_static %} | 238 {% elif not attribute.is_static %} |
| 239 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); | 239 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); |
| 240 {% endif %}{# imp #} | 240 {% endif %}{# imp #} |
| 241 {# FIXME: move ASSERT(imp) here. #} | 241 {# FIXME: move ASSERT(imp) here. #} |
| 242 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %} | 242 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %} |
| 243 if (!imp->document()) | 243 if (!imp->document()) |
| 244 return; | 244 return; |
| 245 {% endif %} | 245 {% endif %} |
| 246 {% if attribute.idl_type != 'EventHandler' %} | 246 {% if attribute.idl_type != 'EventHandler' %} |
| 247 {{attribute.v8_value_to_local_cpp_value}}; | 247 {{attribute.v8_value_to_local_cpp_value}}; |
|
jochen (gone - plz use gerrit)
2014/03/13 23:26:49
alternatively, we could just move this up, no?
Nils Barth (inactive)
2014/03/20 07:20:29
How would this help?
(Honest question; might be a
jochen (gone - plz use gerrit)
2014/03/20 07:42:13
this executes arbitrary javascript. Local variable
Nils Barth (inactive)
2014/03/24 05:06:09
Ok, so rearranging the generated code wouldn't hel
| |
| 248 {% elif not is_node %}{# EventHandler hack #} | 248 {% elif not is_node %}{# EventHandler hack #} |
| 249 {# FIXME: duplicate of below; remove #} | 249 {# FIXME: duplicate of below; remove #} |
| 250 {% if attribute.is_implemented_by and not attribute.is_static %} | 250 {% if attribute.is_implemented_by and not attribute.is_static %} |
| 251 ASSERT(imp); | 251 ASSERT(imp); |
| 252 {% endif %} | 252 {% endif %} |
| 253 moveEventListenerToNewWrapper(info.Holder(), {{attribute.event_handler_gette r_expression}}, jsValue, {{v8_class}}::eventListenerCacheIndex, info.GetIsolate( )); | 253 moveEventListenerToNewWrapper(info.Holder(), {{attribute.event_handler_gette r_expression}}, jsValue, {{v8_class}}::eventListenerCacheIndex, info.GetIsolate( )); |
| 254 {% endif %} | 254 {% endif %} |
| 255 {% if attribute.enum_validation_expression %} | 255 {% if attribute.enum_validation_expression %} |
| 256 {# Setter ignores invalid enum values: http://www.w3.org/TR/WebIDL/#idl-enum s #} | 256 {# Setter ignores invalid enum values: http://www.w3.org/TR/WebIDL/#idl-enum s #} |
| 257 String string = cppValue; | 257 String string = cppValue; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 {% endif %} | 315 {% endif %} |
| 316 {% if attribute.has_custom_setter %} | 316 {% if attribute.has_custom_setter %} |
| 317 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info); | 317 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info); |
| 318 {% else %} | 318 {% else %} |
| 319 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j sValue, info); | 319 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j sValue, info); |
| 320 {% endif %} | 320 {% endif %} |
| 321 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 321 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 322 } | 322 } |
| 323 {% endfilter %} | 323 {% endfilter %} |
| 324 {% endmacro %} | 324 {% endmacro %} |
| OLD | NEW |