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

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

Issue 534133002: [WIP] bindings: Introduce PropertyBag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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_interface.py ('k') | Source/bindings/templates/dictionary_v8.h » ('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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 else: 494 else:
495 arguments = v8_value 495 arguments = v8_value
496 496
497 if base_idl_type in V8_VALUE_TO_CPP_VALUE: 497 if base_idl_type in V8_VALUE_TO_CPP_VALUE:
498 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] 498 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type]
499 elif idl_type.is_typed_array_element_type: 499 elif idl_type.is_typed_array_element_type:
500 cpp_expression_format = ( 500 cpp_expression_format = (
501 '{v8_value}->Is{idl_type}() ? ' 501 '{v8_value}->Is{idl_type}() ? '
502 'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0') 502 'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0')
503 elif idl_type.is_dictionary: 503 elif idl_type.is_dictionary:
504 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value})' 504 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, exc eptionState)'
505 else: 505 else:
506 cpp_expression_format = ( 506 cpp_expression_format = (
507 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})') 507 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})')
508 508
509 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t ype, v8_value=v8_value, isolate=isolate) 509 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t ype, v8_value=v8_value, isolate=isolate)
510 510
511 511
512 def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value, index, isolate='info.GetIsolate()'): 512 def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value, index, isolate='info.GetIsolate()'):
513 # Index is None for setters, index (starting at 0) for method arguments, 513 # Index is None for setters, index (starting at 0) for method arguments,
514 # and is used to provide a human-readable exception message 514 # and is used to provide a human-readable exception message
(...skipping 22 matching lines...) Expand all
537 if idl_type.is_union_type: 537 if idl_type.is_union_type:
538 return '' 538 return ''
539 539
540 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut es, raw_type=True) 540 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut es, raw_type=True)
541 541
542 idl_type = idl_type.preprocessed_type 542 idl_type = idl_type.preprocessed_type
543 cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, i ndex, isolate) 543 cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, i ndex, isolate)
544 args = [variable_name, cpp_value] 544 args = [variable_name, cpp_value]
545 if idl_type.base_type == 'DOMString': 545 if idl_type.base_type == 'DOMString':
546 macro = 'TOSTRING_DEFAULT' if used_in_private_script else 'TOSTRING_VOID ' 546 macro = 'TOSTRING_DEFAULT' if used_in_private_script else 'TOSTRING_VOID '
547 elif idl_type.may_raise_exception_on_conversion: 547 elif (idl_type.may_raise_exception_on_conversion and
548 not idl_type.is_dictionary):
548 macro = 'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script else 'TONATIVE_VOID_EXCEPTIONSTATE' 549 macro = 'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script else 'TONATIVE_VOID_EXCEPTIONSTATE'
549 args.append('exceptionState') 550 args.append('exceptionState')
550 else: 551 else:
551 macro = 'TONATIVE_DEFAULT' if used_in_private_script else 'TONATIVE_VOID ' 552 macro = 'TONATIVE_DEFAULT' if used_in_private_script else 'TONATIVE_VOID '
552 553
553 if used_in_private_script: 554 if used_in_private_script:
554 args.append('false') 555 args.append('false')
555 556
556 # Macros come in several variants, to minimize expensive creation of 557 # Macros come in several variants, to minimize expensive creation of
557 # v8::TryCatch. 558 # v8::TryCatch.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 813
813 814
814 def is_explicit_nullable(idl_type): 815 def is_explicit_nullable(idl_type):
815 # Nullable type that isn't implicit nullable (see above.) For such types, 816 # Nullable type that isn't implicit nullable (see above.) For such types,
816 # we use Nullable<T> or similar explicit ways to represent a null value. 817 # we use Nullable<T> or similar explicit ways to represent a null value.
817 return idl_type.is_nullable and not idl_type.is_implicit_nullable 818 return idl_type.is_nullable and not idl_type.is_implicit_nullable
818 819
819 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) 820 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable)
820 IdlUnionType.is_implicit_nullable = False 821 IdlUnionType.is_implicit_nullable = False
821 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) 822 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/templates/dictionary_v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698