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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl

Issue 2717283002: [Bindings][Refactoring] Move logics of preparePrototypeAndInterfaceObject from .tmpl to .py (Closed)
Patch Set: Created 3 years, 9 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.tmpl' %} 1 {% extends 'interface_base.cpp.tmpl' %}
2 2
3 {% set has_prepare_prototype_and_interface_object =
4 unscopables or has_conditional_attributes_on_prototype or
5 methods | conditionally_exposed(is_partial) %}
6 {% set prepare_prototype_and_interface_object_func =
7 '%s::preparePrototypeAndInterfaceObject' % v8_class
8 if has_prepare_prototype_and_interface_object
9 else 'nullptr' %}
10
11
12 {##############################################################################} 3 {##############################################################################}
13 {% block indexed_property_getter %} 4 {% block indexed_property_getter %}
14 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 5 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
15 {% set getter = indexed_property_getter %} 6 {% set getter = indexed_property_getter %}
16 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) { 7 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) {
17 {% if getter.is_raises_exception %} 8 {% if getter.is_raises_exception %}
18 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGetter Context, "{{interface_name}}"); 9 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGetter Context, "{{interface_name}}");
19 {% endif %} 10 {% endif %}
20 11
21 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 12 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 {% set active_scriptwrappable_inheritance = 519 {% set active_scriptwrappable_inheritance =
529 'InheritFromActiveScriptWrappable' 520 'InheritFromActiveScriptWrappable'
530 if active_scriptwrappable else 521 if active_scriptwrappable else
531 'NotInheritFromActiveScriptWrappable' %} 522 'NotInheritFromActiveScriptWrappable' %}
532 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 523 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
533 // and does not depend on another global objects. 524 // and does not depend on another global objects.
534 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 525 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
535 #pragma clang diagnostic push 526 #pragma clang diagnostic push
536 #pragma clang diagnostic ignored "-Wglobal-constructors" 527 #pragma clang diagnostic ignored "-Wglobal-constructors"
537 #endif 528 #endif
538 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::trace, {{v8_class}}: :traceWrappers, {{prepare_prototype_and_interface_object_func}}, "{{interface_na me}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wrappe r_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, WrapperTy peInfo::{{lifetime}} }; 529 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::trace, {{v8_class}}: :traceWrappers, {{prepare_prototype_and_interface_object_func or 'nullptr'}}, "{ {interface_name}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeI nfo::{{wrapper_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance }}, WrapperTypeInfo::{{lifetime}} };
539 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 530 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
540 #pragma clang diagnostic pop 531 #pragma clang diagnostic pop
541 #endif 532 #endif
542 533
543 {{generate_constructor(named_constructor)}} 534 {{generate_constructor(named_constructor)}}
544 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate, const DOMWrapperWorld& world) { 535 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate, const DOMWrapperWorld& world) {
545 static int domTemplateKey; // This address is used for a key to look up the do m template. 536 static int domTemplateKey; // This address is used for a key to look up the do m template.
546 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 537 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
547 v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world, &d omTemplateKey); 538 v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world, &d omTemplateKey);
548 if (!result.IsEmpty()) 539 if (!result.IsEmpty())
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 } 883 }
893 884
894 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 885 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
895 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) { 886 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) {
896 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 887 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
897 } 888 }
898 889
899 {% endfor %} 890 {% endfor %}
900 {% endif %} 891 {% endif %}
901 {% endblock %} 892 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698