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

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

Issue 968593002: bindings: Supports constructor attributes on prototype chains. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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_or_partial}}.h" 9 #include "{{v8_class_or_partial}}.h"
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { 63 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) {
64 exceptionState.throwIfNeeded(); 64 exceptionState.throwIfNeeded();
65 return; 65 return;
66 } 66 }
67 {% endif %} 67 {% endif %}
68 ASSERT(info.This()->IsObject()); 68 ASSERT(info.This()->IsObject());
69 v8::Local<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); 69 v8::Local<v8::Object>::Cast(info.This())->ForceSet(name, v8Value);
70 } 70 }
71 71
72 {% endif %} 72 {% endif %}
73 {% if has_constructor_attributes %}
74 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
75 {
76 {{cpp_class_or_partial}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(nam e, v8Value, info);
77 }
78
79 {% endif %}
80 {% endblock %} 73 {% endblock %}
81 {##############################################################################} 74 {##############################################################################}
82 {% from 'attributes.cpp' import constructor_getter_callback, 75 {% from 'attributes.cpp' import constructor_getter_callback,
83 attribute_getter, attribute_getter_callback, 76 attribute_getter, attribute_getter_callback,
84 attribute_setter, attribute_setter_callback, 77 attribute_setter, attribute_setter_callback,
85 attribute_getter_implemented_in_private_script, 78 attribute_getter_implemented_in_private_script,
86 attribute_setter_implemented_in_private_script 79 attribute_setter_implemented_in_private_script
87 with context %} 80 with context %}
88 {% for attribute in attributes if not attribute.constructor_type %} 81 {% for attribute in attributes if attribute.should_be_exposed_to_script %}
89 {% if attribute.should_be_exposed_to_script %}
90 {% for world_suffix in attribute.world_suffixes %} 82 {% for world_suffix in attribute.world_suffixes %}
83 {% if not attribute.constructor_type %}
91 {% if not attribute.has_custom_getter %} 84 {% if not attribute.has_custom_getter %}
92 {{attribute_getter(attribute, world_suffix)}} 85 {{attribute_getter(attribute, world_suffix)}}
93 {% endif %} 86 {% endif %}
94 {{attribute_getter_callback(attribute, world_suffix)}} 87 {{attribute_getter_callback(attribute, world_suffix)}}
88 {% endif %}
95 {% if attribute.has_setter %} 89 {% if attribute.has_setter %}
96 {% if not attribute.has_custom_setter %} 90 {% if not attribute.has_custom_setter %}
97 {{attribute_setter(attribute, world_suffix)}} 91 {{attribute_setter(attribute, world_suffix)}}
98 {% endif %} 92 {% endif %}
99 {{attribute_setter_callback(attribute, world_suffix)}} 93 {{attribute_setter_callback(attribute, world_suffix)}}
100 {% endif %} 94 {% endif %}
101 {% endfor %} 95 {% endfor %}
102 {% endif %}
103 {% endfor %} 96 {% endfor %}
104 {##############################################################################} 97 {##############################################################################}
105 {% block constructor_getter %}
106 {% if has_constructor_attributes %}
107 static void {{cpp_class}}ConstructorGetter(v8::Local<v8::String>, const v8::Prop ertyCallbackInfo<v8::Value>& info)
108 {
109 v8::Local<v8::Value> data = info.Data();
110 ASSERT(data->IsExternal());
111 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
112 if (!perContextData)
113 return;
114 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
115 }
116
117 {% endif %}
118 {% endblock %}
119 {##############################################################################}
120 {% for attribute in attributes if attribute.needs_constructor_getter_callback %} 98 {% for attribute in attributes if attribute.needs_constructor_getter_callback %}
121 {% for world_suffix in attribute.world_suffixes %} 99 {% for world_suffix in attribute.world_suffixes %}
122 {{constructor_getter_callback(attribute, world_suffix)}} 100 {{constructor_getter_callback(attribute, world_suffix)}}
123 {% endfor %} 101 {% endfor %}
124 {% endfor %} 102 {% endfor %}
125 {##############################################################################} 103 {##############################################################################}
126 {% block security_check_functions %} 104 {% block security_check_functions %}
127 {% if has_access_check_callbacks %} 105 {% if has_access_check_callbacks %}
128 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>) 106 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>)
129 { 107 {
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 {% else %}{# is_do_not_check_security #} 418 {% else %}{# is_do_not_check_security #}
441 {{install_custom_signature(method) | indent}} 419 {{install_custom_signature(method) | indent}}
442 {% endif %}{# is_do_not_check_security #} 420 {% endif %}{# is_do_not_check_security #}
443 {% endfilter %}{# runtime_enabled() #} 421 {% endfilter %}{# runtime_enabled() #}
444 {% endfilter %}{# exposed() #} 422 {% endfilter %}{# exposed() #}
445 {% endfilter %}{# per_context_enabled() #} 423 {% endfilter %}{# per_context_enabled() #}
446 {% endfilter %}{# conditional() #} 424 {% endfilter %}{# conditional() #}
447 {% endfor %} 425 {% endfor %}
448 {% for attribute in attributes if attribute.is_static %} 426 {% for attribute in attributes if attribute.is_static %}
449 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % 427 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' %
450 (cpp_class, attribute.name) %} 428 (cpp_class, attribute.name) %}
429 {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' %
430 (cpp_class, attribute.name)
431 if attribute.has_setter else '0' %}
451 {% filter conditional(attribute.conditional_string) %} 432 {% filter conditional(attribute.conditional_string) %}
452 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute .name}}"), {{getter_callback}}, {{attribute.setter_callback}}, v8::External::New (isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Local<v8::Access orSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 433 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute .name}}"), {{getter_callback}}, {{setter_callback}}, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Local<v8::AccessorSignatur e>(), static_cast<v8::AccessControl>(v8::DEFAULT));
453 {% endfilter %} 434 {% endfilter %}
454 {% endfor %} 435 {% endfor %}
455 {# Special interfaces #} 436 {# Special interfaces #}
456 {% if not is_partial %} 437 {% if not is_partial %}
457 {% if interface_name == 'Window' %} 438 {% if interface_name == 'Window' %}
458 439
459 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); 440 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount);
460 functionTemplate->SetHiddenPrototype(true); 441 functionTemplate->SetHiddenPrototype(true);
461 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); 442 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount);
462 {% elif interface_name in [ 443 {% elif interface_name in [
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 {% endfor %} 477 {% endfor %}
497 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 478 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
498 {{attribute_getter_implemented_in_private_script(attribute)}} 479 {{attribute_getter_implemented_in_private_script(attribute)}}
499 {% if attribute.has_setter %} 480 {% if attribute.has_setter %}
500 {{attribute_setter_implemented_in_private_script(attribute)}} 481 {{attribute_setter_implemented_in_private_script(attribute)}}
501 {% endif %} 482 {% endif %}
502 {% endfor %} 483 {% endfor %}
503 {% block partial_interface %}{% endblock %} 484 {% block partial_interface %}{% endblock %}
504 } // namespace blink 485 } // namespace blink
505 {% endfilter %} 486 {% endfilter %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698