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

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

Issue 1109323002: [bindings] Support passing of ScriptState for namedPropertyQuery form of getter. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: ScriptState changes Created 5 years, 7 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
« no previous file with comments | « no previous file | Source/bindings/tests/results/core/V8TestObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% block indexed_property_getter %} 5 {% block indexed_property_getter %}
6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
7 {% set getter = indexed_property_getter %} 7 {% set getter = indexed_property_getter %}
8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
9 { 9 {
10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 295 }
296 296
297 {% endif %} 297 {% endif %}
298 {% endblock %} 298 {% endblock %}
299 299
300 300
301 {##############################################################################} 301 {##############################################################################}
302 {% block named_property_query %} 302 {% block named_property_query %}
303 {% if named_property_getter and named_property_getter.is_enumerable and 303 {% if named_property_getter and named_property_getter.is_enumerable and
304 not named_property_getter.is_custom_property_query %} 304 not named_property_getter.is_custom_property_query %}
305 {% set getter = named_property_getter %}
305 {# If there is an enumerator, there MUST be a query method to properly 306 {# If there is an enumerator, there MUST be a query method to properly
306 communicate property attributes. #} 307 communicate property attributes. #}
307 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb ackInfo<v8::Integer>& info) 308 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb ackInfo<v8::Integer>& info)
308 { 309 {
309 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 310 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
310 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); 311 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
311 v8::String::Utf8Value namedProperty(name); 312 v8::String::Utf8Value namedProperty(name);
312 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate()); 313 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
313 bool result = impl->namedPropertyQuery(propertyName, exceptionState); 314 {% set getter_arguments = ['propertyName', 'exceptionState'] %}
315 {% if getter.is_call_with_script_state %}
316 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
317 {% set getter_arguments = ['scriptState'] + getter_arguments %}
318 {% endif %}
319 bool result = impl->namedPropertyQuery({{getter_arguments | join(', ')}});
314 if (exceptionState.throwIfNeeded()) 320 if (exceptionState.throwIfNeeded())
315 return; 321 return;
316 if (!result) 322 if (!result)
317 return; 323 return;
318 v8SetReturnValueInt(info, v8::None); 324 v8SetReturnValueInt(info, v8::None);
319 } 325 }
320 326
321 {% endif %} 327 {% endif %}
322 {% endblock %} 328 {% endblock %}
323 329
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 } 1048 }
1043 1049
1044 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 1050 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
1045 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 1051 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
1046 { 1052 {
1047 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 1053 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
1048 } 1054 }
1049 {% endfor %} 1055 {% endfor %}
1050 {% endif %} 1056 {% endif %}
1051 {% endblock %} 1057 {% endblock %}
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/core/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698