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

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

Issue 567503002: Add toDouble() helper, and use toFloat()/toDouble() for conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% block constructor_getter %} 5 {% block constructor_getter %}
6 {% if has_constructor_attributes %} 6 {% if has_constructor_attributes %}
7 static void {{cpp_class}}ConstructorGetter(v8::Local<v8::String>, const v8::Prop ertyCallbackInfo<v8::Value>& info) 7 static void {{cpp_class}}ConstructorGetter(v8::Local<v8::String>, const v8::Prop ertyCallbackInfo<v8::Value>& info)
8 { 8 {
9 v8::Handle<v8::Value> data = info.Data(); 9 v8::Handle<v8::Value> data = info.Data();
10 ASSERT(data->IsExternal()); 10 ASSERT(data->IsExternal());
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 {% set setter = named_property_setter %} 274 {% set setter = named_property_setter %}
275 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 275 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
276 { 276 {
277 {% if not is_override_builtins %} 277 {% if not is_override_builtins %}
278 if (info.Holder()->HasRealNamedProperty(name)) 278 if (info.Holder()->HasRealNamedProperty(name))
279 return; 279 return;
280 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 280 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
281 return; 281 return;
282 282
283 {% endif %} 283 {% endif %}
284 {% if setter.has_exception_state %}
Jens Widell 2014/09/11 09:40:54 Moved this since otherwise the |exceptionState| lo
285 v8::String::Utf8Value namedProperty(name);
286 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
287 {% endif %}
284 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 288 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
285 {# v8_value_to_local_cpp_value('DOMString', 'name', 'propertyName') #} 289 {# v8_value_to_local_cpp_value('DOMString', 'name', 'propertyName') #}
286 TOSTRING_VOID(V8StringResource<>, propertyName, name); 290 TOSTRING_VOID(V8StringResource<>, propertyName, name);
287 {{setter.v8_value_to_local_cpp_value}}; 291 {{setter.v8_value_to_local_cpp_value}};
288 {% if setter.has_exception_state %}
289 v8::String::Utf8Value namedProperty(name);
290 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
291 {% endif %}
292 {% set setter_name = setter.name or 'anonymousNamedSetter' %} 292 {% set setter_name = setter.name or 'anonymousNamedSetter' %}
293 {% set setter_arguments = 293 {% set setter_arguments =
294 ['propertyName', 'propertyValue', 'exceptionState'] 294 ['propertyName', 'propertyValue', 'exceptionState']
295 if setter.is_raises_exception else 295 if setter.is_raises_exception else
296 ['propertyName', 'propertyValue'] %} 296 ['propertyName', 'propertyValue'] %}
297 bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}}); 297 bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}});
298 {% if setter.is_raises_exception %} 298 {% if setter.is_raises_exception %}
299 if (exceptionState.throwIfNeeded()) 299 if (exceptionState.throwIfNeeded())
300 return; 300 return;
301 {% endif %} 301 {% endif %}
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 {% endif %} 1263 {% endif %}
1264 } 1264 }
1265 1265
1266 template<> 1266 template<>
1267 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1267 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1268 { 1268 {
1269 return toV8(impl, creationContext, isolate); 1269 return toV8(impl, creationContext, isolate);
1270 } 1270 }
1271 1271
1272 {% endblock %} 1272 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_types.py ('k') | Source/bindings/tests/results/core/V8TestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698