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

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

Issue 27638002: IDL compiler: Basic setters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix ; Created 7 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
« no previous file with comments | « Source/bindings/scripts/unstable/v8_utilities.py ('k') | Source/bindings/templates/interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {##############################################################################} 1 {##############################################################################}
2 {% macro attribute_getter(attribute, world_suffix) %} 2 {% macro attribute_getter(attribute, world_suffix) %}
3 {% filter conditional(attribute.conditional_string) %} 3 {% filter conditional(attribute.conditional_string) %}
4 static void {{attribute.name}}AttributeGetter{{world_suffix}}(v8::Local<v8::Stri ng> name, const v8::PropertyCallbackInfo<v8::Value>& info) 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}(v8::Local<v8::Stri ng> name, const v8::PropertyCallbackInfo<v8::Value>& info)
5 { 5 {
6 {% if attribute.is_unforgeable %} 6 {% if attribute.is_unforgeable %}
7 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class_name}}::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate()))); 7 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class_name}}::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate())));
8 if (holder.IsEmpty()) 8 if (holder.IsEmpty())
9 return; 9 return;
10 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(holder); 10 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(holder);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 info.Holder()->SetHiddenValue(propertyName, {{attribute.cpp_value}}.v8Value( )); 57 info.Holder()->SetHiddenValue(propertyName, {{attribute.cpp_value}}.v8Value( ));
58 {% endif %} 58 {% endif %}
59 {# End special cases #} 59 {# End special cases #}
60 {% if attribute.is_keep_alive_for_gc %} 60 {% if attribute.is_keep_alive_for_gc %}
61 {{attribute.cpp_type}} result = {{attribute.cpp_value}}; 61 {{attribute.cpp_type}} result = {{attribute.cpp_value}};
62 if (result && DOMDataStore::setReturnValueFromWrapper<{{attribute.v8_type}}> (info.GetReturnValue(), result.get())) 62 if (result && DOMDataStore::setReturnValueFromWrapper<{{attribute.v8_type}}> (info.GetReturnValue(), result.get()))
63 return; 63 return;
64 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs olate()); 64 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs olate());
65 if (!wrapper.IsEmpty()) { 65 if (!wrapper.IsEmpty()) {
66 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "{{attribut e.name}}", wrapper); 66 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "{{attribut e.name}}", wrapper);
67 {{attribute.return_v8_value_statement}} 67 {{attribute.v8_set_return_value}};
68 } 68 }
69 {% else %} 69 {% else %}
70 {{attribute.return_v8_value_statement}} 70 {{attribute.v8_set_return_value}};
71 {% endif %} 71 {% endif %}
72 } 72 }
73 {% endfilter %} 73 {% endfilter %}
74 {% endmacro %} 74 {% endmacro %}
75 75
76 76
77 {##############################################################################} 77 {##############################################################################}
78 {% macro attribute_getter_callback(attribute, world_suffix) %} 78 {% macro attribute_getter_callback(attribute, world_suffix) %}
79 {% filter conditional(attribute.conditional_string) %} 79 {% filter conditional(attribute.conditional_string) %}
80 static void {{attribute.name}}AttributeGetterCallback{{world_suffix}}(v8::Local< v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) 80 static void {{attribute.name}}AttributeGetterCallback{{world_suffix}}(v8::Local< v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
81 { 81 {
82 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 82 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
83 {% if attribute.deprecate_as %} 83 {% if attribute.deprecate_as %}
84 UseCounter::countDeprecation(activeExecutionContext(), UseCounter::{{attribu te.deprecate_as}}); 84 UseCounter::countDeprecation(activeExecutionContext(), UseCounter::{{attribu te.deprecate_as}});
85 {% endif %} 85 {% endif %}
86 {% if attribute.measure_as %} 86 {% if attribute.measure_as %}
87 UseCounter::count(activeDOMWindow(), UseCounter::{{attribute.measure_as}}); 87 UseCounter::count(activeDOMWindow(), UseCounter::{{attribute.measure_as}});
88 {% endif %} 88 {% endif %}
89 {% if world_suffix in attribute.activity_logging_getter %} 89 {% if world_suffix in attribute.activity_logging_getter %}
90 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext()); 90 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext());
91 if (contextData && contextData->activityLogger()) 91 if (contextData && contextData->activityLogger())
92 contextData->activityLogger()->log("{{interface_name}}.{{attribute.name} }", 0, 0, "Getter"); 92 contextData->activityLogger()->log("{{interface_name}}.{{attribute.name} }", 0, 0, "Getter");
93 {% endif %} 93 {% endif %}
94 {% if attribute.is_custom_getter %} 94 {% if attribute.has_custom_getter %}
95 {{v8_class_name}}::{{attribute.name}}AttributeGetterCustom(name, info); 95 {{v8_class_name}}::{{attribute.name}}AttributeGetterCustom(name, info);
96 {% else %} 96 {% else %}
97 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetter{{world_suffi x}}(name, info); 97 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetter{{world_suffi x}}(name, info);
98 {% endif %} 98 {% endif %}
99 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 99 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
100 } 100 }
101 {% endfilter %} 101 {% endfilter %}
102 {% endmacro %} 102 {% endmacro %}
103
104
105 {##############################################################################}
106 {% macro attribute_setter(attribute, world_suffix) %}
107 static void {{attribute.name}}AttributeSetter{{world_suffix}}(v8::Local<v8::Stri ng> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info )
108 {
109 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
110 {{attribute.v8_value_to_local_cpp_value}};
111 {{attribute.cpp_setter}};
112 }
113 {% endmacro %}
114
115
116 {##############################################################################}
117 {% macro attribute_setter_callback(attribute, world_suffix) %}
118 static void {{attribute.name}}AttributeSetterCallback{{world_suffix}}(v8::Local< v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<voi d>& info)
119 {
120 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
121 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffi x}}(name, value, info);
122 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
123 }
124 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_utilities.py ('k') | Source/bindings/templates/interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698