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

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

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Rebase Created 3 years, 4 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
(Empty)
1 {% filter format_blink_cpp_source_code %}
2
3 {% include 'copyright_block.txt' %}
4
5 #include "bindings/modules/v8/{{class}}.h"
6
7 #include <cstdint>
8
9 {% for include_file in include_files %}
10 #include "{{include_file}}"
11 {% endfor %}
12
13 namespace blink {
14
15 intptr_t* {{class}}::GetTable() {
16 static intptr_t reference_table[] = {
17 {% for interface in interfaces %}
18 {% if not interface.is_array_buffer_or_view %}
19 {% set v8_class = interface.v8_name %}
20
21 {# Attributes #}
22 {%- for attribute in interface.attributes %}
23 {%- for world_suffix in attribute.world_suffixes %}
24 {% if not attribute.constructor_type %}
25 reinterpret_cast<intptr_t>({{v8_class}}::{{attribute.name}}AttributeGetterCa llback{{world_suffix}}),
26 {% elif attribute.needs_constructor_getter_callback %}
27 reinterpret_cast<intptr_t>({{v8_class}}::{{attribute.name}}ConstructorGetter Callback{{world_suffix}}),
28 {% elif attribute.is_named_constructor %}
29 reinterpret_cast<intptr_t>(V8{{attribute.constructor_type}}::NamedConstructo rAttributeGetter{{world_suffix}}),
30 {% endif %}
31 {% if attribute.has_setter %}
32 reinterpret_cast<intptr_t>({{v8_class}}::{{attribute.name}}AttributeSetterCa llback{{world_suffix}}),
33 {% endif %}
34 {%- endfor %}{# world_suffix #}
35 {%- endfor %}{# attributes #}
36
37 {# Methods / Operations #}
38 {% for method in interface.methods %}
39 {%- for world_suffix in method.world_suffixes %}
40 {% if not method.overload_index or method.overloads %}
41 {% if (method.overloads and method.overloads.visible and
42 (not method.overloads.has_partial_overloads or not interface.i s_partial)) or
43 (not method.overloads and method.visible) %}
44 {# TODO(bashi): Remove this 'if' condition when crbug.com/630986 is fixed. # }
45 {% if not interface.is_callback %}
46 reinterpret_cast<intptr_t>({{v8_class}}::{{method.name}}MethodCallback{{worl d_suffix}}),
47 {% endif %}
48 {% endif %}
49 {% endif %}{# overload(_index) #}
50 {% if method.is_cross_origin and method.visible %}
51 reinterpret_cast<intptr_t>({{v8_class}}::{{method.name}}OriginSafeMethodGett erCallback{{world_suffix}}),
52 {% endif%}
53 {% endfor %}
54 {% endfor %}{# method #}
55 {% if interface.has_origin_safe_method_setter %}
56 reinterpret_cast<intptr_t>({{v8_class}}::{{interface.name}}OriginSafeMethodS etterCallback),
57 {% endif %}
58 {% if interface.has_cross_origin_named_getter %}
59 reinterpret_cast<intptr_t>({{v8_class}}::crossOriginNamedGetter),
60 {% endif %}
61 {% if interface.has_cross_origin_named_setter %}
62 reinterpret_cast<intptr_t>({{v8_class}}::crossOriginNamedSetter),
63 {% endif %}
64 {% if interface.has_cross_origin_named_enumerator %}
65 reinterpret_cast<intptr_t>({{v8_class}}::crossOriginNamedEnumerator),
66 {% endif %}
67 {% if interface.has_cross_origin_indexed_getter %}
68 reinterpret_cast<intptr_t>({{v8_class}}::crossOriginIndexedGetter),
69 {% endif %}
70 {% if interface.has_security_check %}
71 reinterpret_cast<intptr_t>({{v8_class}}::securityCheck),
72 {% endif %}
73
74 {# Other properties #}
75 {% if interface.has_constructor_callback %}
76 reinterpret_cast<intptr_t>({{v8_class}}::constructorCallback),
77 {% endif %}
78 {% if interface.named_property_getter %}
79 reinterpret_cast<intptr_t>({{v8_class}}::namedPropertyGetterCallback),
80 {% endif %}
81 {%- if interface.named_property_setter %}
82 reinterpret_cast<intptr_t>({{v8_class}}::namedPropertySetterCallback),
83 {% endif %}
84 {%- if interface.named_property_deleter %}
85 reinterpret_cast<intptr_t>({{v8_class}}::namedPropertyDeleterCallback),
86 {% endif %}
87 {%- if interface.named_property_getter and interface.named_property_getter. is_enumerable %}
88 reinterpret_cast<intptr_t>({{v8_class}}::namedPropertyQueryCallback),
89 reinterpret_cast<intptr_t>({{v8_class}}::namedPropertyEnumeratorCallback),
90 {% endif %}
91 {%- if interface.indexed_property_getter %}
92 reinterpret_cast<intptr_t>({{v8_class}}::indexedPropertyGetterCallback),
93 reinterpret_cast<intptr_t>({{v8_class}}::indexedPropertyDefinerCallback),
94 reinterpret_cast<intptr_t>({{v8_class}}::indexedPropertyDescriptorCallback),
95 {% endif %}
96 {%- if interface.indexed_property_getter or interface.named_property_setter %}
97 reinterpret_cast<intptr_t>({{v8_class}}::indexedPropertySetterCallback),
98 {% endif %}
99 {%- if interface.indexed_property_deleter %}
100 reinterpret_cast<intptr_t>({{v8_class}}::indexedPropertyDeleterCallback),
101 {% endif %}
102 {% if interface.has_security_check_function %}
103 reinterpret_cast<intptr_t>({{v8_class}}::securityCheck),
104 {%- endif %}
105 {% endif %}{# not is_array_buffer_or_view #}
106
107 {% if not interface.is_partial or is_snapshotted %}
108 reinterpret_cast<intptr_t>(&{{interface.v8_name}}::wrapperTypeInfo),
109 {% endif %}
110 {% if interface.named_constructor %}
111 reinterpret_cast<intptr_t>(&{{interface.v8_name}}Constructor::wrapperTypeInf o),
112 {% endif %}
113 {% endfor %}{# interfaces #}
114
115 reinterpret_cast<intptr_t>(V8ObjectConstructor::IsValidConstructorMode),
116 reinterpret_cast<intptr_t>(V8ConstructorAttributeGetter),
117 0 // terminate with a null
118 };
119
120 return reference_table;
121 }
122
123 } // namespace blink
124
125 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698