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

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

Issue 618373003: [bindings] partial interfaces should not violate componentization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed http/tests/serviceworker/fetch\* regression Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 {% extends 'interface_base.cpp' %}
2
3 {##############################################################################}
haraken 2014/10/09 04:24:01 Nit: I'd drop {######} just to list up outlined bl
tasak 2014/10/10 07:52:24 Done.
4 {% block indexed_property_getter %}
5 {% endblock %}
6
7 {##############################################################################}
8 {% block indexed_property_getter_callback %}
9 {% endblock %}
10
11 {##############################################################################}
12 {% block indexed_property_setter %}
13 {% endblock %}
14
15 {##############################################################################}
16 {% block indexed_property_setter_callback %}
17 {% endblock %}
18
19 {##############################################################################}
20 {% block indexed_property_deleter %}
21 {% endblock %}
22
23 {##############################################################################}
24 {% block indexed_property_deleter_callback %}
25 {% endblock %}
26
27 {##############################################################################}
28 {% from 'methods.cpp' import union_type_method_call_and_set_return_value %}
haraken 2014/10/09 04:24:01 Is this needed?
tasak 2014/10/10 07:52:23 Done.
29 {% block named_property_getter %}
30 {% endblock %}
31
32 {##############################################################################}
33 {% block named_property_getter_callback %}
34 {% endblock %}
35
36 {##############################################################################}
37 {% block named_property_setter %}
38 {% endblock %}
39
40 {##############################################################################}
41 {% block named_property_setter_callback %}
42 {% endblock %}
43
44 {##############################################################################}
45 {% block named_property_query %}
46 {% endblock %}
47
48 {##############################################################################}
49 {% block named_property_query_callback %}
50 {% endblock %}
51
52 {##############################################################################}
53 {% block named_property_deleter %}
54 {% endblock %}
55
56 {##############################################################################}
57 {% block named_property_deleter_callback %}
58 {% endblock %}
59
60 {##############################################################################}
61 {% block named_property_enumerator %}
62 {% endblock %}
63
64 {##############################################################################}
65 {% block named_property_enumerator_callback %}
66 {% endblock %}
67
68 {##############################################################################}
69 {% block origin_safe_method_setter %}
70 {% endblock %}
71
72 {##############################################################################}
73 {% from 'methods.cpp' import generate_constructor with context %}
74 {% block named_constructor %}
75 {% endblock %}
76
77 {##############################################################################}
78 {% block overloaded_constructor %}
79 {% endblock %}
80
81 {##############################################################################}
82 {% block event_constructor %}
83 {% endblock %}
84
85 {##############################################################################}
86 {% block visit_dom_wrapper %}
87 {% endblock %}
88
89 {##############################################################################}
90 {% block shadow_attributes %}
91 {% endblock %}
92
93 {##############################################################################}
94 {% block initialize_event %}
95 {% endblock %}
96
97 {##############################################################################}
98 {% block constructor_callback %}
99 {% endblock %}
100
101 {##############################################################################}
102 {% block configure_shadow_object_template %}
103 {% endblock %}
104
105 {######################################}
106
107 {##############################################################################}
108 {% block get_dom_template %}
109 {% endblock %}
110 {% block has_instance %}
111 {% endblock %}
112 {% block to_native_with_type_check %}
113 {% endblock %}
114
115 {##############################################################################}
116 {% block install_conditional_attributes %}
117 {% if has_conditional_attributes %}
118 void {{v8_class}}Partial::installConditionallyEnabledProperties(v8::Handle<v8::O bject> instanceTemplate, v8::Isolate* isolate)
119 {
120 {# install per-context enabled properties defined in master interface. #}
haraken 2014/10/09 04:24:01 master => original
tasak 2014/10/10 07:52:23 Done.
121 {{v8_class}}::installConditionallyEnabledProperties(instanceTemplate, isolat e);
122
123 {# install per-context enabled properties defined in partial interface. #}
124 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan ceTemplate->GetPrototype());
125 {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %}
126 if ({{attribute.per_context_enabled_function}}(impl->document())) {
127 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
128 {{attribute_configuration(attribute)}};
129 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
130 }
131 {% endfor %}
132 }
133 {% else %}
134 void {{v8_class}}Partial::installConditionallyEnabledProperties(v8::Handle<v8::O bject> instanceTemplate, v8::Isolate* isolate)
135 {
136 {# invoke installConditionallyEnabledProperties defined in master #}
haraken 2014/10/09 04:24:01 master => original interface
tasak 2014/10/10 07:52:23 Done.
137 {{v8_class}}::installConditionallyEnabledProperties(instanceTemplate, isolat e);
138 }
139 {% endif %}
140 {% endblock %}
141
142
143 {##############################################################################}
144 {% block install_conditional_methods %}
145 {% if conditionally_enabled_methods %};
146 void {{v8_class}}Partial::installConditionallyEnabledMethods(v8::Handle<v8::Obje ct> prototypeTemplate, v8::Isolate* isolate)
147 {
148 {# Define per-context enabled operations defined in master interfaces #}
haraken 2014/10/09 04:24:01 master => original
tasak 2014/10/10 07:52:23 Done.
149 {{v8_class}}::installConditionallyEnabledMethods(prototypeTemplate, isolate) ;
150
151 {# Define per-context enabled operations #}
152 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate));
153 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext());
haraken 2014/10/09 04:24:01 Where is prototypeObject defined?
tasak 2014/10/10 07:52:23 This is a bug when I copied code from interface.cp
154 ASSERT(context);
155
156 {% for method in conditionally_enabled_methods %}
157 {% filter per_context_enabled(method.per_context_enabled_function) %}
158 {% filter exposed(method.exposed_test) %}
haraken 2014/10/09 04:24:01 Shall we use 'for ... if ...' instead of filters,
tasak 2014/10/10 07:52:23 Looking at the newest code, installConditionallyEn
159 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class}}V8PartialInternal::{{method.name}}MethodCal lback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}}) ->GetFunction());
160 {% endfilter %}
161 {% endfilter %}
162 {% endfor %}
163 }
164 {% else %}
165 void {{v8_class}}Partial::installConditionallyEnabledMethods(v8::Handle<v8::Obje ct> prototypeTemplate, v8::Isolate* isolate)
166 {
167 {# invoke installConditionallyEnabledMethods defined in master #}
haraken 2014/10/09 04:24:01 master => original interface
tasak 2014/10/10 07:52:23 Done.
168 {{v8_class}}::installConditionallyEnabledMethods(prototypeTemplate, isolate) ;
169 }
170 {% endif %}
171 {% endblock %}
172
173 {##############################################################################}
174 {% block to_active_dom_object %}
175 {% endblock %}
176
177 {##############################################################################}
178 {% block to_event_target %}
179 {% endblock %}
180
181 {##############################################################################}
182 {% block get_shadow_object_template %}
183 {% endblock %}
184
185 {##############################################################################}
186 {% block wrap %}
187 {% endblock %}
188
189 {##############################################################################}
190 {% block create_wrapper %}
haraken 2014/10/09 04:24:01 I don't fully understand why we need createWrapper
tasak 2014/10/10 07:52:23 Yeah, we don't need createWrapper for partial inte
191 {% endblock %}
192
193 {##############################################################################}
194 {% block deref_object_and_to_v8_no_inline %}
195 {% endblock %}
196
197 {##############################################################################}
198 {% block partial_interface %}
199 void {{v8_class}}Partial::initialize()
200 {
201 // Should be invoked from initModules.
202 {{v8_class}}::updateWrapperTypeInfo(
203 &{{v8_class}}Partial::install{{v8_class}}Template,
204 &{{v8_class}}Partial::installConditionallyEnabledMethods);
205 {% for method in methods %}
206 {% if method.overloads and method.overloads.partial_overloads %}
207 {% if not method.overload_index or method.overloads %}
haraken 2014/10/09 04:24:01 I don't understand this condition. This if branch
tasak 2014/10/10 07:52:23 This should be "method.overloads and method.overlo
208 {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInte rface(&{{cpp_class}}PartialV8Internal::{{method.name}}Method);
209 {% endif %}
210 {% endif %}
211 {% endfor %}
212 }
213
214 {% endblock %}
215
216
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698