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

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

Issue 214283002: Bindings: rename |jsValue| => |v8Value| (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reupload 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
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 {% endif %} 77 {% endif %}
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> v8Value, const v8::PropertyCallbackInfo<void>& info)
86 { 86 {
87 {% if is_check_security %} 87 {% if is_check_security %}
88 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder()); 88 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
89 v8::Isolate* isolate = info.GetIsolate(); 89 v8::Isolate* isolate = info.GetIsolate();
90 v8::String::Utf8Value attributeName(name); 90 v8::String::Utf8Value attributeName(name);
91 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), isolate); 91 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), isolate);
92 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), excep tionState)) { 92 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), excep tionState)) {
93 exceptionState.throwIfNeeded(); 93 exceptionState.throwIfNeeded();
94 return; 94 return;
95 } 95 }
96 {% endif %} 96 {% endif %}
97 info.This()->ForceSet(name, jsValue); 97 info.This()->ForceSet(name, v8Value);
98 } 98 }
99 99
100 {# FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constru ctors #} 100 {# FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constru ctors #}
101 static void {{cpp_class}}ReplaceableAttributeSetterCallback(v8::Local<v8::String > name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info ) 101 static void {{cpp_class}}ReplaceableAttributeSetterCallback(v8::Local<v8::String > name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info )
102 { 102 {
103 {{cpp_class}}V8Internal::{{cpp_class}}ReplaceableAttributeSetter(name, jsVal ue, info); 103 {{cpp_class}}V8Internal::{{cpp_class}}ReplaceableAttributeSetter(name, v8Val ue, info);
104 } 104 }
105 105
106 {% endif %} 106 {% endif %}
107 {% endblock %} 107 {% endblock %}
108 108
109 109
110 {##############################################################################} 110 {##############################################################################}
111 {% block security_check_functions %} 111 {% block security_check_functions %}
112 {% if is_check_security and interface_name != 'Window' %} 112 {% if is_check_security and interface_name != 'Window' %}
113 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>) 113 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 169 }
170 170
171 {% endif %} 171 {% endif %}
172 {% endblock %} 172 {% endblock %}
173 173
174 174
175 {##############################################################################} 175 {##############################################################################}
176 {% block indexed_property_setter %} 176 {% block indexed_property_setter %}
177 {% if indexed_property_setter and not indexed_property_setter.is_custom %} 177 {% if indexed_property_setter and not indexed_property_setter.is_custom %}
178 {% set setter = indexed_property_setter %} 178 {% set setter = indexed_property_setter %}
179 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 179 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
180 { 180 {
181 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder()); 181 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
182 {{setter.v8_value_to_local_cpp_value}}; 182 {{setter.v8_value_to_local_cpp_value}};
183 {% if setter.has_exception_state %} 183 {% if setter.has_exception_state %}
184 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate()); 184 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate());
185 {% endif %} 185 {% endif %}
186 {% if setter.has_strict_type_checking %} 186 {% if setter.has_strict_type_checking %}
187 {# Type checking for interface types (if interface not implemented, throw 187 {# Type checking for interface types (if interface not implemented, throw
188 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 188 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
189 if (!isUndefinedOrNull(jsValue) && !V8{{setter.idl_type}}::hasInstance(jsVal ue, info.GetIsolate())) { 189 if (!isUndefinedOrNull(v8Value) && !V8{{setter.idl_type}}::hasInstance(v8Val ue, info.GetIsolate())) {
190 exceptionState.throwTypeError("The provided value is not of type '{{sett er.idl_type}}'."); 190 exceptionState.throwTypeError("The provided value is not of type '{{sett er.idl_type}}'.");
191 exceptionState.throwIfNeeded(); 191 exceptionState.throwIfNeeded();
192 return; 192 return;
193 } 193 }
194 {% endif %} 194 {% endif %}
195 {% set setter_name = setter.name or 'anonymousIndexedSetter' %} 195 {% set setter_name = setter.name or 'anonymousIndexedSetter' %}
196 {% set setter_arguments = ['index', 'propertyValue', 'exceptionState'] 196 {% set setter_arguments = ['index', 'propertyValue', 'exceptionState']
197 if setter.is_raises_exception else ['index', 'propertyValue'] %} 197 if setter.is_raises_exception else ['index', 'propertyValue'] %}
198 bool result = impl->{{setter_name}}({{setter_arguments|join(', ')}}); 198 bool result = impl->{{setter_name}}({{setter_arguments|join(', ')}});
199 {% if setter.is_raises_exception %} 199 {% if setter.is_raises_exception %}
200 if (exceptionState.throwIfNeeded()) 200 if (exceptionState.throwIfNeeded())
201 return; 201 return;
202 {% endif %} 202 {% endif %}
203 if (!result) 203 if (!result)
204 return; 204 return;
205 v8SetReturnValue(info, jsValue); 205 v8SetReturnValue(info, v8Value);
206 } 206 }
207 207
208 {% endif %} 208 {% endif %}
209 {% endblock %} 209 {% endblock %}
210 210
211 211
212 {##############################################################################} 212 {##############################################################################}
213 {% block indexed_property_setter_callback %} 213 {% block indexed_property_setter_callback %}
214 {% if indexed_property_setter %} 214 {% if indexed_property_setter %}
215 {% set setter = indexed_property_setter %} 215 {% set setter = indexed_property_setter %}
216 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<v8::Value>& info) 216 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
217 { 217 {
218 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); 218 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
219 {% if setter.is_custom %} 219 {% if setter.is_custom %}
220 {{v8_class}}::indexedPropertySetterCustom(index, jsValue, info); 220 {{v8_class}}::indexedPropertySetterCustom(index, v8Value, info);
221 {% else %} 221 {% else %}
222 {{cpp_class}}V8Internal::indexedPropertySetter(index, jsValue, info); 222 {{cpp_class}}V8Internal::indexedPropertySetter(index, v8Value, info);
223 {% endif %} 223 {% endif %}
224 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 224 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
225 } 225 }
226 226
227 {% endif %} 227 {% endif %}
228 {% endblock %} 228 {% endblock %}
229 229
230 230
231 {##############################################################################} 231 {##############################################################################}
232 {% block indexed_property_deleter %} 232 {% block indexed_property_deleter %}
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } 327 }
328 328
329 {% endif %} 329 {% endif %}
330 {% endblock %} 330 {% endblock %}
331 331
332 332
333 {##############################################################################} 333 {##############################################################################}
334 {% block named_property_setter %} 334 {% block named_property_setter %}
335 {% if named_property_setter and not named_property_setter.is_custom %} 335 {% if named_property_setter and not named_property_setter.is_custom %}
336 {% set setter = named_property_setter %} 336 {% set setter = named_property_setter %}
337 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 337 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
338 { 338 {
339 {% if not is_override_builtins %} 339 {% if not is_override_builtins %}
340 if (info.Holder()->HasRealNamedProperty(name)) 340 if (info.Holder()->HasRealNamedProperty(name))
341 return; 341 return;
342 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 342 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
343 return; 343 return;
344 344
345 {% endif %} 345 {% endif %}
346 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder()); 346 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
347 {# v8_value_to_local_cpp_value('DOMString', 'name', 'propertyName') #} 347 {# v8_value_to_local_cpp_value('DOMString', 'name', 'propertyName') #}
348 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ; 348 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ;
349 {{setter.v8_value_to_local_cpp_value}}; 349 {{setter.v8_value_to_local_cpp_value}};
350 {% if setter.has_exception_state %} 350 {% if setter.has_exception_state %}
351 v8::String::Utf8Value namedProperty(name); 351 v8::String::Utf8Value namedProperty(name);
352 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate()); 352 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "{{interface_name}}", info.Holder(), info.GetIsolate());
353 {% endif %} 353 {% endif %}
354 {% set setter_name = setter.name or 'anonymousNamedSetter' %} 354 {% set setter_name = setter.name or 'anonymousNamedSetter' %}
355 {% set setter_arguments = 355 {% set setter_arguments =
356 ['propertyName', 'propertyValue', 'exceptionState'] 356 ['propertyName', 'propertyValue', 'exceptionState']
357 if setter.is_raises_exception else 357 if setter.is_raises_exception else
358 ['propertyName', 'propertyValue'] %} 358 ['propertyName', 'propertyValue'] %}
359 bool result = impl->{{setter_name}}({{setter_arguments|join(', ')}}); 359 bool result = impl->{{setter_name}}({{setter_arguments|join(', ')}});
360 {% if setter.is_raises_exception %} 360 {% if setter.is_raises_exception %}
361 if (exceptionState.throwIfNeeded()) 361 if (exceptionState.throwIfNeeded())
362 return; 362 return;
363 {% endif %} 363 {% endif %}
364 if (!result) 364 if (!result)
365 return; 365 return;
366 v8SetReturnValue(info, jsValue); 366 v8SetReturnValue(info, v8Value);
367 } 367 }
368 368
369 {% endif %} 369 {% endif %}
370 {% endblock %} 370 {% endblock %}
371 371
372 372
373 {##############################################################################} 373 {##############################################################################}
374 {% block named_property_setter_callback %} 374 {% block named_property_setter_callback %}
375 {% if named_property_setter %} 375 {% if named_property_setter %}
376 {% set setter = named_property_setter %} 376 {% set setter = named_property_setter %}
377 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 377 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
378 { 378 {
379 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 379 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
380 {% if setter.is_custom %} 380 {% if setter.is_custom %}
381 {{v8_class}}::namedPropertySetterCustom(name, jsValue, info); 381 {{v8_class}}::namedPropertySetterCustom(name, v8Value, info);
382 {% else %} 382 {% else %}
383 {{cpp_class}}V8Internal::namedPropertySetter(name, jsValue, info); 383 {{cpp_class}}V8Internal::namedPropertySetter(name, v8Value, info);
384 {% endif %} 384 {% endif %}
385 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 385 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
386 } 386 }
387 387
388 {% endif %} 388 {% endif %}
389 {% endblock %} 389 {% endblock %}
390 390
391 391
392 {##############################################################################} 392 {##############################################################################}
393 {% block named_property_query %} 393 {% block named_property_query %}
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 517 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
518 } 518 }
519 519
520 {% endif %} 520 {% endif %}
521 {% endblock %} 521 {% endblock %}
522 522
523 523
524 {##############################################################################} 524 {##############################################################################}
525 {% block origin_safe_method_setter %} 525 {% block origin_safe_method_setter %}
526 {% if has_origin_safe_method_setter %} 526 {% if has_origin_safe_method_setter %}
527 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::String> name, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 527 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::String> name, v8:: Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
528 { 528 {
529 v8::Isolate* isolate = info.GetIsolate(); 529 v8::Isolate* isolate = info.GetIsolate();
530 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i nfo.This(), isolate); 530 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i nfo.This(), isolate);
531 if (holder.IsEmpty()) 531 if (holder.IsEmpty())
532 return; 532 return;
533 {{cpp_class}}* impl = {{v8_class}}::toNative(holder); 533 {{cpp_class}}* impl = {{v8_class}}::toNative(holder);
534 v8::String::Utf8Value attributeName(name); 534 v8::String::Utf8Value attributeName(name);
535 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), isolate); 535 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), isolate);
536 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), excep tionState)) { 536 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), excep tionState)) {
537 exceptionState.throwIfNeeded(); 537 exceptionState.throwIfNeeded();
538 return; 538 return;
539 } 539 }
540 540
541 V8HiddenValue::setHiddenValue(isolate, info.This(), name, jsValue); 541 V8HiddenValue::setHiddenValue(isolate, info.This(), name, v8Value);
542 } 542 }
543 543
544 static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::String> na me, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 544 static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::String> na me, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
545 { 545 {
546 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 546 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
547 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, jsValue, info); 547 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, info);
548 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 548 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
549 } 549 }
550 550
551 {% endif %} 551 {% endif %}
552 {% endblock %} 552 {% endblock %}
553 553
554 554
555 {##############################################################################} 555 {##############################################################################}
556 {% from 'methods.cpp' import named_constructor_callback with context %} 556 {% from 'methods.cpp' import named_constructor_callback with context %}
557 {% block named_constructor %} 557 {% block named_constructor %}
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 configure{{v8_class}}Template(result, isolate); 1106 configure{{v8_class}}Template(result, isolate);
1107 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result) ; 1107 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result) ;
1108 return result; 1108 return result;
1109 } 1109 }
1110 1110
1111 {% endblock %} 1111 {% endblock %}
1112 1112
1113 1113
1114 {##############################################################################} 1114 {##############################################################################}
1115 {% block has_instance %} 1115 {% block has_instance %}
1116 bool {{v8_class}}::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isola te) 1116 bool {{v8_class}}::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isola te)
1117 { 1117 {
1118 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e); 1118 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
1119 } 1119 }
1120 1120
1121 v8::Handle<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Handle<v8: :Value> jsValue, v8::Isolate* isolate) 1121 v8::Handle<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Handle<v8: :Value> v8Value, v8::Isolate* isolate)
1122 { 1122 {
1123 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, jsValue); 1123 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
1124 } 1124 }
1125 1125
1126 {% endblock %} 1126 {% endblock %}
1127 1127
1128 1128
1129 {##############################################################################} 1129 {##############################################################################}
1130 {% block to_native_with_type_check %} 1130 {% block to_native_with_type_check %}
1131 {{cpp_class}}* {{v8_class}}::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Han dle<v8::Value> value) 1131 {{cpp_class}}* {{v8_class}}::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Han dle<v8::Value> value)
1132 { 1132 {
1133 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0; 1133 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 {% endfilter %} 1315 {% endfilter %}
1316 } 1316 }
1317 1317
1318 template<> 1318 template<>
1319 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1319 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1320 { 1320 {
1321 return toV8(impl, creationContext, isolate); 1321 return toV8(impl, creationContext, isolate);
1322 } 1322 }
1323 1323
1324 {% endblock %} 1324 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/attributes.cpp ('k') | Source/bindings/tests/results/V8SVGTestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698