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

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

Issue 606653006: bindings: Adds DOMArrayBuffer, etc. as thin wrappers for ArrayBuffer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. 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 #include "{{v8_class}}.h"
10 10
11 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} 11 {% for filename in cpp_includes if filename != '%s.h' % v8_class %}
12 #include "{{filename}}" 12 #include "{{filename}}"
13 {% endfor %} 13 {% endfor %}
14 14
15 namespace blink { 15 namespace blink {
16 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class 16 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
17 if is_active_dom_object else '0' %} 17 if is_active_dom_object else '0' %}
18 {% set to_event_target = '%s::toEventTarget' % v8_class 18 {% set to_event_target = '%s::toEventTarget' % v8_class
19 if is_event_target else '0' %} 19 if is_event_target else '0' %}
20 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class 20 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class
21 if has_visit_dom_wrapper else '0' %} 21 if has_visit_dom_wrapper else '0' %}
22 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface 22 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface
23 if parent_interface else '0' %} 23 if parent_interface else '0' %}
24 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else 24 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else
25 'WrapperTypeObjectPrototype' %} 25 'WrapperTypeObjectPrototype' %}
26 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie w else '0' %}
26 27
27 const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{v 8_class}}::domTemplate, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8 _class}}::trace, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrap per}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installCo nditionallyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeInfo::{{w rapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo: :{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; 28 const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{d om_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}: :trace, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{ v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditional lyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_ty pe_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifeti me}}, WrapperTypeInfo::{{gc_type}} };
28 29
29 {% if is_script_wrappable %} 30 {% if is_script_wrappable %}
30 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. 31 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h.
31 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in 32 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
32 // bindings/core/v8/ScriptWrappable.h. 33 // bindings/core/v8/ScriptWrappable.h.
34 {% if is_typed_array_type %}
35 template<>
36 {% endif %}
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 %}
40 {% if not is_array_buffer_or_view %}
36 namespace {{cpp_class}}V8Internal { 41 namespace {{cpp_class}}V8Internal {
37 42
38 {# Constants #} 43 {# Constants #}
39 {% from 'constants.cpp' import constant_getter_callback 44 {% from 'constants.cpp' import constant_getter_callback
40 with context %} 45 with context %}
41 {% for constant in special_getter_constants %} 46 {% for constant in special_getter_constants %}
42 {{constant_getter_callback(constant)}} 47 {{constant_getter_callback(constant)}}
43 {% endfor %} 48 {% endfor %}
44 {# Attributes #} 49 {# Attributes #}
45 {% from 'attributes.cpp' import constructor_getter_callback, 50 {% from 'attributes.cpp' import constructor_getter_callback,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 static const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = { 227 static const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = {
223 {% for method in method_configuration_methods %} 228 {% for method in method_configuration_methods %}
224 {% filter conditional(method.conditional_string) %} 229 {% filter conditional(method.conditional_string) %}
225 {{method_configuration(method)}}, 230 {{method_configuration(method)}},
226 {% endfilter %} 231 {% endfilter %}
227 {% endfor %} 232 {% endfor %}
228 }; 233 };
229 234
230 {% endif %} 235 {% endif %}
231 {% endblock %} 236 {% endblock %}
237 {% endif %}{# not is_array_buffer_or_view #}
232 {##############################################################################} 238 {##############################################################################}
233 {% block named_constructor %}{% endblock %} 239 {% block named_constructor %}{% endblock %}
234 {% block initialize_event %}{% endblock %} 240 {% block initialize_event %}{% endblock %}
235 {% block constructor_callback %}{% endblock %} 241 {% block constructor_callback %}{% endblock %}
236 {% block configure_shadow_object_template %}{% endblock %} 242 {% block configure_shadow_object_template %}{% endblock %}
237 {##############################################################################} 243 {##############################################################################}
238 {% block install_dom_template %} 244 {% block install_dom_template %}
245 {% if not is_array_buffer_or_view %}
239 {% from 'methods.cpp' import install_custom_signature with context %} 246 {% from 'methods.cpp' import install_custom_signature with context %}
240 {% from 'constants.cpp' import install_constants with context %} 247 {% from 'constants.cpp' import install_constants with context %}
241 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate) 248 static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate)
242 { 249 {
243 functionTemplate->ReadOnlyPrototype(); 250 functionTemplate->ReadOnlyPrototype();
244 251
245 v8::Local<v8::Signature> defaultSignature; 252 v8::Local<v8::Signature> defaultSignature;
246 {% set parent_template = 253 {% set parent_template =
247 'V8%s::domTemplate(isolate)' % parent_interface 254 'V8%s::domTemplate(isolate)' % parent_interface
248 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} 255 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %}
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 306 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
300 {{attribute_configuration(attribute)}}; 307 {{attribute_configuration(attribute)}};
301 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate); 308 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
302 } 309 }
303 {% endfilter %} 310 {% endfilter %}
304 {% endfor %} 311 {% endfor %}
305 {% if constants %} 312 {% if constants %}
306 {{install_constants() | indent}} 313 {{install_constants() | indent}}
307 {% endif %} 314 {% endif %}
308 {# Special operations #} 315 {# Special operations #}
309 {# V8 has access-check callback API and it's used on Window instead of 316 {# V8 has access-check callback API and it is used on Window instead of
310 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. 317 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks.
311 In addition, the getter should be set on the prototype template, to get 318 In addition, the getter should be set on the prototype template, to get
312 the implementation straight out of the Window prototype, regardless of 319 the implementation straight out of the Window prototype, regardless of
313 what prototype is actually set on the object. #} 320 what prototype is actually set on the object. #}
314 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window' 321 {% set set_on_template = 'PrototypeTemplate' if interface_name == 'Window'
315 else 'InstanceTemplate' %} 322 else 'InstanceTemplate' %}
316 {% if indexed_property_getter %} 323 {% if indexed_property_getter %}
317 {# if have indexed properties, MUST have an indexed property getter #} 324 {# if have indexed properties, MUST have an indexed property getter #}
318 {% set indexed_property_getter_callback = 325 {% set indexed_property_getter_callback =
319 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %} 326 '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %}
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 {% elif interface_name in [ 400 {% elif interface_name in [
394 'HTMLDocument', 'DedicatedWorkerGlobalScope', 401 'HTMLDocument', 'DedicatedWorkerGlobalScope',
395 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} 402 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %}
396 functionTemplate->SetHiddenPrototype(true); 403 functionTemplate->SetHiddenPrototype(true);
397 {% endif %} 404 {% endif %}
398 405
399 // Custom toString template 406 // Custom toString template
400 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate()); 407 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate());
401 } 408 }
402 409
410 {% endif %}{# not is_array_buffer_or_view #}
403 {% endblock %} 411 {% endblock %}
404 {##############################################################################} 412 {##############################################################################}
405 {% block get_dom_template %}{% endblock %} 413 {% block get_dom_template %}{% endblock %}
406 {% block has_instance %}{% endblock %} 414 {% block has_instance %}{% endblock %}
415 {% block to_impl %}{% endblock %}
407 {% block to_impl_with_type_check %}{% endblock %} 416 {% block to_impl_with_type_check %}{% endblock %}
408 {##############################################################################} 417 {##############################################################################}
409 {% block install_conditional_attributes %} 418 {% block install_conditional_attributes %}
410 {% if has_conditional_attributes %} 419 {% if has_conditional_attributes %}
411 void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate) 420 void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate)
412 { 421 {
413 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance Object->GetPrototype()); 422 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance Object->GetPrototype());
414 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext()); 423 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext());
415 424
416 {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %} 425 {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %}
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 {{method_implemented_in_private_script(method)}} 467 {{method_implemented_in_private_script(method)}}
459 {% endfor %} 468 {% endfor %}
460 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 469 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
461 {{attribute_getter_implemented_in_private_script(attribute)}} 470 {{attribute_getter_implemented_in_private_script(attribute)}}
462 {% if not attribute.is_read_only or attribute.put_forwards %} 471 {% if not attribute.is_read_only or attribute.put_forwards %}
463 {{attribute_setter_implemented_in_private_script(attribute)}} 472 {{attribute_setter_implemented_in_private_script(attribute)}}
464 {% endif %} 473 {% endif %}
465 {% endfor %} 474 {% endfor %}
466 } // namespace blink 475 } // namespace blink
467 {% endfilter %} 476 {% endfilter %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/idls/core/ArrayBuffer.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698