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

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

Issue 149993003: IDL compiler: [Custom=PropertyEnumerator] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %}
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 {{cpp_class}}V8Internal::namedPropertySetter(name, jsValue, info); 293 {{cpp_class}}V8Internal::namedPropertySetter(name, jsValue, info);
294 {% endif %} 294 {% endif %}
295 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 295 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
296 } 296 }
297 297
298 {% endif %} 298 {% endif %}
299 {% endblock %} 299 {% endblock %}
300 300
301 301
302 {##############################################################################} 302 {##############################################################################}
303 {% block named_property_query_and_callback %} 303 {% block named_property_query %}
304 {% if named_property_getter %} 304 {% if named_property_getter and
305 not named_property_getter.is_custom_property_query %}
305 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) 306 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
306 { 307 {
307 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder()); 308 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder());
308 AtomicString propertyName = toCoreAtomicString(name); 309 AtomicString propertyName = toCoreAtomicString(name);
309 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 310 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
310 bool result = collection->namedPropertyQuery(propertyName, exceptionState); 311 bool result = collection->namedPropertyQuery(propertyName, exceptionState);
311 if (exceptionState.throwIfNeeded()) 312 if (exceptionState.throwIfNeeded())
312 return; 313 return;
313 if (!result) 314 if (!result)
314 return; 315 return;
315 v8SetReturnValueInt(info, v8::None); 316 v8SetReturnValueInt(info, v8::None);
316 } 317 }
317 318
319 {% endif %}
320 {% endblock %}
321
322
323 {##############################################################################}
324 {% block named_property_query_callback %}
325 {% if named_property_getter %}
326 {% set getter = named_property_getter %}
318 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info) 327 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
319 { 328 {
320 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 329 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
330 {% if getter.is_custom_property_query %}
331 {{v8_class}}::namedPropertyQueryCustom(name, info);
332 {% else %}
321 {{cpp_class}}V8Internal::namedPropertyQuery(name, info); 333 {{cpp_class}}V8Internal::namedPropertyQuery(name, info);
334 {% endif %}
322 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 335 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
323 } 336 }
324 337
325 {% endif %} 338 {% endif %}
326 {% endblock %} 339 {% endblock %}
327 340
328 341
329 {##############################################################################} 342 {##############################################################################}
330 {% block named_property_deleter %} 343 {% block named_property_deleter %}
331 {% if named_property_deleter and not named_property_deleter.is_custom %} 344 {% if named_property_deleter and not named_property_deleter.is_custom %}
(...skipping 25 matching lines...) Expand all
357 {{cpp_class}}V8Internal::namedPropertyDeleter(name, info); 370 {{cpp_class}}V8Internal::namedPropertyDeleter(name, info);
358 {% endif %} 371 {% endif %}
359 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 372 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
360 } 373 }
361 374
362 {% endif %} 375 {% endif %}
363 {% endblock %} 376 {% endblock %}
364 377
365 378
366 {##############################################################################} 379 {##############################################################################}
367 {% block named_property_enumerator_and_callback %} 380 {% block named_property_enumerator %}
368 {% if named_property_getter %} 381 {% if named_property_getter and
382 not named_property_getter.is_custom_property_enumerator %}
369 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 383 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
370 { 384 {
371 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 385 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
372 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder()); 386 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder());
373 Vector<String> names; 387 Vector<String> names;
374 collection->namedPropertyEnumerator(names, exceptionState); 388 collection->namedPropertyEnumerator(names, exceptionState);
375 if (exceptionState.throwIfNeeded()) 389 if (exceptionState.throwIfNeeded())
376 return; 390 return;
377 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ()); 391 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ());
378 for (size_t i = 0; i < names.size(); ++i) 392 for (size_t i = 0; i < names.size(); ++i)
379 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i])); 393 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i]));
380 v8SetReturnValue(info, v8names); 394 v8SetReturnValue(info, v8names);
381 } 395 }
382 396
397 {% endif %}
398 {% endblock %}
399
400
401 {##############################################################################}
402 {% block named_property_enumerator_callback %}
403 {% if named_property_getter %}
404 {% set getter = named_property_getter %}
383 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info) 405 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
384 { 406 {
385 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 407 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
408 {% if getter.is_custom_property_enumerator %}
409 {{v8_class}}::namedPropertyEnumeratorCustom(info);
410 {% else %}
386 {{cpp_class}}V8Internal::namedPropertyEnumerator(info); 411 {{cpp_class}}V8Internal::namedPropertyEnumerator(info);
412 {% endif %}
387 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 413 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
388 } 414 }
389 415
390 {% endif %} 416 {% endif %}
391 {% endblock %} 417 {% endblock %}
392 418
393 419
394 {##############################################################################} 420 {##############################################################################}
395 {% block origin_safe_method_setter %} 421 {% block origin_safe_method_setter %}
396 {% if has_origin_safe_method_setter %} 422 {% if has_origin_safe_method_setter %}
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 fromInternalPointer(object)->deref(); 1107 fromInternalPointer(object)->deref();
1082 } 1108 }
1083 1109
1084 template<> 1110 template<>
1085 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1111 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1086 { 1112 {
1087 return toV8(impl, creationContext, isolate); 1113 return toV8(impl, creationContext, isolate);
1088 } 1114 }
1089 1115
1090 {% endblock %} 1116 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698