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

Side by Side Diff: Source/bindings/templates/interface_base.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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 {% filter conditional(conditional_string) %} 8 {% filter conditional(conditional_string) %}
9 #include "{{v8_class}}.h" 9 {% set empty_or_partial = '' if not is_partial else 'Partial' %}
10 #include "{{v8_class}}{{empty_or_partial}}.h"
10 11
11 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} 12 {% for filename in cpp_includes if filename != '%s%s.h' % (cpp_class, empty_or_p artial) %}
12 #include "{{filename}}" 13 #include "{{filename}}"
13 {% endfor %} 14 {% endfor %}
14 15
16 {% block initialize_script_wrappable %}{% endblock %}
15 namespace blink { 17 namespace blink {
16 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class 18 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
17 if is_active_dom_object else '0' %} 19 if is_active_dom_object else '0' %}
18 {% set to_event_target = '%s::toEventTarget' % v8_class 20 {% set to_event_target = '%s::toEventTarget' % v8_class
19 if is_event_target else '0' %} 21 if is_event_target else '0' %}
20 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class 22 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class
21 if has_visit_dom_wrapper else '0' %} 23 if has_visit_dom_wrapper else '0' %}
22 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface 24 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface
23 if parent_interface else '0' %} 25 if parent_interface else '0' %}
24 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else 26 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else
25 'WrapperTypeObjectPrototype' %} 27 'WrapperTypeObjectPrototype' %}
26 28
27 const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{v 8_class}}::domTemplate, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8 _class}}::createPersistentHandle, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_c lass}}::installConditionallyEnabledProperties, {{parent_wrapper_type_info}}, Wra pperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; 29 {% set wrapper_type_info_type = 'const ' if not has_partial_interface else '' %}
haraken 2014/10/09 04:24:01 Avoid 'if not ... else ...'. Use 'if ... else ...'
tasak 2014/10/10 07:52:23 Done.
30 {% if not is_partial %}
31 {{wrapper_type_info_type}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin: :kEmbedderBlink, {{v8_class}}::domTemplate, {{v8_class}}::refObject, {{v8_class} }::derefObject, {{v8_class}}::createPersistentHandle, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEn abledMethods, {{v8_class}}::installConditionallyEnabledProperties, {{parent_wrap per_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{ {wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} };
28 32
29 {% if is_script_wrappable %} 33 {% if is_script_wrappable %}
30 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. 34 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h.
31 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in 35 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
32 // bindings/core/v8/ScriptWrappable.h. 36 // bindings/core/v8/ScriptWrappable.h.
33 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo; 37 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo;
34 38
35 {% endif %} 39 {% endif %}
36 namespace {{cpp_class}}V8Internal { 40 {% endif %}
41 namespace {{cpp_class}}{{empty_or_partial}}V8Internal {
42 {% if has_partial_interface %}
43 {% for method in methods %}
44 {% if method.overloads and method.overloads.partial_overloads %}
45 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba ckInfo<v8::Value>&) = 0;
46 {% endif %}
47 {% endfor %}
48 {% endif %}
37 49
38 {# Constants #} 50 {# Constants #}
39 {% from 'constants.cpp' import constant_getter_callback 51 {% from 'constants.cpp' import constant_getter_callback
40 with context %} 52 with context %}
41 {% for constant in special_getter_constants %} 53 {% for constant in special_getter_constants %}
42 {{constant_getter_callback(constant)}} 54 {{constant_getter_callback(constant)}}
43 {% endfor %} 55 {% endfor %}
44 {# Attributes #} 56 {# Attributes #}
45 {% from 'attributes.cpp' import constructor_getter_callback, 57 {% from 'attributes.cpp' import constructor_getter_callback,
46 attribute_getter, attribute_getter_callback, 58 attribute_getter, attribute_getter_callback,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 {% endif %} 92 {% endif %}
81 {% endblock %} 93 {% endblock %}
82 {##############################################################################} 94 {##############################################################################}
83 {% for attribute in attributes if attribute.needs_constructor_getter_callback %} 95 {% for attribute in attributes if attribute.needs_constructor_getter_callback %}
84 {% for world_suffix in attribute.world_suffixes %} 96 {% for world_suffix in attribute.world_suffixes %}
85 {{constructor_getter_callback(attribute, world_suffix)}} 97 {{constructor_getter_callback(attribute, world_suffix)}}
86 {% endfor %} 98 {% endfor %}
87 {% endfor %} 99 {% endfor %}
88 {##############################################################################} 100 {##############################################################################}
89 {% block replaceable_attribute_setter_and_callback %} 101 {% block replaceable_attribute_setter_and_callback %}
102 {% set empty_or_partial = '' if not is_partial else 'Partial' %}
90 {% if has_replaceable_attributes or has_constructor_attributes %} 103 {% if has_replaceable_attributes or has_constructor_attributes %}
91 static void {{cpp_class}}ForceSetAttributeOnThis(v8::Local<v8::String> name, v8: :Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 104 static void {{cpp_class}}ForceSetAttributeOnThis(v8::Local<v8::String> name, v8: :Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
92 { 105 {
93 {% if is_check_security %} 106 {% if is_check_security %}
94 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 107 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
95 v8::String::Utf8Value attributeName(name); 108 v8::String::Utf8Value attributeName(name);
96 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate()); 109 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate());
97 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { 110 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) {
98 exceptionState.throwIfNeeded(); 111 exceptionState.throwIfNeeded();
99 return; 112 return;
100 } 113 }
101 {% endif %} 114 {% endif %}
102 if (info.This()->IsObject()) 115 if (info.This()->IsObject())
103 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); 116 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value);
104 } 117 }
105 118
106 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 119 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
107 { 120 {
108 {{cpp_class}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(name, v8Value, info); 121 {{cpp_class}}{{empty_or_partial}}V8Internal::{{cpp_class}}ForceSetAttributeO nThis(name, v8Value, info);
109 } 122 }
110 123
111 {% endif %} 124 {% endif %}
112 {% endblock %} 125 {% endblock %}
113 {##############################################################################} 126 {##############################################################################}
114 {% block security_check_functions %}{% endblock %} 127 {% block security_check_functions %}
128 {% if has_access_check_callbacks %}
129 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>)
130 {
131 {{cpp_class}}* impl = {{v8_class}}::toImpl(host);
132 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
133 }
134
135 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>)
136 {
137 {{cpp_class}}* impl = {{v8_class}}::toImpl(host);
138 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
139 }
140
141 {% endif %}
haraken 2014/10/09 04:24:01 You can land this change separately.
tasak 2014/10/10 07:52:23 Done.
142 {% endblock %}
143 {##############################################################################}
115 {# Methods #} 144 {# Methods #}
116 {% from 'methods.cpp' import generate_method, overload_resolution_method, 145 {% from 'methods.cpp' import generate_method, overload_resolution_method,
117 method_callback, origin_safe_method_getter, generate_constructor, 146 method_callback, origin_safe_method_getter, generate_constructor,
118 method_implemented_in_private_script 147 method_implemented_in_private_script
119 with context %} 148 with context %}
120 {% for method in methods %} 149 {% for method in methods %}
121 {% if method.should_be_exposed_to_script %} 150 {% if method.should_be_exposed_to_script %}
122 {% for world_suffix in method.world_suffixes %} 151 {% for world_suffix in method.world_suffixes %}
123 {% if not method.is_custom %} 152 {% if not method.is_custom and method.visible %}
124 {{generate_method(method, world_suffix)}} 153 {{generate_method(method, world_suffix)}}
125 {% endif %} 154 {% endif %}
126 {% if method.overloads %} 155 {% if method.overloads and method.overloads.visible %}
127 {{overload_resolution_method(method.overloads, world_suffix)}} 156 {{overload_resolution_method(method.overloads, world_suffix)}}
128 {% endif %} 157 {% endif %}
129 {% if not method.overload_index or method.overloads %} 158 {% if not method.overload_index or method.overloads %}
159 {% set overloads_callback_visible_in_partial = True
160 if is_partial and method.overloads and method.overloads.visible and not method.overloads.partial_overloads else False %}
161 {% set overloads_callback_visible_in_original = True
162 if not is_partial and method.overloads and method.overloads.visible else False %}
163 {% set method_visible = True
164 if not method.overloads and method.visible else False %}
165 {% if method_visible or overloads_callback_visible_in_partial or overloads_callb ack_visible_in_original %}
haraken 2014/10/09 04:24:01 Add a comment about what these variables mean. (A
tasak 2014/10/10 07:52:23 Done.
130 {# A single callback is generated for overloaded methods #} 166 {# A single callback is generated for overloaded methods #}
167 {# with considering partial overloads #}
131 {{method_callback(method, world_suffix)}} 168 {{method_callback(method, world_suffix)}}
132 {% endif %} 169 {% endif %}
133 {% if method.is_do_not_check_security %} 170 {% endif %}
171 {% if method.is_do_not_check_security and method.visible %}
134 {{origin_safe_method_getter(method, world_suffix)}} 172 {{origin_safe_method_getter(method, world_suffix)}}
135 {% endif %} 173 {% endif %}
136 {% endfor %} 174 {% endfor %}
137 {% endif %} 175 {% endif %}
138 {% endfor %} 176 {% endfor %}
139 {% if iterator_method %} 177 {% if iterator_method %}
140 {{generate_method(iterator_method)}} 178 {{generate_method(iterator_method)}}
141 {{method_callback(iterator_method)}} 179 {{method_callback(iterator_method)}}
142 {% endif %} 180 {% endif %}
143 {% block origin_safe_method_setter %}{% endblock %} 181 {% block origin_safe_method_setter %}{% endblock %}
(...skipping 13 matching lines...) Expand all
157 {% block named_property_getter %}{% endblock %} 195 {% block named_property_getter %}{% endblock %}
158 {% block named_property_getter_callback %}{% endblock %} 196 {% block named_property_getter_callback %}{% endblock %}
159 {% block named_property_setter %}{% endblock %} 197 {% block named_property_setter %}{% endblock %}
160 {% block named_property_setter_callback %}{% endblock %} 198 {% block named_property_setter_callback %}{% endblock %}
161 {% block named_property_query %}{% endblock %} 199 {% block named_property_query %}{% endblock %}
162 {% block named_property_query_callback %}{% endblock %} 200 {% block named_property_query_callback %}{% endblock %}
163 {% block named_property_deleter %}{% endblock %} 201 {% block named_property_deleter %}{% endblock %}
164 {% block named_property_deleter_callback %}{% endblock %} 202 {% block named_property_deleter_callback %}{% endblock %}
165 {% block named_property_enumerator %}{% endblock %} 203 {% block named_property_enumerator %}{% endblock %}
166 {% block named_property_enumerator_callback %}{% endblock %} 204 {% block named_property_enumerator_callback %}{% endblock %}
167 } // namespace {{cpp_class}}V8Internal 205 } // namespace {{cpp_class}}{{empty_or_partial}}V8Internal
168 206
169 {% block visit_dom_wrapper %}{% endblock %} 207 {% block visit_dom_wrapper %}{% endblock %}
170 {% block shadow_attributes %}{% endblock %} 208 {% block shadow_attributes %}{% endblock %}
171 {##############################################################################} 209 {##############################################################################}
172 {% block install_attributes %} 210 {% block install_attributes %}
211 {% from 'attributes.cpp' import attribute_configuration with context %}
173 {% if has_attribute_configuration %} 212 {% if has_attribute_configuration %}
174 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { 213 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = {
175 {% for attribute in attributes 214 {% for attribute in attributes
176 if not (attribute.is_expose_js_accessors or 215 if not (attribute.is_expose_js_accessors or
177 attribute.is_static or 216 attribute.is_static or
178 attribute.runtime_enabled_function or 217 attribute.runtime_enabled_function or
179 attribute.per_context_enabled_function or 218 attribute.per_context_enabled_function or
180 attribute.exposed_test or 219 attribute.exposed_test or
181 (interface_name == 'Window' and attribute.is_unforgeable)) 220 (interface_name == 'Window' and attribute.is_unforgeable))
182 and attribute.should_be_exposed_to_script %} 221 and attribute.should_be_exposed_to_script %}
183 {% filter conditional(attribute.conditional_string) %} 222 {% filter conditional(attribute.conditional_string) %}
184 {{attribute_configuration(attribute)}}, 223 {{attribute_configuration(attribute)}},
185 {% endfilter %} 224 {% endfilter %}
186 {% endfor %} 225 {% endfor %}
187 }; 226 };
188 227
189 {% endif %} 228 {% endif %}
190 {% endblock %} 229 {% endblock %}
191 {##############################################################################} 230 {##############################################################################}
192 {% block install_accessors %} 231 {% block install_accessors %}
232 {% from 'attributes.cpp' import attribute_configuration with context %}
193 {% if has_accessors %} 233 {% if has_accessors %}
194 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = { 234 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = {
195 {% for attribute in attributes if attribute.is_expose_js_accessors and attri bute.should_be_exposed_to_script %} 235 {% for attribute in attributes if attribute.is_expose_js_accessors and attri bute.should_be_exposed_to_script %}
196 {{attribute_configuration(attribute)}}, 236 {{attribute_configuration(attribute)}},
197 {% endfor %} 237 {% endfor %}
198 }; 238 };
199 239
200 {% endif %} 240 {% endif %}
201 {% endblock %} 241 {% endblock %}
202 {##############################################################################} 242 {##############################################################################}
(...skipping 11 matching lines...) Expand all
214 {% endif %} 254 {% endif %}
215 {% endblock %} 255 {% endblock %}
216 {##############################################################################} 256 {##############################################################################}
217 {% block named_constructor %}{% endblock %} 257 {% block named_constructor %}{% endblock %}
218 {% block initialize_event %}{% endblock %} 258 {% block initialize_event %}{% endblock %}
219 {% block constructor_callback %}{% endblock %} 259 {% block constructor_callback %}{% endblock %}
220 {% block configure_shadow_object_template %}{% endblock %} 260 {% block configure_shadow_object_template %}{% endblock %}
221 {##############################################################################} 261 {##############################################################################}
222 {% block install_dom_template %} 262 {% block install_dom_template %}
223 {% from 'methods.cpp' import install_custom_signature with context %} 263 {% from 'methods.cpp' import install_custom_signature with context %}
264 {% from 'attributes.cpp' import attribute_configuration with context %}
224 {% from 'constants.cpp' import install_constants with context %} 265 {% from 'constants.cpp' import install_constants with context %}
266 {% set empty_or_partial = '' if not is_partial else 'Partial' %}
267 {% if has_partial_interface or is_partial %}
268 void {{v8_class}}{{empty_or_partial}}::install{{v8_class}}Template(v8::Handle<v8 ::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
269 {% else %}
225 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate) 270 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate)
271 {% endif %}
226 { 272 {
273 {% if not is_partial %}
227 functionTemplate->ReadOnlyPrototype(); 274 functionTemplate->ReadOnlyPrototype();
haraken 2014/10/09 04:24:01 Why don't you need to call ReadOnlyPrototype if no
tasak 2014/10/10 07:52:23 When partial interface, ReadOnlyPrototype will be
275 {% else %}
276 {{v8_class}}::install{{v8_class}}Template(functionTemplate, isolate);
277 {% endif %}
228 278
229 v8::Local<v8::Signature> defaultSignature; 279 v8::Local<v8::Signature> defaultSignature;
230 {% set parent_template = 280 {% set parent_template =
231 'V8%s::domTemplate(isolate)' % parent_interface 281 'V8%s::domTemplate(isolate)' % parent_interface
232 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} 282 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %}
233 {% if runtime_enabled_function %} 283 {% if runtime_enabled_function %}
234 if (!{{runtime_enabled_function}}()) 284 if (!{{runtime_enabled_function}}())
235 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate); 285 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate);
236 else 286 else
237 {% endif %} 287 {% endif %}
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 331 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
282 {{attribute_configuration(attribute)}}; 332 {{attribute_configuration(attribute)}};
283 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate); 333 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
284 } 334 }
285 {% endfilter %} 335 {% endfilter %}
286 {% endfor %} 336 {% endfor %}
287 {% if constants %} 337 {% if constants %}
288 {{install_constants() | indent}} 338 {{install_constants() | indent}}
289 {% endif %} 339 {% endif %}
290 {# Special operations #} 340 {# Special operations #}
291 {# V8 has access-check callback API and it's used on Window instead of 341 {# V8 has access-check callback API and it\'s used on Window instead of
292 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. 342 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks.
293 In addition, the getter should be set on the prototype template, to get 343 In addition, the getter should be set on the prototype template, to get
294 the implementation straight out of the Window prototype, regardless of 344 the implementation straight out of the Window prototype, regardless of
295 what prototype is actually set on the object. #} 345 what prototype is actually set on the object. #}
296 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window' 346 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window'
297 else 'InstanceTemplate' %} 347 else 'InstanceTemplate' %}
298 {% if indexed_property_getter %} 348 {% if indexed_property_getter %}
299 {# if have indexed properties, MUST have an indexed property getter #} 349 {# if have indexed properties, MUST have an indexed property getter #}
300 {% set indexed_property_getter_callback = 350 {% set indexed_property_getter_callback =
301 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %} 351 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %}
(...skipping 21 matching lines...) Expand all
323 if named_property_getter.is_enumerable else '0' %} 373 if named_property_getter.is_enumerable else '0' %}
324 {% set named_property_deleter_callback = 374 {% set named_property_deleter_callback =
325 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class 375 '%sV8Internal::namedPropertyDeleterCallback' % cpp_class
326 if named_property_deleter else '0' %} 376 if named_property_deleter else '0' %}
327 {% set named_property_enumerator_callback = 377 {% set named_property_enumerator_callback =
328 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class 378 '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class
329 if named_property_getter.is_enumerable else '0' %} 379 if named_property_getter.is_enumerable else '0' %}
330 functionTemplate->{{set_on_template}}()->SetNamedPropertyHandler({{named_pro perty_getter_callback}}, {{named_property_setter_callback}}, {{named_property_qu ery_callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator _callback}}); 380 functionTemplate->{{set_on_template}}()->SetNamedPropertyHandler({{named_pro perty_getter_callback}}, {{named_property_setter_callback}}, {{named_property_qu ery_callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator _callback}});
331 {% endif %} 381 {% endif %}
332 {% if iterator_method %} 382 {% if iterator_method %}
333 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class}}V8Internal::itera torMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts }; 383 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedI teratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class}}{{empty_or_partia l}}V8Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScript s };
334 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D ontDelete, symbolKeyedIteratorConfiguration, isolate); 384 V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::D ontDelete, symbolKeyedIteratorConfiguration, isolate);
335 {% endif %} 385 {% endif %}
336 {# End special operations #} 386 {# End special operations #}
337 {% if has_custom_legacy_call_as_function %} 387 {% if has_custom_legacy_call_as_function %}
338 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); 388 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom);
339 {% endif %} 389 {% endif %}
340 {% if interface_name == 'HTMLAllCollection' %} 390 {% if interface_name == 'HTMLAllCollection' %}
341 {# Needed for legacy support of document.all #} 391 {# Needed for legacy support of document.all #}
342 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); 392 functionTemplate->InstanceTemplate()->MarkAsUndetectable();
343 {% endif %} 393 {% endif %}
(...skipping 12 matching lines...) Expand all
356 {% endfilter %}{# conditional() #} 406 {% endfilter %}{# conditional() #}
357 {% endfor %} 407 {% endfor %}
358 {% for attribute in attributes if attribute.is_static %} 408 {% for attribute in attributes if attribute.is_static %}
359 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % 409 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' %
360 (cpp_class, attribute.name) %} 410 (cpp_class, attribute.name) %}
361 {% filter conditional(attribute.conditional_string) %} 411 {% filter conditional(attribute.conditional_string) %}
362 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute .name}}"), {{getter_callback}}, {{attribute.setter_callback}}, v8::External::New (isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::Acces sorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 412 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute .name}}"), {{getter_callback}}, {{attribute.setter_callback}}, v8::External::New (isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::Acces sorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
363 {% endfilter %} 413 {% endfilter %}
364 {% endfor %} 414 {% endfor %}
365 {# Special interfaces #} 415 {# Special interfaces #}
416 {% if not is_partial %}
366 {% if interface_name == 'Window' %} 417 {% if interface_name == 'Window' %}
367 418
368 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); 419 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount);
369 functionTemplate->SetHiddenPrototype(true); 420 functionTemplate->SetHiddenPrototype(true);
370 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); 421 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount);
371 // Set access check callbacks, but turned off initially. 422 // Set access check callbacks, but turned off initially.
372 // When a context is detached from a frame, turn on the access check. 423 // When a context is detached from a frame, turn on the access check.
373 // Turning on checks also invalidates inline caches of the object. 424 // Turning on checks also invalidates inline caches of the object.
374 instanceTemplate->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom , V8Window::indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<Wr apperTypeInfo*>(&V8Window::wrapperTypeInfo)), false); 425 instanceTemplate->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom , V8Window::indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<Wr apperTypeInfo*>(&V8Window::wrapperTypeInfo)), false);
375 {% elif interface_name in [ 426 {% elif interface_name in [
376 'HTMLDocument', 'DedicatedWorkerGlobalScope', 427 'HTMLDocument', 'DedicatedWorkerGlobalScope',
377 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} 428 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %}
378 functionTemplate->SetHiddenPrototype(true); 429 functionTemplate->SetHiddenPrototype(true);
379 {% endif %} 430 {% endif %}
380 431
381 // Custom toString template 432 // Custom toString template
382 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate()); 433 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate());
434 {% endif %}
383 } 435 }
384 436
385 {% endblock %} 437 {% endblock %}
386 {##############################################################################} 438 {##############################################################################}
387 {% block get_dom_template %}{% endblock %} 439 {% block get_dom_template %}{% endblock %}
388 {% block has_instance %}{% endblock %} 440 {% block has_instance %}{% endblock %}
389 {% block to_impl_with_type_check %}{% endblock %} 441 {% block to_impl_with_type_check %}{% endblock %}
390 {% block install_conditional_attributes %}{% endblock %} 442 {% block install_conditional_attributes %}{% endblock %}
391 {% block install_conditional_methods %}{% endblock %} 443 {% block install_conditional_methods %}{% endblock %}
392 {% block to_active_dom_object %}{% endblock %} 444 {% block to_active_dom_object %}{% endblock %}
393 {% block to_event_target %}{% endblock %} 445 {% block to_event_target %}{% endblock %}
394 {% block get_shadow_object_template %}{% endblock %} 446 {% block get_shadow_object_template %}{% endblock %}
395 {% block wrap %}{% endblock %} 447 {% block wrap %}{% endblock %}
396 {% block create_wrapper %}{% endblock %} 448 {% block create_wrapper %}{% endblock %}
397 {% block deref_object_and_to_v8_no_inline %}{% endblock %} 449 {% block deref_object_and_to_v8_no_inline %}{% endblock %}
398 {% for method in methods if method.is_implemented_in_private_script %} 450 {% for method in methods if method.is_implemented_in_private_script %}
399 {{method_implemented_in_private_script(method)}} 451 {{method_implemented_in_private_script(method)}}
400 {% endfor %} 452 {% endfor %}
401 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 453 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
402 {{attribute_getter_implemented_in_private_script(attribute)}} 454 {{attribute_getter_implemented_in_private_script(attribute)}}
403 {% if not attribute.is_read_only or attribute.put_forwards %} 455 {% if not attribute.is_read_only or attribute.put_forwards %}
404 {{attribute_setter_implemented_in_private_script(attribute)}} 456 {{attribute_setter_implemented_in_private_script(attribute)}}
405 {% endif %} 457 {% endif %}
406 {% endfor %} 458 {% endfor %}
459 {% block partial_interface %}{% endblock %}
407 } // namespace blink 460 } // namespace blink
408 {% endfilter %} 461 {% endfilter %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698