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

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

Issue 590443002: IDL: object type support for IDL dictionary (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase 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 | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/templates/dictionary_v8.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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 if idl_type.impl_should_use_nullable_container: 410 if idl_type.impl_should_use_nullable_container:
411 includes_for_type.add('bindings/core/v8/Nullable.h') 411 includes_for_type.add('bindings/core/v8/Nullable.h')
412 412
413 idl_type = idl_type.preprocessed_type 413 idl_type = idl_type.preprocessed_type
414 native_array_element_type = idl_type.native_array_element_type 414 native_array_element_type = idl_type.native_array_element_type
415 if native_array_element_type: 415 if native_array_element_type:
416 includes_for_type.update(impl_includes_for_type( 416 includes_for_type.update(impl_includes_for_type(
417 native_array_element_type, interfaces_info)) 417 native_array_element_type, interfaces_info))
418 includes_for_type.add('wtf/Vector.h') 418 includes_for_type.add('wtf/Vector.h')
419 419
420 base_idl_type = idl_type.base_type
420 if idl_type.is_string_type: 421 if idl_type.is_string_type:
421 includes_for_type.add('wtf/text/WTFString.h') 422 includes_for_type.add('wtf/text/WTFString.h')
422 if idl_type.base_type in interfaces_info: 423 if base_idl_type in interfaces_info:
423 interface_info = interfaces_info[idl_type.base_type] 424 interface_info = interfaces_info[idl_type.base_type]
424 includes_for_type.add(interface_info['include_path']) 425 includes_for_type.add(interface_info['include_path'])
426 if base_idl_type in INCLUDES_FOR_TYPE:
427 includes_for_type.update(INCLUDES_FOR_TYPE[base_idl_type])
425 return includes_for_type 428 return includes_for_type
426 429
427 IdlTypeBase.impl_includes_for_type = impl_includes_for_type 430 IdlTypeBase.impl_includes_for_type = impl_includes_for_type
428 431
429 432
430 component_dir = {} 433 component_dir = {}
431 434
432 435
433 def set_component_dirs(new_component_dirs): 436 def set_component_dirs(new_component_dirs):
434 component_dir.update(new_component_dirs) 437 component_dir.update(new_component_dirs)
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 614
612 615
613 ################################################################################ 616 ################################################################################
614 # C++ -> V8 617 # C++ -> V8
615 ################################################################################ 618 ################################################################################
616 619
617 def preprocess_idl_type(idl_type): 620 def preprocess_idl_type(idl_type):
618 if idl_type.is_enum: 621 if idl_type.is_enum:
619 # Enumerations are internally DOMStrings 622 # Enumerations are internally DOMStrings
620 return IdlType('DOMString') 623 return IdlType('DOMString')
621 if (idl_type.name == 'Any' or idl_type.is_callback_function): 624 if (idl_type.name in ['Any', 'Object'] or idl_type.is_callback_function):
622 return IdlType('ScriptValue') 625 return IdlType('ScriptValue')
623 return idl_type 626 return idl_type
624 627
625 IdlTypeBase.preprocessed_type = property(preprocess_idl_type) 628 IdlTypeBase.preprocessed_type = property(preprocess_idl_type)
626 629
627 630
628 def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes): 631 def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes):
629 """Returns IDL type and value, with preliminary type conversions applied.""" 632 """Returns IDL type and value, with preliminary type conversions applied."""
630 idl_type = idl_type.preprocessed_type 633 idl_type = idl_type.preprocessed_type
631 if idl_type.name == 'Promise': 634 if idl_type.name == 'Promise':
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 834
832 835
833 def cpp_type_has_null_value(idl_type): 836 def cpp_type_has_null_value(idl_type):
834 # - String types (String/AtomicString) represent null as a null string, 837 # - String types (String/AtomicString) represent null as a null string,
835 # i.e. one for which String::isNull() returns true. 838 # i.e. one for which String::isNull() returns true.
836 # - Enum types, as they are implemented as Strings. 839 # - Enum types, as they are implemented as Strings.
837 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as 840 # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as
838 # a null pointer. 841 # a null pointer.
839 # - Dictionary types represent null as a null pointer. They are garbage 842 # - Dictionary types represent null as a null pointer. They are garbage
840 # collected so their type is raw pointer. 843 # collected so their type is raw pointer.
844 # - 'Object' type. We use ScriptValue for object type.
841 return (idl_type.is_string_type or idl_type.is_wrapper_type or 845 return (idl_type.is_string_type or idl_type.is_wrapper_type or
842 idl_type.is_enum or idl_type.is_dictionary) 846 idl_type.is_enum or idl_type.is_dictionary or idl_type.base_type == 'object')
843 847
844 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) 848 IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value)
845 849
846 850
847 def is_implicit_nullable(idl_type): 851 def is_implicit_nullable(idl_type):
848 # Nullable type where the corresponding C++ type supports a null value. 852 # Nullable type where the corresponding C++ type supports a null value.
849 return idl_type.is_nullable and idl_type.cpp_type_has_null_value 853 return idl_type.is_nullable and idl_type.cpp_type_has_null_value
850 854
851 855
852 def is_explicit_nullable(idl_type): 856 def is_explicit_nullable(idl_type):
853 # Nullable type that isn't implicit nullable (see above.) For such types, 857 # Nullable type that isn't implicit nullable (see above.) For such types,
854 # we use Nullable<T> or similar explicit ways to represent a null value. 858 # we use Nullable<T> or similar explicit ways to represent a null value.
855 return idl_type.is_nullable and not idl_type.is_implicit_nullable 859 return idl_type.is_nullable and not idl_type.is_implicit_nullable
856 860
857 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) 861 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable)
858 IdlUnionType.is_implicit_nullable = False 862 IdlUnionType.is_implicit_nullable = False
859 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) 863 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/templates/dictionary_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698