18abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles){##############################################################################}
2bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% macro attribute_getter(attribute, world_suffix) %}
31e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles){% filter conditional(attribute.conditional_string) %}
451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)static void {{attribute.name}}AttributeGetter{{world_suffix}}(
551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- if attribute.is_expose_js_accessors %}
651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)const v8::FunctionCallbackInfo<v8::Value>& info
751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- else %}
851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)const v8::PropertyCallbackInfo<v8::Value>& info
951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- endif %})
10c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles){
11bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.is_unforgeable %}
12a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{v8_class}}::domTemplate(info.GetIsolate(), worldType(info.GetIsolate())));
13bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    if (holder.IsEmpty())
14bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        return;
15a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {{cpp_class}}* imp = {{v8_class}}::toNative(holder);
16bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
171e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% if attribute.cached_attribute_validation_method %}
18a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    v8::Handle<v8::String> propertyName = v8::String::NewFromUtf8(info.GetIsolate(), "{{attribute.name}}", v8::String::kInternalizedString);
19a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
201e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    if (!imp->{{attribute.cached_attribute_validation_method}}()) {
21bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        v8::Handle<v8::Value> jsValue = info.Holder()->GetHiddenValue(propertyName);
22bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        if (!jsValue.IsEmpty()) {
23bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)            v8SetReturnValue(info, jsValue);
241e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)            return;
251e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)        }
261e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    }
27bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% elif not (attribute.is_static or attribute.is_unforgeable) %}
28a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
291e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
3051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    {% if attribute.is_call_with_execution_context %}
311e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    ExecutionContext* scriptContext = getExecutionContext();
321e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
331e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {# Special cases #}
34a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {% if attribute.is_check_security_for_node or
35a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)          attribute.is_getter_raises_exception %}
36a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
37a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {% endif %}
381e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% if attribute.is_check_security_for_node %}
391e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {# FIXME: consider using a local variable to not call getter twice #}
4051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    if (!BindingSecurity::shouldAllowAccessToNode({{attribute.cpp_value}}, exceptionState)) {
411e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)        v8SetReturnValueNull(info);
4251b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)        exceptionState.throwIfNeeded();
431e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)        return;
441e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    }
451e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
461e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% if attribute.is_getter_raises_exception %}
471e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}};
4851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    if (UNLIKELY(exceptionState.throwIfNeeded()))
491e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)        return;
501e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
511e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% if attribute.is_nullable %}
521e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    bool isNull = false;
531e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}};
541e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    if (isNull) {
551e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)        v8SetReturnValueNull(info);
561e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)        return;
571e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    }
581e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% elif attribute.idl_type == 'EventHandler' or
591e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)            attribute.cached_attribute_validation_method %}
601e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {# FIXME: consider merging all these assign to local variable statements #}
611e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}};
621e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
631e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% if attribute.cached_attribute_validation_method %}
641e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    info.Holder()->SetHiddenValue(propertyName, {{attribute.cpp_value}}.v8Value());
651e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
661e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {# End special cases #}
671e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% if attribute.is_keep_alive_for_gc %}
681e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {{attribute.cpp_type}} result = {{attribute.cpp_value}};
691e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    if (result && DOMDataStore::setReturnValueFromWrapper<{{attribute.v8_type}}>(info.GetReturnValue(), result.get()))
70c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)        return;
71c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)    v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
72c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)    if (!wrapper.IsEmpty()) {
73c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)        V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "{{attribute.name}}", wrapper);
74bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        {{attribute.v8_set_return_value}};
75c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)    }
761e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% else %}
77bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {{attribute.v8_set_return_value}};
781e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
79c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)}
801e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles){% endfilter %}
81c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles){% endmacro %}
82c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)
83c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)
84c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles){##############################################################################}
85bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% macro attribute_getter_callback(attribute, world_suffix) %}
861e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles){% filter conditional(attribute.conditional_string) %}
8751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)static void {{attribute.name}}AttributeGetterCallback{{world_suffix}}(
8851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- if attribute.is_expose_js_accessors %}
8951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)const v8::FunctionCallbackInfo<v8::Value>& info
9051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- else %}
9151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info
9251b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- endif %})
93c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles){
94c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)    TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
951e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% if attribute.deprecate_as %}
961e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    UseCounter::countDeprecation(activeExecutionContext(), UseCounter::{{attribute.deprecate_as}});
971e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
981e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% if attribute.measure_as %}
991e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    UseCounter::count(activeDOMWindow(), UseCounter::{{attribute.measure_as}});
1001e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
101bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if world_suffix in attribute.activity_logging_world_list_for_getter %}
1021e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
1031e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    if (contextData && contextData->activityLogger())
1041e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)        contextData->activityLogger()->log("{{interface_name}}.{{attribute.name}}", 0, 0, "Getter");
1051e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
106bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.has_custom_getter %}
107a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info);
1081e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% else %}
109a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {{cpp_class}}V8Internal::{{attribute.name}}AttributeGetter{{world_suffix}}(info);
110bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
111bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
112bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)}
113bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% endfilter %}
114bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% endmacro %}
115bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
116bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
117bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){##############################################################################}
118bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% macro attribute_setter(attribute, world_suffix) %}
119bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% filter conditional(attribute.conditional_string) %}
12051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)static void {{attribute.name}}AttributeSetter{{world_suffix}}(
12151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- if attribute.is_expose_js_accessors %}
12251b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)v8::Local<v8::Value> jsValue, const v8::FunctionCallbackInfo<v8::Value>& info
12351b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- else %}
12451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
12551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- endif %})
126bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){
127a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {% if attribute.is_setter_raises_exception or
128a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)          attribute.has_strict_type_checking %}
129a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
130a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {% endif %}
131bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.has_strict_type_checking %}
132bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {# Type checking for interface types (if interface not implemented, throw
133bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)       TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
13451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    if (!isUndefinedOrNull(jsValue) && !V8{{attribute.idl_type}}::hasInstance(jsValue, info.GetIsolate(), worldType(info.GetIsolate()))) {
135a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)        exceptionState.throwTypeError("The provided value is not of type '{{attribute.idl_type}}'.");
136a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)        exceptionState.throwIfNeeded();
137bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        return;
138bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    }
139bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
140bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if not attribute.is_static %}
141a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
142bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
143bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %}
144bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    if (!imp->document())
145bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        return;
146bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
147bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.idl_type != 'EventHandler' %}
148bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {{attribute.v8_value_to_local_cpp_value}};
149bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% else %}{# EventHandler hack #}
150a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    transferHiddenDependency(info.Holder(), {{attribute.event_handler_getter_expression}}, jsValue, {{v8_class}}::eventListenerCacheIndex, info.GetIsolate());
151bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
152bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.enum_validation_expression %}
153f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    {# Setter ignores invalid enum values: http://www.w3.org/TR/WebIDL/#idl-enums #}
154bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    String string = cppValue;
155bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    if (!({{attribute.enum_validation_expression}}))
156bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        return;
157bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
158bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.is_reflect %}
159bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
160bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
16151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    {% if attribute.is_call_with_execution_context %}
162bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    ExecutionContext* scriptContext = getExecutionContext();
163bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
164bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {{attribute.cpp_setter}};
165bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.is_setter_raises_exception %}
16651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    exceptionState.throwIfNeeded();
167bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
168bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.cached_attribute_validation_method %}
169a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    info.Holder()->DeleteHiddenValue(v8::String::NewFromUtf8(info.GetIsolate(), "{{attribute.name}}", v8::String::kInternalizedString)); // Invalidate the cached value.
170bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
171bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)}
172bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% endfilter %}
173bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% endmacro %}
174bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
175bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)
176bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){##############################################################################}
177bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% macro attribute_setter_callback(attribute, world_suffix) %}
178bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){% filter conditional(attribute.conditional_string) %}
17951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)static void {{attribute.name}}AttributeSetterCallback{{world_suffix}}(
18051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- if attribute.is_expose_js_accessors %}
18151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)const v8::FunctionCallbackInfo<v8::Value>& info
18251b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- else %}
18351b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
18451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){%- endif %})
185bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){
18651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    {% if attribute.is_expose_js_accessors %}
18751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    v8::Local<v8::Value> jsValue = info[0];
18851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    {% endif %}
189bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
190bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.deprecate_as %}
191bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    UseCounter::countDeprecation(activeExecutionContext(), UseCounter::{{attribute.deprecate_as}});
192bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
193bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.measure_as %}
194bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    UseCounter::count(activeDOMWindow(), UseCounter::{{attribute.measure_as}});
195bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
196bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if world_suffix in attribute.activity_logging_world_list_for_setter %}
197bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
198bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    if (contextData && contextData->activityLogger()) {
199bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        v8::Handle<v8::Value> loggerArg[] = { jsValue };
200bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)        contextData->activityLogger()->log("{{interface_name}}.{{attribute.name}}", 1, &loggerArg[0], "Setter");
201bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    }
202bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
203bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.is_reflect %}
204bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
205bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% endif %}
206bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% if attribute.has_custom_setter %}
207a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info);
208bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)    {% else %}
209a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(jsValue, info);
2101e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    {% endif %}
211c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)    TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
212c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)}
2131e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles){% endfilter %}
214c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles){% endmacro %}
215