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

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

Issue 186673002: Support deprecation + use counters for constructor attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Always generate constructor getter callbacks Created 6 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
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 '{0}V8Internal::{0}ConstructorGetter'.format(cpp_class) %} 10 '%sV8Internal::%sConstructorGetterCallback' %
Nils Barth (inactive) 2014/03/05 07:27:52 Minor point: could we give these the same name? I.
sof 2014/03/05 12:45:48 Switched to using "AttributeGetterCallback" as suf
11 (cpp_class, attribute.name) %}
11 {% set getter_callback_for_main_world = 12 {% set getter_callback_for_main_world =
12 '%sV8Internal::%sAttributeGetterCallbackForMainWorld' % 13 '%sV8Internal::%sAttributeGetterCallbackForMainWorld' %
13 (cpp_class, attribute.name) 14 (cpp_class, attribute.name)
14 if attribute.is_per_world_bindings else '0' %} 15 if attribute.is_per_world_bindings else '0' %}
15 {% set setter_callback = attribute.setter_callback %} 16 {% set setter_callback = attribute.setter_callback %}
16 {% set setter_callback_for_main_world = 17 {% set setter_callback_for_main_world =
17 '%sV8Internal::%sAttributeSetterCallbackForMainWorld' % 18 '%sV8Internal::%sAttributeSetterCallbackForMainWorld' %
18 (cpp_class, attribute.name) 19 (cpp_class, attribute.name)
19 if attribute.is_per_world_bindings and 20 if attribute.is_per_world_bindings and
20 (not attribute.is_read_only or attribute.put_forwards) else '0' %} 21 (not attribute.is_read_only or attribute.put_forwards) else '0' %}
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ASSERT(data->IsExternal()); 68 ASSERT(data->IsExternal());
68 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext()); 69 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
69 if (!perContextData) 70 if (!perContextData)
70 return; 71 return;
71 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); 72 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
72 } 73 }
73 74
74 {% endif %} 75 {% endif %}
75 {% endblock %} 76 {% endblock %}
76 77
77
Nils Barth (inactive) 2014/03/05 07:27:52 Could you leave this line? The convention I've bee
sof 2014/03/05 12:45:48 Accidental line removal reverted.
78 {##############################################################################} 78 {##############################################################################}
79 {% block replaceable_attribute_setter_and_callback %} 79 {% block replaceable_attribute_setter_and_callback %}
80 {% if has_replaceable_attributes or has_constructor_attributes %} 80 {% if has_replaceable_attributes or has_constructor_attributes %}
81 {# FIXME: rename to ForceSetAttributeOnThis, since also used for Constructors #} 81 {# FIXME: rename to ForceSetAttributeOnThis, since also used for Constructors #}
82 static void {{cpp_class}}ReplaceableAttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 82 static void {{cpp_class}}ReplaceableAttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
83 { 83 {
84 {% if is_check_security %} 84 {% if is_check_security %}
85 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 85 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
86 v8::String::Utf8Value attributeName(name); 86 v8::String::Utf8Value attributeName(name);
87 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate()); 87 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate());
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 {% endfilter %} 1317 {% endfilter %}
1318 } 1318 }
1319 1319
1320 template<> 1320 template<>
1321 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1321 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1322 { 1322 {
1323 return toV8(impl, creationContext, isolate); 1323 return toV8(impl, creationContext, isolate);
1324 } 1324 }
1325 1325
1326 {% endblock %} 1326 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698