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

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

Issue 537403002: bindings: Renames from/toInternalPointer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 3 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/v8_types.py ('k') | Source/bindings/templates/dictionary_v8.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}}( 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 {
11 {% if attribute.is_reflect and not attribute.is_url 11 {% if attribute.is_reflect and not attribute.is_url
12 and attribute.idl_type == 'DOMString' and is_node 12 and attribute.idl_type == 'DOMString' and is_node
13 and not attribute.is_implemented_in_private_script %} 13 and not attribute.is_implemented_in_private_script %}
14 {% set cpp_class, v8_class = 'Element', 'V8Element' %} 14 {% set cpp_class, v8_class = 'Element', 'V8Element' %}
15 {% endif %} 15 {% endif %}
16 {# holder #} 16 {# holder #}
17 {% if not attribute.is_static %} 17 {% if not attribute.is_static %}
18 v8::Handle<v8::Object> holder = info.Holder(); 18 v8::Handle<v8::Object> holder = info.Holder();
19 {% endif %} 19 {% endif %}
20 {# impl #} 20 {# impl #}
21 {% if attribute.cached_attribute_validation_method %} 21 {% if attribute.cached_attribute_validation_method %}
22 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{a ttribute.name}}"); 22 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{a ttribute.name}}");
23 {{cpp_class}}* impl = {{v8_class}}::toNative(holder); 23 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
24 if (!impl->{{attribute.cached_attribute_validation_method}}()) { 24 if (!impl->{{attribute.cached_attribute_validation_method}}()) {
25 v8::Handle<v8::Value> v8Value = V8HiddenValue::getHiddenValue(info.GetIs olate(), holder, propertyName); 25 v8::Handle<v8::Value> v8Value = V8HiddenValue::getHiddenValue(info.GetIs olate(), holder, propertyName);
26 if (!v8Value.IsEmpty()) { 26 if (!v8Value.IsEmpty()) {
27 v8SetReturnValue(info, v8Value); 27 v8SetReturnValue(info, v8Value);
28 return; 28 return;
29 } 29 }
30 } 30 }
31 {% elif not attribute.is_static %} 31 {% elif not attribute.is_static %}
32 {{cpp_class}}* impl = {{v8_class}}::toNative(holder); 32 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
33 {% endif %} 33 {% endif %}
34 {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %} 34 {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %}
35 if (!impl->document()) 35 if (!impl->document())
36 return; 36 return;
37 {% endif %} 37 {% endif %}
38 {# Local variables #} 38 {# Local variables #}
39 {% if attribute.is_call_with_execution_context %} 39 {% if attribute.is_call_with_execution_context %}
40 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ()); 40 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
41 {% endif %} 41 {% endif %}
42 {% if attribute.is_call_with_script_state %} 42 {% if attribute.is_call_with_script_state %}
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 {# Type checking for interface types (if interface not implemented, throw 218 {# Type checking for interface types (if interface not implemented, throw
219 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 219 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
220 if ({% if attribute.is_nullable %}!isUndefinedOrNull(v8Value) && {% endif %} !V8{{attribute.idl_type}}::hasInstance(v8Value, info.GetIsolate())) { 220 if ({% if attribute.is_nullable %}!isUndefinedOrNull(v8Value) && {% endif %} !V8{{attribute.idl_type}}::hasInstance(v8Value, info.GetIsolate())) {
221 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'."); 221 exceptionState.throwTypeError("The provided value is not of type '{{attr ibute.idl_type}}'.");
222 exceptionState.throwIfNeeded(); 222 exceptionState.throwIfNeeded();
223 return; 223 return;
224 } 224 }
225 {% endif %} 225 {% endif %}
226 {# impl #} 226 {# impl #}
227 {% if attribute.put_forwards %} 227 {% if attribute.put_forwards %}
228 {{cpp_class}}* proxyImpl = {{v8_class}}::toNative(holder); 228 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder);
229 {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); 229 {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}());
230 if (!impl) 230 if (!impl)
231 return; 231 return;
232 {% elif not attribute.is_static %} 232 {% elif not attribute.is_static %}
233 {{cpp_class}}* impl = {{v8_class}}::toNative(holder); 233 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
234 {% endif %} 234 {% endif %}
235 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %} 235 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %}
236 if (!impl->document()) 236 if (!impl->document())
237 return; 237 return;
238 {% endif %} 238 {% endif %}
239 {# Convert JS value to C++ value #} 239 {# Convert JS value to C++ value #}
240 {% if attribute.idl_type != 'EventHandler' %} 240 {% if attribute.idl_type != 'EventHandler' %}
241 {{attribute.v8_value_to_local_cpp_value}}; 241 {{attribute.v8_value_to_local_cpp_value}};
242 {% elif not is_node %}{# EventHandler hack #} 242 {% elif not is_node %}{# EventHandler hack #}
243 moveEventListenerToNewWrapper(holder, {{attribute.event_handler_getter_expre ssion}}, v8Value, {{v8_class}}::eventListenerCacheIndex, info.GetIsolate()); 243 moveEventListenerToNewWrapper(holder, {{attribute.event_handler_getter_expre ssion}}, v8Value, {{v8_class}}::eventListenerCacheIndex, info.GetIsolate());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 {% endif %} 307 {% endif %}
308 {% if world_suffix in attribute.activity_logging_world_list_for_setter %} 308 {% if world_suffix in attribute.activity_logging_world_list_for_setter %}
309 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext()); 309 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext());
310 V8PerContextData* contextData = scriptState->perContextData(); 310 V8PerContextData* contextData = scriptState->perContextData();
311 {% if attribute.activity_logging_world_check %} 311 {% if attribute.activity_logging_world_check %}
312 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) { 312 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) {
313 {% else %} 313 {% else %}
314 if (contextData && contextData->activityLogger()) { 314 if (contextData && contextData->activityLogger()) {
315 {% endif %} 315 {% endif %}
316 {% if attribute.activity_logging_include_old_value_for_setter %} 316 {% if attribute.activity_logging_include_old_value_for_setter %}
317 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder()); 317 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
318 {% if attribute.cpp_value_original %} 318 {% if attribute.cpp_value_original %}
319 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_ori ginal}}); 319 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_ori ginal}});
320 {% endif %} 320 {% endif %}
321 v8::Handle<v8::Value> originalValue = {{attribute.cpp_value_to_v8_value} }; 321 v8::Handle<v8::Value> originalValue = {{attribute.cpp_value_to_v8_value} };
322 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value, originalValue); 322 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value, originalValue);
323 {% else %} 323 {% else %}
324 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value); 324 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value);
325 {% endif %} 325 {% endif %}
326 } 326 }
327 {% endif %} 327 {% endif %}
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 access_control, 445 access_control,
446 property_attribute, 446 property_attribute,
447 only_exposed_to_private_script, 447 only_exposed_to_private_script,
448 ] %} 448 ] %}
449 {% if not attribute.is_expose_js_accessors %} 449 {% if not attribute.is_expose_js_accessors %}
450 {% set attribute_configuration_list = attribute_configuration_list 450 {% set attribute_configuration_list = attribute_configuration_list
451 + [on_prototype] %} 451 + [on_prototype] %}
452 {% endif %} 452 {% endif %}
453 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 453 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
454 {%- endmacro %} 454 {%- endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_types.py ('k') | Source/bindings/templates/dictionary_v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698