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

Side by Side Diff: Source/bindings/scripts/v8_types.py

Issue 600833003: Conversion of any, NodeFilter and XPathNSResolver arguments is trivial (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | Source/bindings/tests/results/core/V8TestObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 470
471 471
472 def v8_conversion_needs_exception_state(idl_type): 472 def v8_conversion_needs_exception_state(idl_type):
473 return (idl_type.is_numeric_type or 473 return (idl_type.is_numeric_type or
474 idl_type.is_dictionary or 474 idl_type.is_dictionary or
475 idl_type.name in ('ByteString', 'ScalarValueString')) 475 idl_type.name in ('ByteString', 'ScalarValueString'))
476 476
477 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state) 477 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state)
478 478
479 479
480 TRIVIAL_CONVERSIONS = frozenset([
481 'any',
482 'boolean',
483 'Dictionary',
484 'NodeFilter',
485 'XPathNSResolver'
486 ])
487
488
480 def v8_conversion_is_trivial(idl_type): 489 def v8_conversion_is_trivial(idl_type):
481 # The conversion is a simple expression that returns the converted value and 490 # The conversion is a simple expression that returns the converted value and
482 # cannot raise an exception. 491 # cannot raise an exception.
483 return (idl_type.base_type == 'boolean' or 492 return (idl_type.base_type in TRIVIAL_CONVERSIONS or
484 idl_type.base_type == 'Dictionary' or
485 idl_type.is_wrapper_type) 493 idl_type.is_wrapper_type)
486 494
487 IdlType.v8_conversion_is_trivial = property(v8_conversion_is_trivial) 495 IdlType.v8_conversion_is_trivial = property(v8_conversion_is_trivial)
488 496
489 497
490 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat e): 498 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat e):
491 if idl_type.name == 'void': 499 if idl_type.name == 'void':
492 return '' 500 return ''
493 501
494 # Array or sequence types 502 # Array or sequence types
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 842
835 843
836 def is_explicit_nullable(idl_type): 844 def is_explicit_nullable(idl_type):
837 # Nullable type that isn't implicit nullable (see above.) For such types, 845 # Nullable type that isn't implicit nullable (see above.) For such types,
838 # we use Nullable<T> or similar explicit ways to represent a null value. 846 # we use Nullable<T> or similar explicit ways to represent a null value.
839 return idl_type.is_nullable and not idl_type.is_implicit_nullable 847 return idl_type.is_nullable and not idl_type.is_implicit_nullable
840 848
841 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) 849 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable)
842 IdlUnionType.is_implicit_nullable = False 850 IdlUnionType.is_implicit_nullable = False
843 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) 851 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/core/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698