OLD | NEW |
---|---|
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}}( | 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
5 {%- if attribute.is_expose_js_accessors %} | 5 {%- if attribute.is_expose_js_accessors %} |
6 const v8::FunctionCallbackInfo<v8::Value>& info | 6 const v8::FunctionCallbackInfo<v8::Value>& info |
7 {%- else %} | 7 {%- else %} |
8 const v8::PropertyCallbackInfo<v8::Value>& info | 8 const v8::PropertyCallbackInfo<v8::Value>& info |
9 {%- endif %}) | 9 {%- endif %}) |
10 { | 10 { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 {% if attribute.activity_logging_world_check %} | 158 {% if attribute.activity_logging_world_check %} |
159 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) | 159 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) |
160 {% else %} | 160 {% else %} |
161 if (contextData && contextData->activityLogger()) | 161 if (contextData && contextData->activityLogger()) |
162 {% endif %} | 162 {% endif %} |
163 contextData->activityLogger()->logGetter("{{interface_name}}.{{attribute .name}}"); | 163 contextData->activityLogger()->logGetter("{{interface_name}}.{{attribute .name}}"); |
164 {% endif %} | 164 {% endif %} |
165 {% if attribute.has_custom_getter %} | 165 {% if attribute.has_custom_getter %} |
166 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info); | 166 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info); |
167 {% else %} | 167 {% else %} |
168 {% if is_partial %} | |
169 {{cpp_class}}PartialV8Internal::{{attribute.name}}AttributeGetter{{world_suf fix}}(info); | |
170 {% else %} | |
168 {{cpp_class}}V8Internal::{{attribute.name}}AttributeGetter{{world_suffix}}(i nfo); | 171 {{cpp_class}}V8Internal::{{attribute.name}}AttributeGetter{{world_suffix}}(i nfo); |
169 {% endif %} | 172 {% endif %} |
173 {% endif %} | |
170 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 174 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
171 } | 175 } |
172 {% endfilter %} | 176 {% endfilter %} |
173 {% endmacro %} | 177 {% endmacro %} |
174 | 178 |
175 | 179 |
176 {##############################################################################} | 180 {##############################################################################} |
177 {% macro constructor_getter_callback(attribute, world_suffix) %} | 181 {% macro constructor_getter_callback(attribute, world_suffix) %} |
178 {% filter conditional(attribute.conditional_string) %} | 182 {% filter conditional(attribute.conditional_string) %} |
179 static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca l<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) | 183 static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca l<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) |
180 { | 184 { |
181 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 185 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
182 {% if attribute.deprecate_as %} | 186 {% if attribute.deprecate_as %} |
183 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), Use Counter::{{attribute.deprecate_as}}); | 187 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), Use Counter::{{attribute.deprecate_as}}); |
184 {% endif %} | 188 {% endif %} |
185 {% if attribute.measure_as %} | 189 {% if attribute.measure_as %} |
186 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{ attribute.measure_as}}); | 190 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{ attribute.measure_as}}); |
187 {% endif %} | 191 {% endif %} |
192 {% if is_partial %} | |
193 {{cpp_class}}PartialV8Internal::{{cpp_class}}ConstructorGetter{{world_suffix }}(property, info); | |
haraken
2014/10/09 04:24:00
Is it possible that a partial interface has a cons
tasak
2014/10/10 07:52:23
This code is used for ServiceWorker, i.e.:
partia
| |
194 {% else %} | |
188 {{cpp_class}}V8Internal::{{cpp_class}}ConstructorGetter{{world_suffix}}(prop erty, info); | 195 {{cpp_class}}V8Internal::{{cpp_class}}ConstructorGetter{{world_suffix}}(prop erty, info); |
196 {% endif %} | |
189 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 197 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
190 } | 198 } |
191 {% endfilter %} | 199 {% endfilter %} |
192 {% endmacro %} | 200 {% endmacro %} |
193 | 201 |
194 | 202 |
195 {##############################################################################} | 203 {##############################################################################} |
196 {% macro attribute_setter(attribute, world_suffix) %} | 204 {% macro attribute_setter(attribute, world_suffix) %} |
197 {% filter conditional(attribute.conditional_string) %} | 205 {% filter conditional(attribute.conditional_string) %} |
198 static void {{attribute.name}}AttributeSetter{{world_suffix}}( | 206 static void {{attribute.name}}AttributeSetter{{world_suffix}}( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 {% endif %} | 323 {% endif %} |
316 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value); | 324 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value); |
317 } | 325 } |
318 {% endif %} | 326 {% endif %} |
319 {% if attribute.is_custom_element_callbacks or attribute.is_reflect %} | 327 {% if attribute.is_custom_element_callbacks or attribute.is_reflect %} |
320 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 328 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
321 {% endif %} | 329 {% endif %} |
322 {% if attribute.has_custom_setter %} | 330 {% if attribute.has_custom_setter %} |
323 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); | 331 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); |
324 {% else %} | 332 {% else %} |
333 {% if is_partial %} | |
334 {{cpp_class}}PartialV8Internal::{{attribute.name}}AttributeSetter{{world_suf fix}}(v8Value, info); | |
335 {% else %} | |
325 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info); | 336 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info); |
326 {% endif %} | 337 {% endif %} |
338 {% endif %} | |
327 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 339 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
328 } | 340 } |
329 {% endfilter %} | 341 {% endfilter %} |
330 {% endmacro %} | 342 {% endmacro %} |
331 | 343 |
332 | 344 |
333 {##############################################################################} | 345 {##############################################################################} |
334 {% macro attribute_getter_implemented_in_private_script(attribute) %} | 346 {% macro attribute_getter_implemented_in_private_script(attribute) %} |
335 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeGetter(LocalFrame* frame, {{cpp_class}}* holderImpl, {{attribute.cpp_type}}* result) | 347 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeGetter(LocalFrame* frame, {{cpp_class}}* holderImpl, {{attribute.cpp_type}}* result) |
336 { | 348 { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate()); | 392 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate()); |
381 | 393 |
382 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() ); | 394 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() ); |
383 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "{{cpp_class}}", "{{attribute.name}}", holder, {{attribute.private_s cript_cpp_value_to_v8_value}}); | 395 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "{{cpp_class}}", "{{attribute.name}}", holder, {{attribute.private_s cript_cpp_value_to_v8_value}}); |
384 } | 396 } |
385 {% endmacro %} | 397 {% endmacro %} |
386 | 398 |
387 | 399 |
388 {##############################################################################} | 400 {##############################################################################} |
389 {% macro attribute_configuration(attribute) %} | 401 {% macro attribute_configuration(attribute) %} |
402 {% set empty_or_partial = '' if not is_partial else 'Partial' %} | |
haraken
2014/10/09 04:24:00
As commented in another place, we want to avoid cr
tasak
2014/10/10 07:52:23
Done.
Added "acutal_cpp_class" and "actual_v8_clas
| |
390 {% set getter_callback = | 403 {% set getter_callback = |
391 '%sV8Internal::%sAttributeGetterCallback' % | 404 '%s%sV8Internal::%sAttributeGetterCallback' % |
392 (cpp_class, attribute.name) | 405 (cpp_class, empty_or_partial, attribute.name) |
393 if not attribute.constructor_type else | 406 if not attribute.constructor_type else |
394 ('%sV8Internal::%sConstructorGetterCallback' % | 407 ('%s%sV8Internal::%sConstructorGetterCallback' % |
395 (cpp_class, attribute.name) | 408 (cpp_class, empty_or_partial, attribute.name) |
396 if attribute.needs_constructor_getter_callback else | 409 if attribute.needs_constructor_getter_callback else |
397 '{0}V8Internal::{0}ConstructorGetter'.format(cpp_class)) %} | 410 '%s%sV8Internal::%sConstructorGetter' % (cpp_class, empty_or_partial, cpp _class)) %} |
398 {% set getter_callback_for_main_world = | 411 {% set getter_callback_for_main_world = |
399 '%sV8Internal::%sAttributeGetterCallbackForMainWorld' % | 412 '%s%sV8Internal::%sAttributeGetterCallbackForMainWorld' % |
400 (cpp_class, attribute.name) | 413 (cpp_class, empty_or_partial, attribute.name) |
401 if attribute.is_per_world_bindings else '0' %} | 414 if attribute.is_per_world_bindings else '0' %} |
402 {% set setter_callback = attribute.setter_callback %} | 415 {% set setter_callback = attribute.setter_callback %} |
403 {% set setter_callback_for_main_world = | 416 {% set setter_callback_for_main_world = |
404 '%sV8Internal::%sAttributeSetterCallbackForMainWorld' % | 417 '%s%sV8Internal::%sAttributeSetterCallbackForMainWorld' % |
405 (cpp_class, attribute.name) | 418 (cpp_class, empty_or_partial, attribute.name) |
406 if attribute.is_per_world_bindings and | 419 if attribute.is_per_world_bindings and |
407 (not attribute.is_read_only or attribute.put_forwards) else '0' %} | 420 (not attribute.is_read_only or attribute.put_forwards) else '0' %} |
408 {% set wrapper_type_info = | 421 {% set wrapper_type_info = |
409 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % | 422 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % |
410 attribute.constructor_type | 423 attribute.constructor_type |
411 if attribute.constructor_type else '0' %} | 424 if attribute.constructor_type else '0' %} |
412 {% set access_control = 'static_cast<v8::AccessControl>(%s)' % | 425 {% set access_control = 'static_cast<v8::AccessControl>(%s)' % |
413 ' | '.join(attribute.access_control_list) %} | 426 ' | '.join(attribute.access_control_list) %} |
414 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % | 427 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % |
415 ' | '.join(attribute.property_attributes) %} | 428 ' | '.join(attribute.property_attributes) %} |
(...skipping 11 matching lines...) Expand all Loading... | |
427 access_control, | 440 access_control, |
428 property_attribute, | 441 property_attribute, |
429 only_exposed_to_private_script, | 442 only_exposed_to_private_script, |
430 ] %} | 443 ] %} |
431 {% if not attribute.is_expose_js_accessors %} | 444 {% if not attribute.is_expose_js_accessors %} |
432 {% set attribute_configuration_list = attribute_configuration_list | 445 {% set attribute_configuration_list = attribute_configuration_list |
433 + [on_prototype] %} | 446 + [on_prototype] %} |
434 {% endif %} | 447 {% endif %} |
435 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 448 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
436 {%- endmacro %} | 449 {%- endmacro %} |
OLD | NEW |