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

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 is_v8object else '0' %}
26 27
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}} }; 28 const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{d om_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}: :createPersistentHandle, {{to_active_dom_object}}, {{to_event_target}}, {{visit_ dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::i nstallConditionallyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeI nfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperT ypeInfo::{{lifetime}}, 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 is_v8object %}
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 %}{# is_v8object #}
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 is_v8object %}
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 144 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 %}{# is_v8object #}
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 is_v8object and has_conditional_attributes %}
haraken 2014/10/16 05:41:41 I think you can drop the 'is_v8object and' check b
Yuki 2014/10/16 14:21:51 Done.
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 %}
417 {% filter per_context_enabled(attribute.per_context_enabled_function) %} 426 {% filter per_context_enabled(attribute.per_context_enabled_function) %}
418 {% filter exposed(attribute.exposed_test) %} 427 {% filter exposed(attribute.exposed_test) %}
419 static const V8DOMConfiguration::AttributeConfiguration attributeConfigurati on =\ 428 static const V8DOMConfiguration::AttributeConfiguration attributeConfigurati on =\
420 {{attribute_configuration(attribute)}}; 429 {{attribute_configuration(attribute)}};
421 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attrib uteConfiguration, isolate); 430 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attrib uteConfiguration, isolate);
422 {% endfilter %} 431 {% endfilter %}
423 {% endfilter %} 432 {% endfilter %}
424 {% endfor %} 433 {% endfor %}
425 } 434 }
426 435
427 {% endif %} 436 {% endif %}
428 {% endblock %} 437 {% endblock %}
429 {##############################################################################} 438 {##############################################################################}
430 {% block install_conditional_methods %} 439 {% block install_conditional_methods %}
431 {% if conditionally_enabled_methods %} 440 {% if is_v8object and conditionally_enabled_methods %}
haraken 2014/10/16 05:41:41 Ditto.
Yuki 2014/10/16 14:21:51 Done.
432 void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> pro totypeObject, v8::Isolate* isolate) 441 void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> pro totypeObject, v8::Isolate* isolate)
433 { 442 {
434 {# Define per-context enabled operations #} 443 {# Define per-context enabled operations #}
435 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate)); 444 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate));
436 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext()); 445 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext());
437 ASSERT(context); 446 ASSERT(context);
438 447
439 {% for method in conditionally_enabled_methods %} 448 {% for method in conditionally_enabled_methods %}
440 {% filter per_context_enabled(method.per_context_enabled_function) %} 449 {% filter per_context_enabled(method.per_context_enabled_function) %}
441 {% filter exposed(method.exposed_test) %} 450 {% filter exposed(method.exposed_test) %}
(...skipping 16 matching lines...) Expand all
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

Powered by Google App Engine
This is Rietveld 408576698