Chromium Code Reviews| Index: Source/bindings/templates/interface.cpp |
| diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp |
| index 4d3a7140fce0eea58d8447ae1dc87eaaf8d6b5d1..9c41e59942394cf0c31a758abc84fa296e6847f4 100644 |
| --- a/Source/bindings/templates/interface.cpp |
| +++ b/Source/bindings/templates/interface.cpp |
| @@ -98,6 +98,31 @@ bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 |
| {##############################################################################} |
| +{% block anonymous_indexed_property_getter_and_callback %} |
| +{% if anonymous_indexed_property_getter %} |
| +{% set getter = anonymous_indexed_property_getter %} |
| +static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) |
| +{ |
| + ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); |
|
haraken
2014/01/27 06:35:32
You can remove this. It's guaranteed that info.Hol
Nils Barth (inactive)
2014/01/27 06:59:35
Got it, posted CL:
Remove unnecessary maybeDOMWrap
|
| + {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder()); |
| + {{getter.cpp_type}} element = collection->{{getter.name}}(index); |
| + if ({{getter.is_null_expression}}) |
| + return; |
| + {{getter.v8_set_return_value}}; |
| +} |
| + |
| +static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) |
| +{ |
| + TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
| + {{cpp_class}}V8Internal::indexedPropertyGetter(index, info); |
| + TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| +} |
| + |
| +{% endif %} |
| +{% endblock %} |
| + |
| + |
| +{##############################################################################} |
| {% block origin_safe_method_setter %} |
| {% if has_origin_safe_method_setter %} |
| static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| @@ -464,6 +489,9 @@ static void configure{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> funct |
| {% if constants %} |
| {{install_constants() | indent}} |
| {% endif %} |
| + {% if anonymous_indexed_property_getter %} |
| + functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler({{cpp_class}}V8Internal::indexedPropertyGetterCallback, 0, 0, 0, indexedPropertyEnumerator<{{cpp_class}}>); |
| + {% endif %} |
| {% if has_custom_legacy_call_as_function %} |
| functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}::legacyCallCustom); |
| {% endif %} |