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

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

Issue 563703002: Oilpan: Enable oilpan for callback classes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
OLDNEW
1 {##############################################################################} 1 {##############################################################################}
2 {% macro generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {# Local variables #} 6 {# Local variables #}
7 {% if method.has_exception_state %} 7 {% if method.has_exception_state %}
8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
9 {% endif %} 9 {% endif %}
10 {# Overloaded methods have length checked during overload resolution #} 10 {# Overloaded methods have length checked during overload resolution #}
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 {% endmacro %} 82 {% endmacro %}
83 83
84 84
85 {######################################} 85 {######################################}
86 {% macro generate_argument_var_declaration(argument) %} 86 {% macro generate_argument_var_declaration(argument) %}
87 {% if argument.is_callback_interface %} 87 {% if argument.is_callback_interface %}
88 {# FIXME: remove EventListener special case #} 88 {# FIXME: remove EventListener special case #}
89 {% if argument.idl_type == 'EventListener' %} 89 {% if argument.idl_type == 'EventListener' %}
90 RefPtr<{{argument.idl_type}}> {{argument.name}} 90 RefPtr<{{argument.idl_type}}> {{argument.name}}
91 {%- else %} 91 {%- else %}
92 OwnPtrWillBeRawPtr<{{argument.idl_type}}> {{argument.name}} = nullptr; 92 {{argument.idl_type}}* {{argument.name}} = nullptr;
sof 2014/09/18 11:38:54 nit: ";" at the end appears redundant.
Jens Widell 2014/09/18 12:13:19 I think we can (and should) remove the special han
keishi 2014/09/19 06:43:34 Done.
93 {%- endif %}{# argument.idl_type == 'EventListener' #} 93 {%- endif %}{# argument.idl_type == 'EventListener' #}
94 {%- else %} 94 {%- else %}
95 {{argument.cpp_type}} {{argument.name}} 95 {{argument.cpp_type}} {{argument.name}}
96 {%- endif %} 96 {%- endif %}
97 {% endmacro %} 97 {% endmacro %}
98 98
99 99
100 {######################################} 100 {######################################}
101 {% macro generate_argument(method, argument, world_suffix) %} 101 {% macro generate_argument(method, argument, world_suffix) %}
102 {% if argument.is_optional and not argument.has_default and 102 {% if argument.is_optional and not argument.has_default and
(...skipping 30 matching lines...) Expand all
133 {% if argument.idl_type == 'EventListener' %} 133 {% if argument.idl_type == 'EventListener' %}
134 {% if method.name == 'removeEventListener' or method.name == 'removeListener' %} 134 {% if method.name == 'removeEventListener' or method.name == 'removeListener' %}
135 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly); 135 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly);
136 {% else %}{# method.name == 'addEventListener' #} 136 {% else %}{# method.name == 'addEventListener' #}
137 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate); 137 {{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(i nfo.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate);
138 {% endif %}{# method.name #} 138 {% endif %}{# method.name #}
139 {% else %}{# argument.idl_type == 'EventListener' #} 139 {% else %}{# argument.idl_type == 'EventListener' #}
140 {# Callback functions must be functions: 140 {# Callback functions must be functions:
141 http://www.w3.org/TR/WebIDL/#es-callback-function #} 141 http://www.w3.org/TR/WebIDL/#es-callback-function #}
142 {% if argument.is_optional %} 142 {% if argument.is_optional %}
143 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind ex}}])) { 143 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind ex}}])) {
Jens Widell 2014/09/18 12:13:19 We could skip the "info.Length() > {{argument.inde
keishi 2014/09/19 06:44:15 Done.
144 if (!info[{{argument.index}}]->IsFunction()) { 144 if (!info[{{argument.index}}]->IsFunction()) {
145 {{throw_type_error(method, 145 {{throw_type_error(method,
146 '"The callback provided as parameter %s is not a function."' % 146 '"The callback provided as parameter %s is not a function."' %
147 (argument.index + 1)) | indent(8)}} 147 (argument.index + 1)) | indent(8)}}
148 return; 148 return;
149 } 149 }
150 {{argument.name}} = V8{{argument.idl_type}}::create(v8::Handle<v8::Function> ::Cast(info[{{argument.index}}]), ScriptState::current(info.GetIsolate())); 150 {{argument.name}} = V8{{argument.idl_type}}::create(v8::Handle<v8::Function> ::Cast(info[{{argument.index}}]), ScriptState::current(info.GetIsolate()));
151 } 151 }
Jens Widell 2014/09/18 12:13:19 Change this to } else { {{argument.name}} =
keishi 2014/09/19 06:43:34 Done.
152 {% else %}{# argument.is_optional #} 152 {% else %}{# argument.is_optional #}
153 if (info.Length() <= {{argument.index}} || !{% if argument.is_nullable %}(info[{ {argument.index}}]->IsFunction() || info[{{argument.index}}]->IsNull()){% else % }info[{{argument.index}}]->IsFunction(){% endif %}) { 153 if (info.Length() <= {{argument.index}} || !{% if argument.is_nullable %}(info[{ {argument.index}}]->IsFunction() || info[{{argument.index}}]->IsNull()){% else % }info[{{argument.index}}]->IsFunction(){% endif %}) {
154 {{throw_type_error(method, 154 {{throw_type_error(method,
155 '"The callback provided as parameter %s is not a function."' % 155 '"The callback provided as parameter %s is not a function."' %
156 (argument.index + 1)) | indent }} 156 (argument.index + 1)) | indent }}
157 return; 157 return;
158 } 158 }
159 {{argument.name}} = {% if argument.is_nullable %}info[{{argument.index}}]->IsNul l() ? nullptr : {% endif %}V8{{argument.idl_type}}::create(v8::Handle<v8::Functi on>::Cast(info[{{argument.index}}]), ScriptState::current(info.GetIsolate())); 159 {{argument.name}} = {% if argument.is_nullable %}info[{{argument.index}}]->IsNul l() ? nullptr : {% endif %}V8{{argument.idl_type}}::create(v8::Handle<v8::Functi on>::Cast(info[{{argument.index}}]), ScriptState::current(info.GetIsolate()));
160 {% endif %}{# argument.is_optional #} 160 {% endif %}{# argument.is_optional #}
161 {% endif %}{# argument.idl_type == 'EventListener' #} 161 {% endif %}{# argument.idl_type == 'EventListener' #}
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 if method.is_per_world_bindings else '0' %} 637 if method.is_per_world_bindings else '0' %}
638 {% set property_attribute = 638 {% set property_attribute =
639 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es) 639 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es)
640 if method.property_attributes else 'v8::None' %} 640 if method.property_attributes else 'v8::None' %}
641 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %} 641 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %}
642 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = { 642 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = {
643 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}, 643 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}},
644 }; 644 };
645 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); 645 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate);
646 {%- endmacro %} 646 {%- endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/callback_interface.h ('k') | Source/bindings/tests/results/core/V8TestCallbackInterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698