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

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

Issue 27476003: IDL compiler: [Unforgeable] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 2 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
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}}(v8::Local<v8::Stri ng> name, const v8::PropertyCallbackInfo<v8::Value>& info) 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}(v8::Local<v8::Stri ng> name, const v8::PropertyCallbackInfo<v8::Value>& info)
5 { 5 {
6 {% if attribute.is_unforgeable %}
7 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class_name}}::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate())));
8 if (holder.IsEmpty())
9 return;
10 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(holder);
11 {% endif %}
6 {% if attribute.cached_attribute_validation_method %} 12 {% if attribute.cached_attribute_validation_method %}
7 v8::Handle<v8::String> propertyName = v8::String::NewSymbol("{{attribute.nam e}}"); 13 v8::Handle<v8::String> propertyName = v8::String::NewSymbol("{{attribute.nam e}}");
8 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder()); 14 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
9 if (!imp->{{attribute.cached_attribute_validation_method}}()) { 15 if (!imp->{{attribute.cached_attribute_validation_method}}()) {
10 v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(propertyName ); 16 v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(propertyName );
11 if (!value.IsEmpty()) { 17 if (!value.IsEmpty()) {
12 v8SetReturnValue(info, value); 18 v8SetReturnValue(info, value);
13 return; 19 return;
14 } 20 }
15 } 21 }
16 {% elif not attribute.is_static %} 22 {% elif not (attribute.is_static or attribute.is_unforgeable) %}
17 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder()); 23 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
18 {% endif %} 24 {% endif %}
19 {% if attribute.is_call_with_script_execution_context %} 25 {% if attribute.is_call_with_script_execution_context %}
20 ExecutionContext* scriptContext = getExecutionContext(); 26 ExecutionContext* scriptContext = getExecutionContext();
21 {% endif %} 27 {% endif %}
22 {# Special cases #} 28 {# Special cases #}
23 {% if attribute.is_check_security_for_node %} 29 {% if attribute.is_check_security_for_node %}
24 {# FIXME: consider using a local variable to not call getter twice #} 30 {# FIXME: consider using a local variable to not call getter twice #}
25 ExceptionState es(info.GetIsolate()); 31 ExceptionState es(info.GetIsolate());
26 if (!BindingSecurity::shouldAllowAccessToNode({{attribute.cpp_value}}, es)) { 32 if (!BindingSecurity::shouldAllowAccessToNode({{attribute.cpp_value}}, es)) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 {% endif %} 93 {% endif %}
88 {% if attribute.is_custom_getter %} 94 {% if attribute.is_custom_getter %}
89 {{v8_class_name}}::{{attribute.name}}AttributeGetterCustom(name, info); 95 {{v8_class_name}}::{{attribute.name}}AttributeGetterCustom(name, info);
90 {% else %} 96 {% else %}
91 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetter{{world_suffi x}}(name, info); 97 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetter{{world_suffi x}}(name, info);
92 {% endif %} 98 {% endif %}
93 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 99 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
94 } 100 }
95 {% endfilter %} 101 {% endfilter %}
96 {% endmacro %} 102 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_attributes.py ('k') | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698