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

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

Issue 2611823003: ABANDONED CL: Changes to compile and pass tests after Big Blink Rename (excluding functions). (Closed)
Patch Set: Inducing merge conflicts to force human review and changes after rename. Created 3 years, 11 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 {% filter format_blink_cpp_source_code %} 1 {% filter format_blink_cpp_source_code %}
2 2
3 {% include 'copyright_block.txt' %} 3 {% include 'copyright_block.txt' %}
4 #include "{{v8_class_or_partial}}.h" 4 #include "{{v8_class_or_partial}}.h"
5 5
6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
7 #include "{{filename}}" 7 #include "{{filename}}"
8 {% endfor %} 8 {% endfor %}
9 9
10 namespace blink { 10 namespace blink {
11 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie w else '0' %} 11 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie w else '0' %}
12 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class 12 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class
13 if has_visit_dom_wrapper else '0' %} 13 if has_visit_dom_wrapper else '0' %}
14 {% set has_prepare_prototype_and_interface_object = 14 {% set has_prepare_prototype_and_interface_object =
15 unscopables or has_conditional_attributes_on_prototype or 15 unscopables or has_conditional_attributes_on_prototype or
16 methods | conditionally_exposed(is_partial) %} 16 methods | conditionally_exposed(is_partial) %}
17 {% set prepare_prototype_and_interface_object_func = 17 {% set prepare_prototype_and_interface_object_func =
18 '%s::preparePrototypeAndInterfaceObject' % v8_class 18 '%s::preparePrototypeAndInterfaceObject' % v8_class
19 if has_prepare_prototype_and_interface_object 19 if has_prepare_prototype_and_interface_object
20 else 'nullptr' %} 20 else 'nullptr' %}
21 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface 21 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface
22 if parent_interface else '0' %} 22 if parent_interface else '0' %}
23 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else 23 {% set wrapper_type_prototype = 'kWrapperTypeExceptionPrototype' if is_exception else
24 'WrapperTypeObjectPrototype' %} 24 'kWrapperTypeObjectPrototype' %}
25 {% set active_scriptwrappable_inheritance = 25 {% set active_scriptwrappable_inheritance =
26 'InheritFromActiveScriptWrappable' 26 'kInheritFromActiveScriptWrappable'
27 if active_scriptwrappable else 27 if active_scriptwrappable else
28 'NotInheritFromActiveScriptWrappable' %} 28 'kNotInheritFromActiveScriptWrappable' %}
29 29
30 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} 30 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %}
31 {% if not is_partial %} 31 {% if not is_partial %}
32 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 32 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
33 // and does not depend on another global objects. 33 // and does not depend on another global objects.
34 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 34 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
35 #pragma clang diagnostic push 35 #pragma clang diagnostic push
36 #pragma clang diagnostic ignored "-Wglobal-constructors" 36 #pragma clang diagnostic ignored "-Wglobal-constructors"
37 #endif 37 #endif
38 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin ::kEmbedderBlink, {{dom_template}}, {{v8_class}}::trace, {{v8_class}}::traceWrap pers, {{visit_dom_wrapper}}, {{prepare_prototype_and_interface_object_func}}, "{ {interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_typ e_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{active_ scriptwrappable_inheritance}}, WrapperTypeInfo::{{event_target_inheritance}}, Wr apperTypeInfo::{{lifetime}} }; 38 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin ::kEmbedderBlink, {{dom_template}}, {{v8_class}}::trace, {{v8_class}}::traceWrap pers, {{visit_dom_wrapper}}, {{prepare_prototype_and_interface_object_func}}, "{ {interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_typ e_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{active_ scriptwrappable_inheritance}}, WrapperTypeInfo::{{event_target_inheritance}}, Wr apperTypeInfo::{{lifetime}} };
39 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 39 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
40 #pragma clang diagnostic pop 40 #pragma clang diagnostic pop
41 #endif 41 #endif
42 42
43 {% if not is_typed_array_type %} 43 {% if not is_typed_array_type %}
44 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. 44 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h.
45 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in 45 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
46 // bindings/core/v8/ScriptWrappable.h. 46 // bindings/core/v8/ScriptWrappable.h.
47 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo; 47 const WrapperTypeInfo& {{cpp_class}}::wrapper_type_info_ = {{v8_class}}::wrapper TypeInfo;
48 {% endif %} 48 {% endif %}
49 49
50 {% if active_scriptwrappable %} 50 {% if active_scriptwrappable %}
51 // [ActiveScriptWrappable] 51 // [ActiveScriptWrappable]
52 static_assert( 52 static_assert(
53 std::is_base_of<ActiveScriptWrappableBase, {{cpp_class}}>::value, 53 std::is_base_of<ActiveScriptWrappableBase, {{cpp_class}}>::value,
54 "{{cpp_class}} does not inherit from ActiveScriptWrappable<>, but specifying " 54 "{{cpp_class}} does not inherit from ActiveScriptWrappable<>, but specifying "
55 "[ActiveScriptWrappable] extended attribute in the IDL file. " 55 "[ActiveScriptWrappable] extended attribute in the IDL file. "
56 "Be consistent."); 56 "Be consistent.");
57 static_assert( 57 static_assert(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 {% block security_check_functions %} 190 {% block security_check_functions %}
191 {% if has_access_check_callbacks and not is_partial %} 191 {% if has_access_check_callbacks and not is_partial %}
192 bool securityCheck(v8::Local<v8::Context> accessingContext, v8::Local<v8::Object > accessedObject, v8::Local<v8::Value> data) { 192 bool securityCheck(v8::Local<v8::Context> accessingContext, v8::Local<v8::Object > accessedObject, v8::Local<v8::Value> data) {
193 {% if interface_name == 'Window' %} 193 {% if interface_name == 'Window' %}
194 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 194 v8::Isolate* isolate = v8::Isolate::GetCurrent();
195 v8::Local<v8::Object> window = V8Window::findInstanceInPrototypeChain(accessed Object, isolate); 195 v8::Local<v8::Object> window = V8Window::findInstanceInPrototypeChain(accessed Object, isolate);
196 if (window.IsEmpty()) 196 if (window.IsEmpty())
197 return false; // the frame is gone. 197 return false; // the frame is gone.
198 198
199 const DOMWindow* targetWindow = V8Window::toImpl(window); 199 const DOMWindow* targetWindow = V8Window::toImpl(window);
200 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces singContext)), targetWindow, BindingSecurity::ErrorReportOption::DoNotReport); 200 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces singContext)), targetWindow, BindingSecurity::ErrorReportOption::kDoNotReport);
201 {% else %}{# if interface_name == 'Window' #} 201 {% else %}{# if interface_name == 'Window' #}
202 {# Not 'Window' means it\'s Location. #} 202 {# Not 'Window' means it\'s Location. #}
203 {{cpp_class}}* impl = {{v8_class}}::toImpl(accessedObject); 203 {{cpp_class}}* impl = {{v8_class}}::toImpl(accessedObject);
204 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces singContext)), impl, BindingSecurity::ErrorReportOption::DoNotReport); 204 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces singContext)), impl, BindingSecurity::ErrorReportOption::kDoNotReport);
205 {% endif %}{# if interface_name == 'Window' #} 205 {% endif %}{# if interface_name == 'Window' #}
206 } 206 }
207 207
208 {% if has_cross_origin_named_enumerator %} 208 {% if has_cross_origin_named_enumerator %}
209 static const struct { 209 static const struct {
210 using GetterCallback = void(*)(const v8::PropertyCallbackInfo<v8::Value>&); 210 using GetterCallback = void(*)(const v8::PropertyCallbackInfo<v8::Value>&);
211 using SetterCallback = void(*)(v8::Local<v8::Value>, const V8CrossOriginSetter Info&); 211 using SetterCallback = void(*)(v8::Local<v8::Value>, const V8CrossOriginSetter Info&);
212 212
213 const char* const name; 213 const char* const name;
214 const GetterCallback getter; 214 const GetterCallback getter;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // Initialize the interface object's template. 392 // Initialize the interface object's template.
393 {% if is_partial %} 393 {% if is_partial %}
394 {{v8_class}}::install{{v8_class}}Template(isolate, world, interfaceTemplate); 394 {{v8_class}}::install{{v8_class}}Template(isolate, world, interfaceTemplate);
395 {% else %} 395 {% else %}
396 {% set parent_interface_template = 396 {% set parent_interface_template =
397 '%s::domTemplateForNamedPropertiesObject(isolate, world)' % v8_class 397 '%s::domTemplateForNamedPropertiesObject(isolate, world)' % v8_class
398 if has_named_properties_object else 398 if has_named_properties_object else
399 'V8%s::domTemplate(isolate, world)' % parent_interface 399 'V8%s::domTemplate(isolate, world)' % parent_interface
400 if parent_interface else 400 if parent_interface else
401 'v8::Local<v8::FunctionTemplate>()' %} 401 'v8::Local<v8::FunctionTemplate>()' %}
402 V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, {{v8_class}}::wrapperTypeInfo.interfaceName, {{parent_interface_template}}, {{v 8_class}}::internalFieldCount); 402 V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, {{v8_class}}::wrapperTypeInfo.interface_name, {{parent_interface_template}}, {{ v8_class}}::internalFieldCount);
403 {% if constructors or has_custom_constructor or has_event_constructor or has_h tml_constructor %} 403 {% if constructors or has_custom_constructor or has_event_constructor or has_h tml_constructor %}
404 interfaceTemplate->SetCallHandler({{v8_class}}::constructorCallback); 404 interfaceTemplate->SetCallHandler({{v8_class}}::constructorCallback);
405 interfaceTemplate->SetLength({{interface_length}}); 405 interfaceTemplate->SetLength({{interface_length}});
406 {% endif %} 406 {% endif %}
407 {% endif %}{# is_partial #} 407 {% endif %}{# is_partial #}
408 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late); 408 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp late);
409 ALLOW_UNUSED_LOCAL(signature); 409 ALLOW_UNUSED_LOCAL(signature);
410 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTe mplate(); 410 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTe mplate();
411 ALLOW_UNUSED_LOCAL(instanceTemplate); 411 ALLOW_UNUSED_LOCAL(instanceTemplate);
412 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototype Template(); 412 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototype Template();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 479
480 {% if has_array_iterator and not is_partial %} 480 {% if has_array_iterator and not is_partial %}
481 // Array iterator (@@iterator) 481 // Array iterator (@@iterator)
482 {%+ if is_global %}instanceTemplate{% else %}prototypeTemplate{% endif %}->Set IntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values, v8::DontEnum); 482 {%+ if is_global %}instanceTemplate{% else %}prototypeTemplate{% endif %}->Set IntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values, v8::DontEnum);
483 {% endif %} 483 {% endif %}
484 484
485 {% if iterator_method %} 485 {% if iterator_method %}
486 {% filter exposed(iterator_method.exposed_test) %} 486 {% filter exposed(iterator_method.exposed_test) %}
487 {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %} 487 {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %}
488 // Iterator (@@iterator) 488 // Iterator (@@iterator)
489 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorCo nfiguration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::ite ratorMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::OnPrototype }; 489 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorCo nfiguration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::ite ratorMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::kOnPrototype };
490 V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature , symbolKeyedIteratorConfiguration); 490 V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature , symbolKeyedIteratorConfiguration);
491 {% endfilter %} 491 {% endfilter %}
492 {% endfilter %} 492 {% endfilter %}
493 {% endif %} 493 {% endif %}
494 494
495 {% if legacy_caller and not is_partial %} 495 {% if legacy_caller and not is_partial %}
496 instanceTemplate->SetCallAsFunctionHandler({{cpp_class_or_partial}}V8Internal: :{{legacy_caller.name}}MethodCallback); 496 instanceTemplate->SetCallAsFunctionHandler({{cpp_class_or_partial}}V8Internal: :{{legacy_caller.name}}MethodCallback);
497 {% elif has_custom_legacy_call_as_function and not is_partial %} 497 {% elif has_custom_legacy_call_as_function and not is_partial %}
498 instanceTemplate->SetCallAsFunctionHandler({{v8_class}}::legacyCallCustom); 498 instanceTemplate->SetCallAsFunctionHandler({{v8_class}}::legacyCallCustom);
499 {% endif %} 499 {% endif %}
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 {% block has_instance %}{% endblock %} 584 {% block has_instance %}{% endblock %}
585 {% block to_impl %}{% endblock %} 585 {% block to_impl %}{% endblock %}
586 {% block to_impl_with_type_check %}{% endblock %} 586 {% block to_impl_with_type_check %}{% endblock %}
587 {##############################################################################} 587 {##############################################################################}
588 {% block prepare_prototype_and_interface_object %}{% endblock %} 588 {% block prepare_prototype_and_interface_object %}{% endblock %}
589 {##############################################################################} 589 {##############################################################################}
590 {% block partial_interface %}{% endblock %} 590 {% block partial_interface %}{% endblock %}
591 } // namespace blink 591 } // namespace blink
592 592
593 {% endfilter %}{# format_blink_cpp_source_code #} 593 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698