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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_interface.py

Issue 2683853005: bindings: Make some value iterator properties aliases to Array.prototype functions (Closed)
Patch Set: Remove constexpr from Internals.h to fix the Android build Created 3 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
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 372
373 # Window.idl in Blink has indexed properties, but the spec says Window 373 # Window.idl in Blink has indexed properties, but the spec says Window
374 # interface doesn't have indexed properties, instead the WindowProxy exotic 374 # interface doesn't have indexed properties, instead the WindowProxy exotic
375 # object has indexed properties. Thus, Window interface must not support 375 # object has indexed properties. Thus, Window interface must not support
376 # iterators. 376 # iterators.
377 has_array_iterator = (not interface.is_partial and 377 has_array_iterator = (not interface.is_partial and
378 interface.has_indexed_elements and 378 interface.has_indexed_elements and
379 interface.name != 'Window') 379 interface.name != 'Window')
380 context.update({ 380 context.update({
381 'has_array_iterator': has_array_iterator, 381 'has_array_iterator': has_array_iterator,
382 'iterable': interface.iterable,
382 }) 383 })
383 384
384 # Conditionally enabled members 385 # Conditionally enabled members
385 has_conditional_attributes_on_prototype = any( # pylint: disable=invalid-na me 386 has_conditional_attributes_on_prototype = any( # pylint: disable=invalid-na me
386 (attribute['exposed_test'] or attribute['secure_context_test']) and attr ibute['on_prototype'] 387 (attribute['exposed_test'] or attribute['secure_context_test']) and attr ibute['on_prototype']
387 for attribute in attributes) 388 for attribute in attributes)
388 context.update({ 389 context.update({
389 'has_conditional_attributes_on_prototype': 390 'has_conditional_attributes_on_prototype':
390 has_conditional_attributes_on_prototype, 391 has_conditional_attributes_on_prototype,
391 }) 392 })
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 extended_attributes=used_extended_attributes, 539 extended_attributes=used_extended_attributes,
539 implemented_as=implemented_as) 540 implemented_as=implemented_as)
540 541
541 if not interface.has_indexed_elements: 542 if not interface.has_indexed_elements:
542 iterator_method = generated_iterator_method('iterator', implemented_ as='iterator') 543 iterator_method = generated_iterator_method('iterator', implemented_ as='iterator')
543 544
544 if interface.iterable or interface.maplike or interface.setlike: 545 if interface.iterable or interface.maplike or interface.setlike:
545 non_overridable_methods = [] 546 non_overridable_methods = []
546 overridable_methods = [] 547 overridable_methods = []
547 548
548 non_overridable_methods.extend([ 549 is_value_iterator = interface.iterable and interface.iterable.key_ty pe is None
549 generated_iterator_method('keys'),
550 generated_iterator_method('values'),
551 generated_iterator_method('entries'),
552 550
553 # void forEach(Function callback, [Default=Undefined] optional a ny thisArg) 551 # For value iterators, the |entries|, |forEach|, |keys| and |values| are originally set
554 generated_method(IdlType('void'), 'forEach', 552 # to corresponding properties in %ArrayPrototype%.
555 arguments=[generated_argument(IdlType('Function '), 'callback'), 553 if not is_value_iterator:
556 generated_argument(IdlType('any'), ' thisArg', 554 non_overridable_methods.extend([
557 is_optional=True, 555 generated_iterator_method('keys'),
558 extended_attribut es={'Default': 'Undefined'})], 556 generated_iterator_method('values'),
559 extended_attributes=forEach_extended_attributes ), 557 generated_iterator_method('entries'),
560 ]) 558
559 # void forEach(Function callback, [Default=Undefined] option al any thisArg)
560 generated_method(IdlType('void'), 'forEach',
561 arguments=[generated_argument(IdlType('Func tion'), 'callback'),
562 generated_argument(IdlType('any' ), 'thisArg',
563 is_optional=T rue,
564 extended_attr ibutes={'Default': 'Undefined'})],
565 extended_attributes=forEach_extended_attrib utes),
566 ])
561 567
562 if interface.maplike: 568 if interface.maplike:
563 key_argument = generated_argument(interface.maplike.key_type, 'k ey') 569 key_argument = generated_argument(interface.maplike.key_type, 'k ey')
564 value_argument = generated_argument(interface.maplike.value_type , 'value') 570 value_argument = generated_argument(interface.maplike.value_type , 'value')
565 571
566 non_overridable_methods.extend([ 572 non_overridable_methods.extend([
567 generated_method(IdlType('boolean'), 'has', 573 generated_method(IdlType('boolean'), 'has',
568 arguments=[key_argument], 574 arguments=[key_argument],
569 extended_attributes=used_extended_attribute s), 575 extended_attributes=used_extended_attribute s),
570 generated_method(IdlType('any'), 'get', 576 generated_method(IdlType('any'), 'get',
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 extended_attributes = deleter.extended_attributes 1485 extended_attributes = deleter.extended_attributes
1480 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1486 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1481 is_ce_reactions = 'CEReactions' in extended_attributes 1487 is_ce_reactions = 'CEReactions' in extended_attributes
1482 return { 1488 return {
1483 'is_call_with_script_state': is_call_with_script_state, 1489 'is_call_with_script_state': is_call_with_script_state,
1484 'is_ce_reactions': is_ce_reactions, 1490 'is_ce_reactions': is_ce_reactions,
1485 'is_custom': 'Custom' in extended_attributes, 1491 'is_custom': 'Custom' in extended_attributes,
1486 'is_raises_exception': 'RaisesException' in extended_attributes, 1492 'is_raises_exception': 'RaisesException' in extended_attributes,
1487 'name': cpp_name(deleter), 1493 'name': cpp_name(deleter),
1488 } 1494 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698