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

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

Issue 202203009: Rename |imp| => |impl| in bindings generation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: custom/v8 too Created 6 years, 9 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/templates/attributes.cpp ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 ('%sV8Internal::%sConstructorGetterCallback' % 10 ('%sV8Internal::%sConstructorGetterCallback' %
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 {% endblock %} 78 {% endblock %}
79 79
80 80
81 {##############################################################################} 81 {##############################################################################}
82 {% block replaceable_attribute_setter_and_callback %} 82 {% block replaceable_attribute_setter_and_callback %}
83 {% if has_replaceable_attributes or has_constructor_attributes %} 83 {% if has_replaceable_attributes or has_constructor_attributes %}
84 {# FIXME: rename to ForceSetAttributeOnThis, since also used for Constructors #} 84 {# FIXME: rename to ForceSetAttributeOnThis, since also used for Constructors #}
85 static void {{cpp_class}}ReplaceableAttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 85 static void {{cpp_class}}ReplaceableAttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
86 { 86 {
87 {% if is_check_security %} 87 {% if is_check_security %}
88 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 88 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
89 v8::String::Utf8Value attributeName(name); 89 v8::String::Utf8Value attributeName(name);
90 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate()); 90 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate());
91 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), imp->frame (), exceptionState)) { 91 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) {
92 exceptionState.throwIfNeeded(); 92 exceptionState.throwIfNeeded();
93 return; 93 return;
94 } 94 }
95 {% endif %} 95 {% endif %}
96 info.This()->ForceSet(name, jsValue); 96 info.This()->ForceSet(name, jsValue);
97 } 97 }
98 98
99 {# FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constru ctors #} 99 {# FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constru ctors #}
100 static void {{cpp_class}}ReplaceableAttributeSetterCallback(v8::Local<v8::String > name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info ) 100 static void {{cpp_class}}ReplaceableAttributeSetterCallback(v8::Local<v8::String > name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info )
101 { 101 {
102 {{cpp_class}}V8Internal::{{cpp_class}}ReplaceableAttributeSetter(name, jsVal ue, info); 102 {{cpp_class}}V8Internal::{{cpp_class}}ReplaceableAttributeSetter(name, jsVal ue, info);
103 } 103 }
104 104
105 {% endif %} 105 {% endif %}
106 {% endblock %} 106 {% endblock %}
107 107
108 108
109 {##############################################################################} 109 {##############################################################################}
110 {% block security_check_functions %} 110 {% block security_check_functions %}
111 {% if is_check_security and interface_name != 'Window' %} 111 {% if is_check_security and interface_name != 'Window' %}
112 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>) 112 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>)
113 { 113 {
114 {{cpp_class}}* imp = {{v8_class}}::toNative(host); 114 {{cpp_class}}* impl = {{v8_class}}::toNative(host);
115 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), imp->frame(), DoNotReportSecurityError); 115 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
116 } 116 }
117 117
118 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>) 118 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>)
119 { 119 {
120 {{cpp_class}}* imp = {{v8_class}}::toNative(host); 120 {{cpp_class}}* impl = {{v8_class}}::toNative(host);
121 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), imp->frame(), DoNotReportSecurityError); 121 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
122 } 122 }
123 123
124 {% endif %} 124 {% endif %}
125 {% endblock %} 125 {% endblock %}
126 126
127 127
128 {##############################################################################} 128 {##############################################################################}
129 {% block indexed_property_getter %} 129 {% block indexed_property_getter %}
130 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 130 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
131 {% set getter = indexed_property_getter %} 131 {% set getter = indexed_property_getter %}
132 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) 132 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
133 { 133 {
134 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 134 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
135 {% if getter.is_raises_exception %} 135 {% if getter.is_raises_exception %}
136 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate()); 136 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate());
137 {% endif %} 137 {% endif %}
138 {% set getter_name = getter.name or 'anonymousIndexedGetter' %} 138 {% set getter_name = getter.name or 'anonymousIndexedGetter' %}
139 {% set getter_arguments = ['index', 'exceptionState'] 139 {% set getter_arguments = ['index', 'exceptionState']
140 if getter.is_raises_exception else ['index'] %} 140 if getter.is_raises_exception else ['index'] %}
141 {{getter.cpp_type}} result = imp->{{getter_name}}({{getter_arguments|join(', ')}}); 141 {{getter.cpp_type}} result = impl->{{getter_name}}({{getter_arguments|join(' , ')}});
142 {% if getter.is_raises_exception %} 142 {% if getter.is_raises_exception %}
143 if (exceptionState.throwIfNeeded()) 143 if (exceptionState.throwIfNeeded())
144 return; 144 return;
145 {% endif %} 145 {% endif %}
146 if ({{getter.is_null_expression}}) 146 if ({{getter.is_null_expression}})
147 return; 147 return;
148 {{getter.v8_set_return_value}}; 148 {{getter.v8_set_return_value}};
149 } 149 }
150 150
151 {% endif %} 151 {% endif %}
(...skipping 18 matching lines...) Expand all
170 {% endif %} 170 {% endif %}
171 {% endblock %} 171 {% endblock %}
172 172
173 173
174 {##############################################################################} 174 {##############################################################################}
175 {% block indexed_property_setter %} 175 {% block indexed_property_setter %}
176 {% if indexed_property_setter and not indexed_property_setter.is_custom %} 176 {% if indexed_property_setter and not indexed_property_setter.is_custom %}
177 {% set setter = indexed_property_setter %} 177 {% set setter = indexed_property_setter %}
178 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 178 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
179 { 179 {
180 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 180 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
181 {{setter.v8_value_to_local_cpp_value}}; 181 {{setter.v8_value_to_local_cpp_value}};
182 {% if setter.has_exception_state %} 182 {% if setter.has_exception_state %}
183 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate()); 183 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate());
184 {% endif %} 184 {% endif %}
185 {% if setter.has_strict_type_checking %} 185 {% if setter.has_strict_type_checking %}
186 {# Type checking for interface types (if interface not implemented, throw 186 {# Type checking for interface types (if interface not implemented, throw
187 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 187 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
188 if (!isUndefinedOrNull(jsValue) && !V8{{setter.idl_type}}::hasInstance(jsVal ue, info.GetIsolate())) { 188 if (!isUndefinedOrNull(jsValue) && !V8{{setter.idl_type}}::hasInstance(jsVal ue, info.GetIsolate())) {
189 exceptionState.throwTypeError("The provided value is not of type '{{sett er.idl_type}}'."); 189 exceptionState.throwTypeError("The provided value is not of type '{{sett er.idl_type}}'.");
190 exceptionState.throwIfNeeded(); 190 exceptionState.throwIfNeeded();
191 return; 191 return;
192 } 192 }
193 {% endif %} 193 {% endif %}
194 {% set setter_name = setter.name or 'anonymousIndexedSetter' %} 194 {% set setter_name = setter.name or 'anonymousIndexedSetter' %}
195 {% set setter_arguments = ['index', 'propertyValue', 'exceptionState'] 195 {% set setter_arguments = ['index', 'propertyValue', 'exceptionState']
196 if setter.is_raises_exception else ['index', 'propertyValue'] %} 196 if setter.is_raises_exception else ['index', 'propertyValue'] %}
197 bool result = imp->{{setter_name}}({{setter_arguments|join(', ')}}); 197 bool result = impl->{{setter_name}}({{setter_arguments|join(', ')}});
198 {% if setter.is_raises_exception %} 198 {% if setter.is_raises_exception %}
199 if (exceptionState.throwIfNeeded()) 199 if (exceptionState.throwIfNeeded())
200 return; 200 return;
201 {% endif %} 201 {% endif %}
202 if (!result) 202 if (!result)
203 return; 203 return;
204 v8SetReturnValue(info, jsValue); 204 v8SetReturnValue(info, jsValue);
205 } 205 }
206 206
207 {% endif %} 207 {% endif %}
(...skipping 18 matching lines...) Expand all
226 {% endif %} 226 {% endif %}
227 {% endblock %} 227 {% endblock %}
228 228
229 229
230 {##############################################################################} 230 {##############################################################################}
231 {% block indexed_property_deleter %} 231 {% block indexed_property_deleter %}
232 {% if indexed_property_deleter and not indexed_property_deleter.is_custom %} 232 {% if indexed_property_deleter and not indexed_property_deleter.is_custom %}
233 {% set deleter = indexed_property_deleter %} 233 {% set deleter = indexed_property_deleter %}
234 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info) 234 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info)
235 { 235 {
236 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 236 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
237 {% if deleter.is_raises_exception %} 237 {% if deleter.is_raises_exception %}
238 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "{{int erface_name}}", info.Holder(), info.GetIsolate()); 238 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "{{int erface_name}}", info.Holder(), info.GetIsolate());
239 {% endif %} 239 {% endif %}
240 {% set deleter_name = deleter.name or 'anonymousIndexedDeleter' %} 240 {% set deleter_name = deleter.name or 'anonymousIndexedDeleter' %}
241 {% set deleter_arguments = ['index', 'exceptionState'] 241 {% set deleter_arguments = ['index', 'exceptionState']
242 if deleter.is_raises_exception else ['index'] %} 242 if deleter.is_raises_exception else ['index'] %}
243 DeleteResult result = imp->{{deleter_name}}({{deleter_arguments|join(', ')}} ); 243 DeleteResult result = impl->{{deleter_name}}({{deleter_arguments|join(', ')} });
244 {% if deleter.is_raises_exception %} 244 {% if deleter.is_raises_exception %}
245 if (exceptionState.throwIfNeeded()) 245 if (exceptionState.throwIfNeeded())
246 return; 246 return;
247 {% endif %} 247 {% endif %}
248 if (result != DeleteUnknownProperty) 248 if (result != DeleteUnknownProperty)
249 return v8SetReturnValueBool(info, result == DeleteSuccess); 249 return v8SetReturnValueBool(info, result == DeleteSuccess);
250 } 250 }
251 251
252 {% endif %} 252 {% endif %}
253 {% endblock %} 253 {% endblock %}
(...skipping 25 matching lines...) Expand all
279 {% set getter = named_property_getter %} 279 {% set getter = named_property_getter %}
280 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info) 280 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info)
281 { 281 {
282 {% if not is_override_builtins %} 282 {% if not is_override_builtins %}
283 if (info.Holder()->HasRealNamedProperty(name)) 283 if (info.Holder()->HasRealNamedProperty(name))
284 return; 284 return;
285 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 285 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
286 return; 286 return;
287 287
288 {% endif %} 288 {% endif %}
289 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 289 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
290 AtomicString propertyName = toCoreAtomicString(name); 290 AtomicString propertyName = toCoreAtomicString(name);
291 {% if getter.is_raises_exception %} 291 {% if getter.is_raises_exception %}
292 v8::String::Utf8Value namedProperty(name); 292 v8::String::Utf8Value namedProperty(name);
293 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate()); 293 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
294 {% endif %} 294 {% endif %}
295 {% if getter.union_arguments %} 295 {% if getter.union_arguments %}
296 {{union_type_method_call(getter) | indent}} 296 {{union_type_method_call(getter) | indent}}
297 {% else %} 297 {% else %}
298 {{getter.cpp_type}} result = {{getter.cpp_value}}; 298 {{getter.cpp_type}} result = {{getter.cpp_value}};
299 {% if getter.is_raises_exception %} 299 {% if getter.is_raises_exception %}
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 {% set setter = named_property_setter %} 335 {% set setter = named_property_setter %}
336 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 336 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
337 { 337 {
338 {% if not is_override_builtins %} 338 {% if not is_override_builtins %}
339 if (info.Holder()->HasRealNamedProperty(name)) 339 if (info.Holder()->HasRealNamedProperty(name))
340 return; 340 return;
341 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 341 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
342 return; 342 return;
343 343
344 {% endif %} 344 {% endif %}
345 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 345 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
346 {# v8_value_to_local_cpp_value('DOMString', 'name', 'propertyName') #} 346 {# v8_value_to_local_cpp_value('DOMString', 'name', 'propertyName') #}
347 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ; 347 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ;
348 {{setter.v8_value_to_local_cpp_value}}; 348 {{setter.v8_value_to_local_cpp_value}};
349 {% if setter.has_exception_state %} 349 {% if setter.has_exception_state %}
350 v8::String::Utf8Value namedProperty(name); 350 v8::String::Utf8Value namedProperty(name);
351 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate()); 351 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
352 {% endif %} 352 {% endif %}
353 {% set setter_name = setter.name or 'anonymousNamedSetter' %} 353 {% set setter_name = setter.name or 'anonymousNamedSetter' %}
354 {% set setter_arguments = 354 {% set setter_arguments =
355 ['propertyName', 'propertyValue', 'exceptionState'] 355 ['propertyName', 'propertyValue', 'exceptionState']
356 if setter.is_raises_exception else 356 if setter.is_raises_exception else
357 ['propertyName', 'propertyValue'] %} 357 ['propertyName', 'propertyValue'] %}
358 bool result = imp->{{setter_name}}({{setter_arguments|join(', ')}}); 358 bool result = impl->{{setter_name}}({{setter_arguments|join(', ')}});
359 {% if setter.is_raises_exception %} 359 {% if setter.is_raises_exception %}
360 if (exceptionState.throwIfNeeded()) 360 if (exceptionState.throwIfNeeded())
361 return; 361 return;
362 {% endif %} 362 {% endif %}
363 if (!result) 363 if (!result)
364 return; 364 return;
365 v8SetReturnValue(info, jsValue); 365 v8SetReturnValue(info, jsValue);
366 } 366 }
367 367
368 {% endif %} 368 {% endif %}
(...skipping 20 matching lines...) Expand all
389 389
390 390
391 {##############################################################################} 391 {##############################################################################}
392 {% block named_property_query %} 392 {% block named_property_query %}
393 {% if named_property_getter and named_property_getter.is_enumerable and 393 {% if named_property_getter and named_property_getter.is_enumerable and
394 not named_property_getter.is_custom_property_query %} 394 not named_property_getter.is_custom_property_query %}
395 {# If there is an enumerator, there MUST be a query method to properly 395 {# If there is an enumerator, there MUST be a query method to properly
396 communicate property attributes. #} 396 communicate property attributes. #}
397 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) 397 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
398 { 398 {
399 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 399 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
400 AtomicString propertyName = toCoreAtomicString(name); 400 AtomicString propertyName = toCoreAtomicString(name);
401 v8::String::Utf8Value namedProperty(name); 401 v8::String::Utf8Value namedProperty(name);
402 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate()); 402 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
403 bool result = imp->namedPropertyQuery(propertyName, exceptionState); 403 bool result = impl->namedPropertyQuery(propertyName, exceptionState);
404 if (exceptionState.throwIfNeeded()) 404 if (exceptionState.throwIfNeeded())
405 return; 405 return;
406 if (!result) 406 if (!result)
407 return; 407 return;
408 v8SetReturnValueInt(info, v8::None); 408 v8SetReturnValueInt(info, v8::None);
409 } 409 }
410 410
411 {% endif %} 411 {% endif %}
412 {% endblock %} 412 {% endblock %}
413 413
(...skipping 16 matching lines...) Expand all
430 {% endif %} 430 {% endif %}
431 {% endblock %} 431 {% endblock %}
432 432
433 433
434 {##############################################################################} 434 {##############################################################################}
435 {% block named_property_deleter %} 435 {% block named_property_deleter %}
436 {% if named_property_deleter and not named_property_deleter.is_custom %} 436 {% if named_property_deleter and not named_property_deleter.is_custom %}
437 {% set deleter = named_property_deleter %} 437 {% set deleter = named_property_deleter %}
438 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info) 438 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
439 { 439 {
440 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 440 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
441 AtomicString propertyName = toCoreAtomicString(name); 441 AtomicString propertyName = toCoreAtomicString(name);
442 {% if deleter.is_raises_exception %} 442 {% if deleter.is_raises_exception %}
443 v8::String::Utf8Value namedProperty(name); 443 v8::String::Utf8Value namedProperty(name);
444 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert y, "{{interface_name}}", info.Holder(), info.GetIsolate()); 444 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert y, "{{interface_name}}", info.Holder(), info.GetIsolate());
445 {% endif %} 445 {% endif %}
446 {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %} 446 {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %}
447 {% set deleter_arguments = ['propertyName', 'exceptionState'] 447 {% set deleter_arguments = ['propertyName', 'exceptionState']
448 if deleter.is_raises_exception else ['propertyName'] %} 448 if deleter.is_raises_exception else ['propertyName'] %}
449 DeleteResult result = imp->{{deleter_name}}({{deleter_arguments|join(', ')}} ); 449 DeleteResult result = impl->{{deleter_name}}({{deleter_arguments|join(', ')} });
450 {% if deleter.is_raises_exception %} 450 {% if deleter.is_raises_exception %}
451 if (exceptionState.throwIfNeeded()) 451 if (exceptionState.throwIfNeeded())
452 return; 452 return;
453 {% endif %} 453 {% endif %}
454 if (result != DeleteUnknownProperty) 454 if (result != DeleteUnknownProperty)
455 return v8SetReturnValueBool(info, result == DeleteSuccess); 455 return v8SetReturnValueBool(info, result == DeleteSuccess);
456 } 456 }
457 457
458 {% endif %} 458 {% endif %}
459 {% endblock %} 459 {% endblock %}
(...skipping 17 matching lines...) Expand all
477 {% endif %} 477 {% endif %}
478 {% endblock %} 478 {% endblock %}
479 479
480 480
481 {##############################################################################} 481 {##############################################################################}
482 {% block named_property_enumerator %} 482 {% block named_property_enumerator %}
483 {% if named_property_getter and named_property_getter.is_enumerable and 483 {% if named_property_getter and named_property_getter.is_enumerable and
484 not named_property_getter.is_custom_property_enumerator %} 484 not named_property_getter.is_custom_property_enumerator %}
485 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 485 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
486 { 486 {
487 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 487 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
488 Vector<String> names; 488 Vector<String> names;
489 ExceptionState exceptionState(ExceptionState::EnumerationContext, "{{interfa ce_name}}", info.Holder(), info.GetIsolate()); 489 ExceptionState exceptionState(ExceptionState::EnumerationContext, "{{interfa ce_name}}", info.Holder(), info.GetIsolate());
490 imp->namedPropertyEnumerator(names, exceptionState); 490 impl->namedPropertyEnumerator(names, exceptionState);
491 if (exceptionState.throwIfNeeded()) 491 if (exceptionState.throwIfNeeded())
492 return; 492 return;
493 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ()); 493 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ());
494 for (size_t i = 0; i < names.size(); ++i) 494 for (size_t i = 0; i < names.size(); ++i)
495 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i])); 495 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i]));
496 v8SetReturnValue(info, v8names); 496 v8SetReturnValue(info, v8names);
497 } 497 }
498 498
499 {% endif %} 499 {% endif %}
500 {% endblock %} 500 {% endblock %}
(...skipping 20 matching lines...) Expand all
521 521
522 {##############################################################################} 522 {##############################################################################}
523 {% block origin_safe_method_setter %} 523 {% block origin_safe_method_setter %}
524 {% if has_origin_safe_method_setter %} 524 {% if has_origin_safe_method_setter %}
525 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::String> name, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 525 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::String> name, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
526 { 526 {
527 {# FIXME: don't call GetIsolate 3 times #} 527 {# FIXME: don't call GetIsolate 3 times #}
528 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i nfo.This(), info.GetIsolate()); 528 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i nfo.This(), info.GetIsolate());
529 if (holder.IsEmpty()) 529 if (holder.IsEmpty())
530 return; 530 return;
531 {{cpp_class}}* imp = {{v8_class}}::toNative(holder); 531 {{cpp_class}}* impl = {{v8_class}}::toNative(holder);
532 v8::String::Utf8Value attributeName(name); 532 v8::String::Utf8Value attributeName(name);
533 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate()); 533 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), info.GetIsolate());
534 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), imp->frame (), exceptionState)) { 534 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) {
535 exceptionState.throwIfNeeded(); 535 exceptionState.throwIfNeeded();
536 return; 536 return;
537 } 537 }
538 538
539 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.This(), name, jsValue) ; 539 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.This(), name, jsValue) ;
540 } 540 }
541 541
542 static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::String> na me, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 542 static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::String> na me, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
543 { 543 {
544 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 544 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 {% endfilter %} 1317 {% endfilter %}
1318 } 1318 }
1319 1319
1320 template<> 1320 template<>
1321 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1321 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1322 { 1322 {
1323 return toV8(impl, creationContext, isolate); 1323 return toV8(impl, creationContext, isolate);
1324 } 1324 }
1325 1325
1326 {% endblock %} 1326 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/attributes.cpp ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698