OLD | NEW |
---|---|
1 {% filter format_blink_cpp_source_code %} | 1 {% filter format_blink_cpp_source_code %} |
2 | 2 |
3 {% include 'copyright_block.txt' %} | 3 {% include 'copyright_block.txt' %} |
4 #include "{{v8_class_or_partial}}.h" | 4 #include "{{v8_class_or_partial}}.h" |
5 | 5 |
6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} | 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} |
7 #include "{{filename}}" | 7 #include "{{filename}}" |
8 {% endfor %} | 8 {% endfor %} |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 {% if iterator_method %} | 525 {% if iterator_method %} |
526 {% filter exposed(iterator_method.exposed_test) %} | 526 {% filter exposed(iterator_method.exposed_test) %} |
527 {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %} | 527 {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %} |
528 // Iterator (@@iterator) | 528 // Iterator (@@iterator) |
529 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIte ratorConfiguration = { v8::Symbol::GetIterator, {{v8_class_or_partial}}::iterato rMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::OnPrototype, V8DOMConfigur ation::CheckHolder, V8DOMConfiguration::DoNotCheckAccess }; | 529 static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIte ratorConfiguration = { v8::Symbol::GetIterator, {{v8_class_or_partial}}::iterato rMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::OnPrototype, V8DOMConfigur ation::CheckHolder, V8DOMConfiguration::DoNotCheckAccess }; |
530 V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature , symbolKeyedIteratorConfiguration); | 530 V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature , symbolKeyedIteratorConfiguration); |
531 {% endfilter %} | 531 {% endfilter %} |
532 {% endfilter %} | 532 {% endfilter %} |
533 {% endif %} | 533 {% endif %} |
534 | 534 |
535 {% if interface_name == 'Iterator' %} | |
536 // The WebIDL spec says when an interface has pair iterators the iterators it returns must be | |
Yuki
2017/04/07 09:25:03
nit: Could you wrap lines within 80 columns?
Raphael Kubo da Costa (rakuco)
2017/04/07 09:45:45
Done.
| |
537 // instances of the "default iterator object" whose [[Prototype]] points to an "iterator prototype | |
538 // object" whose [[Prototype]], on its turn, points to %IteratorPrototype%. ne xt() must be | |
539 // implemented in the "iterator prototype object", while %IteratorPrototype% p rovides @@iterator. | |
540 // References: https://heycam.github.io/webidl/#es-default-iterator-object | |
541 // https://heycam.github.io/webidl/#es-iterator-prototype-object | |
542 // | |
543 // The iterators we return from interfaces that have pair interators adhere to the above by: | |
544 // - Adding the "next()" property to its prototype object. | |
545 // - Making the prototype object inherit from %IteratorPrototype% with the hac k below, which | |
546 // creates another function template with no prototype and sets the "prototy pe" property of its | |
547 // function object. | |
548 // When |interfaceTemplate|'s function object is created, its prototype.__pr oto__ will point to | |
549 // the value of the "prototype" property of |iteratorPrototypeTemplate|, whi ch is exactly what | |
550 // we want. | |
551 v8::Local<v8::FunctionTemplate> iteratorPrototypeTemplate = v8::FunctionTempla te::New(isolate); | |
Yuki
2017/04/07 09:25:03
nit: The name is a bit confusing.
Let me suppose
Yuki
2017/04/07 09:25:03
nit:
This is okay, but let me elaborate something
Raphael Kubo da Costa (rakuco)
2017/04/07 09:45:45
How about intrinsicIteratorPrototypeInterfaceTempl
Raphael Kubo da Costa (rakuco)
2017/04/07 09:45:45
Thanks for the explanation! I'm still wrapping my
| |
552 iteratorPrototypeTemplate->RemovePrototype(); | |
553 iteratorPrototypeTemplate->SetIntrinsicDataProperty(v8AtomicString(isolate, "p rototype"), | |
554 v8::kIteratorPrototype); | |
555 interfaceTemplate->Inherit(iteratorPrototypeTemplate); | |
556 {% endif %} | |
557 | |
535 {% if interface_name == 'Location' %} | 558 {% if interface_name == 'Location' %} |
536 // Symbol.toPrimitive | 559 // Symbol.toPrimitive |
537 // Prevent author scripts to inject Symbol.toPrimitive property into location | 560 // Prevent author scripts to inject Symbol.toPrimitive property into location |
538 // objects, also prevent the look-up of Symbol.toPrimitive through the | 561 // objects, also prevent the look-up of Symbol.toPrimitive through the |
539 // prototype chain. | 562 // prototype chain. |
540 instanceTemplate->Set(v8::Symbol::GetToPrimitive(isolate), | 563 instanceTemplate->Set(v8::Symbol::GetToPrimitive(isolate), |
541 v8::Undefined(isolate), | 564 v8::Undefined(isolate), |
542 static_cast<v8::PropertyAttribute>( | 565 static_cast<v8::PropertyAttribute>( |
543 v8::ReadOnly | v8::DontEnum | v8::DontDelete)); | 566 v8::ReadOnly | v8::DontEnum | v8::DontDelete)); |
544 {% endif %} | 567 {% endif %} |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 {% endif %} | 778 {% endif %} |
756 } | 779 } |
757 {% endif %} | 780 {% endif %} |
758 | 781 |
759 {% endblock %} | 782 {% endblock %} |
760 {##############################################################################} | 783 {##############################################################################} |
761 {% block partial_interface %}{% endblock %} | 784 {% block partial_interface %}{% endblock %} |
762 } // namespace blink | 785 } // namespace blink |
763 | 786 |
764 {% endfilter %}{# format_blink_cpp_source_code #} | 787 {% endfilter %}{# format_blink_cpp_source_code #} |
OLD | NEW |