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

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

Issue 349523004: IDL: Generate all constructor callbacks with the same template macro (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix arity check Created 6 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
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 ('%sV8Internal::%sConstructorGetterCallback' % 10 ('%sV8Internal::%sConstructorGetterCallback' %
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 546 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
547 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, info); 547 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, info);
548 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 548 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
549 } 549 }
550 550
551 {% endif %} 551 {% endif %}
552 {% endblock %} 552 {% endblock %}
553 553
554 554
555 {##############################################################################} 555 {##############################################################################}
556 {% from 'methods.cpp' import named_constructor_callback with context %} 556 {% from 'methods.cpp' import generate_constructor with context %}
557 {% block named_constructor %} 557 {% block named_constructor %}
558 {% if named_constructor %} 558 {% if named_constructor %}
559 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class 559 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
560 if is_active_dom_object else '0' %} 560 if is_active_dom_object else '0' %}
561 {% set to_event_target = '%s::toEventTarget' % v8_class 561 {% set to_event_target = '%s::toEventTarget' % v8_class
562 if is_event_target else '0' %} 562 if is_event_target else '0' %}
563 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_ac tive_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installPerContextEnable dMethods, 0, WrapperTypeObjectPrototype, {{gc_type}} }; 563 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_ac tive_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installPerContextEnable dMethods, 0, WrapperTypeObjectPrototype, {{gc_type}} };
564 564
565 {{named_constructor_callback(named_constructor)}} 565 {{generate_constructor(named_constructor)}}
566 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat e* isolate) 566 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat e* isolate)
567 { 567 {
568 static int domTemplateKey; // This address is used for a key to look up the dom template. 568 static int domTemplateKey; // This address is used for a key to look up the dom template.
569 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 569 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
570 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey); 570 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey);
571 if (!result.IsEmpty()) 571 if (!result.IsEmpty())
572 return result; 572 return result;
573 573
574 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 574 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
575 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback) ; 575 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback) ;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 {% endif %} 1328 {% endif %}
1329 } 1329 }
1330 1330
1331 template<> 1331 template<>
1332 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1332 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1333 { 1333 {
1334 return toV8(impl, creationContext, isolate); 1334 return toV8(impl, creationContext, isolate);
1335 } 1335 }
1336 1336
1337 {% endblock %} 1337 {% endblock %}
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('j') | Source/bindings/templates/methods.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698