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

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

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Work for some comments Created 3 years, 7 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/V8SnapshotReference.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* V8SnapshotReference::GetReferenceTable() {
16 static intptr_t reference_table[] = {
17 {% for interface in interfaces %}
18 {% if not interface.is_array_buffer_or_view %}
19 {% set namespace = 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>({{namespace}}::{{attribute.name}}AttributeGetterC allback{{world_suffix}}),
26 {% elif attribute.needs_constructor_getter_callback %}
27 reinterpret_cast<intptr_t>({{namespace}}::{{attribute.name}}ConstructorGette rCallback{{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>({{namespace}}::{{attribute.name}}AttributeSetterC allback{{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>({{namespace}}::{{method.name}}MethodCallback{{wor ld_suffix}}),
47 {% endif %}
48 {% endif %}
49 {% endif %}{# overload(_index) #}
50 {% if method.is_cross_origin and method.visible %}
51 reinterpret_cast<intptr_t>({{namespace}}::{{method.name}}OriginSafeMethodGet terCallback{{world_suffix}}),
52 {% endif%}
53 {% endfor %}
54 {% endfor %}{# method #}
55 {% if interface.has_origin_safe_method_setter %}
56 reinterpret_cast<intptr_t>({{namespace}}::{{interface.name}}OriginSafeMethod SetterCallback),
57 {% endif %}
58 {% if interface.has_cross_origin_named_getter %}
59 reinterpret_cast<intptr_t>({{namespace}}::crossOriginNamedGetter),
60 {% endif %}
61 {% if interface.has_cross_origin_named_setter %}
62 reinterpret_cast<intptr_t>({{namespace}}::crossOriginNamedSetter),
63 {% endif %}
64 {% if interface.has_cross_origin_named_enumerator %}
65 reinterpret_cast<intptr_t>({{namespace}}::crossOriginNamedEnumerator),
66 {% endif %}
67 {% if interface.has_cross_origin_indexed_getter %}
68 reinterpret_cast<intptr_t>({{namespace}}::crossOriginIndexedGetter),
69 {% endif %}
70 {% if interface.has_security_check %}
71 reinterpret_cast<intptr_t>({{namespace}}::securityCheck),
72 {% endif %}
73
74 {# Other properties #}
75 {% if interface.named_property_getter %}
76 reinterpret_cast<intptr_t>({{namespace}}::namedPropertyGetterCallback),
77 {% endif %}
78 {%- if interface.named_property_setter %}
79 reinterpret_cast<intptr_t>({{namespace}}::namedPropertySetterCallback),
80 {% endif %}
81 {%- if interface.named_property_deleter %}
82 reinterpret_cast<intptr_t>({{namespace}}::namedPropertyDeleterCallback),
83 {% endif %}
84 {%- if interface.named_property_getter and interface.named_property_getter. is_enumerable %}
85 reinterpret_cast<intptr_t>({{namespace}}::namedPropertyQueryCallback),
86 reinterpret_cast<intptr_t>({{namespace}}::namedPropertyEnumeratorCallback),
87 {% endif %}
88 {%- if interface.indexed_property_getter %}
89 reinterpret_cast<intptr_t>({{namespace}}::indexedPropertyGetterCallback),
90 {% endif %}
91 {%- if interface.indexed_property_setter %}
92 reinterpret_cast<intptr_t>({{namespace}}::indexedPropertySetterCallback),
93 {% endif %}
94 {%- if interface.indexed_property_deleter %}
95 reinterpret_cast<intptr_t>({{namespace}}::indexedPropertyDeleterCallback),
96 {% endif %}
97 {% if interface.has_security_check_function %}
98 reinterpret_cast<intptr_t>({{namespace}}::securityCheck),
99 {%- endif %}
100 {% endif %}{# not is_array_buffer_or_view #}
101
102 {% if not interface.is_partial %}
103 reinterpret_cast<intptr_t>(&{{interface.v8_name}}::wrapperTypeInfo),
104 {% endif %}
105 {% if interface.named_constructor %}
106 reinterpret_cast<intptr_t>(&{{interface.v8_name}}Constructor::wrapperTypeInf o),
107 {% endif %}
108 {% endfor %}{# interfaces #}
109
110 reinterpret_cast<intptr_t>(V8ObjectConstructor::IsValidConstructorMode),
haraken 2017/05/20 19:10:03 Why do we need this?
peria 2017/05/30 08:25:44 it is referred from V8Window class
111 reinterpret_cast<intptr_t>(V8ConstructorAttributeGetter),
haraken 2017/05/20 19:10:03 Why do we need this?
peria 2017/05/30 08:25:44 ditto.
112 0 // terminate with a null
haraken 2017/05/20 19:10:02 What happens if we forget to add some C++ referenc
peria 2017/05/30 08:25:44 v8::SnapshotCreator crashes if it hits unkown exte
113 };
114
115 return reference_table;
116 }
117
118 } // namespace blink
119
120 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698