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

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

Issue 82693003: IDL compiler: [CustomToV8] interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 (interface_name, attribute.name) 8 (interface_name, 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 ActiveDOMObject* {{v8_class_name}}::toActiveDOMObject(v8::Handle<v8::Object> wra pper) 425 ActiveDOMObject* {{v8_class_name}}::toActiveDOMObject(v8::Handle<v8::Object> wra pper)
426 { 426 {
427 return toNative(wrapper); 427 return toNative(wrapper);
428 } 428 }
429 429
430 {% endif %} 430 {% endif %}
431 {% endblock %} 431 {% endblock %}
432 432
433 433
434 {##############################################################################} 434 {##############################################################################}
435 {% block create_wrapper_and_deref_object %} 435 {% block create_wrapper %}
Nils Barth (inactive) 2013/11/22 06:10:48 Split block in two so that {% if %} statement line
436 {% if not has_custom_to_v8 %}
436 v8::Handle<v8::Object> {{v8_class_name}}::createWrapper(PassRefPtr<{{cpp_class_n ame}}> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 437 v8::Handle<v8::Object> {{v8_class_name}}::createWrapper(PassRefPtr<{{cpp_class_n ame}}> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
437 { 438 {
438 ASSERT(impl); 439 ASSERT(impl);
439 ASSERT(!DOMDataStore::containsWrapper<{{v8_class_name}}>(impl.get(), isolate )); 440 ASSERT(!DOMDataStore::containsWrapper<{{v8_class_name}}>(impl.get(), isolate ));
440 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 441 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
441 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 442 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
442 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 443 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
443 // the same object de-ref functions, though, so use that as the basis of the check. 444 // the same object de-ref functions, though, so use that as the basis of the check.
444 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 445 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
445 } 446 }
446 447
447 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); 448 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
448 if (UNLIKELY(wrapper.IsEmpty())) 449 if (UNLIKELY(wrapper.IsEmpty()))
449 return wrapper; 450 return wrapper;
450 451
451 installPerContextEnabledProperties(wrapper, impl.get(), isolate); 452 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
452 {% set wrapper_configuration = 'WrapperConfiguration::Dependent' 453 {% set wrapper_configuration = 'WrapperConfiguration::Dependent'
453 if (has_resolve_wrapper_reachability or 454 if (has_resolve_wrapper_reachability or
454 is_active_dom_object or 455 is_active_dom_object or
455 is_dependent_lifetime) else 456 is_dependent_lifetime) else
456 'WrapperConfiguration::Independent' %} 457 'WrapperConfiguration::Independent' %}
457 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &wrapperTy peInfo, wrapper, isolate, {{wrapper_configuration}}); 458 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &wrapperTy peInfo, wrapper, isolate, {{wrapper_configuration}});
458 return wrapper; 459 return wrapper;
459 } 460 }
460 461
462 {% endif %}
463 {% endblock %}
464
465
466 {##############################################################################}
467 {% block deref_object %}
461 void {{v8_class_name}}::derefObject(void* object) 468 void {{v8_class_name}}::derefObject(void* object)
462 { 469 {
463 fromInternalPointer(object)->deref(); 470 fromInternalPointer(object)->deref();
464 } 471 }
465 472
466 {% endblock %} 473 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698