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

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

Issue 832503002: [bindings] Eliminate remaining traces of Handle<> from the generated binding code. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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/V8TestDictionary.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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 elif idl_type.v8_conversion_needs_exception_state: 550 elif idl_type.v8_conversion_needs_exception_state:
551 arguments = ', '.join([v8_value, 'exceptionState']) 551 arguments = ', '.join([v8_value, 'exceptionState'])
552 else: 552 else:
553 arguments = v8_value 553 arguments = v8_value
554 554
555 if base_idl_type in V8_VALUE_TO_CPP_VALUE: 555 if base_idl_type in V8_VALUE_TO_CPP_VALUE:
556 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] 556 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type]
557 elif idl_type.is_array_buffer_or_view: 557 elif idl_type.is_array_buffer_or_view:
558 cpp_expression_format = ( 558 cpp_expression_format = (
559 '{v8_value}->Is{idl_type}() ? ' 559 '{v8_value}->Is{idl_type}() ? '
560 'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0') 560 'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) : 0')
561 elif idl_type.use_output_parameter_for_result: 561 elif idl_type.use_output_parameter_for_result:
562 if idl_type.includes_nullable_type: 562 if idl_type.includes_nullable_type:
563 base_idl_type = idl_type.cpp_type + 'OrNull' 563 base_idl_type = idl_type.cpp_type + 'OrNull'
564 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va riable_name}, exceptionState)' 564 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va riable_name}, exceptionState)'
565 else: 565 else:
566 cpp_expression_format = ( 566 cpp_expression_format = (
567 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})') 567 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})')
568 568
569 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t ype, v8_value=v8_value, variable_name=variable_name, isolate=isolate) 569 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t ype, v8_value=v8_value, variable_name=variable_name, isolate=isolate)
570 570
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 'USVString': 'v8String({isolate}, {cpp_value})', 840 'USVString': 'v8String({isolate}, {cpp_value})',
841 'boolean': 'v8Boolean({cpp_value}, {isolate})', 841 'boolean': 'v8Boolean({cpp_value}, {isolate})',
842 'int': 'v8::Integer::New({isolate}, {cpp_value})', 842 'int': 'v8::Integer::New({isolate}, {cpp_value})',
843 'unsigned': 'v8::Integer::NewFromUnsigned({isolate}, {cpp_value})', 843 'unsigned': 'v8::Integer::NewFromUnsigned({isolate}, {cpp_value})',
844 'float': 'v8::Number::New({isolate}, {cpp_value})', 844 'float': 'v8::Number::New({isolate}, {cpp_value})',
845 'unrestricted float': 'v8::Number::New({isolate}, {cpp_value})', 845 'unrestricted float': 'v8::Number::New({isolate}, {cpp_value})',
846 'double': 'v8::Number::New({isolate}, {cpp_value})', 846 'double': 'v8::Number::New({isolate}, {cpp_value})',
847 'unrestricted double': 'v8::Number::New({isolate}, {cpp_value})', 847 'unrestricted double': 'v8::Number::New({isolate}, {cpp_value})',
848 'void': 'v8Undefined()', 848 'void': 'v8Undefined()',
849 # [TreatReturnedNullStringAs] 849 # [TreatReturnedNullStringAs]
850 'StringOrNull': '{cpp_value}.isNull() ? v8::Handle<v8::Value>(v8::Null({isol ate})) : v8String({isolate}, {cpp_value})', 850 'StringOrNull': '{cpp_value}.isNull() ? v8::Local<v8::Value>(v8::Null({isola te})) : v8String({isolate}, {cpp_value})',
851 'StringOrUndefined': '{cpp_value}.isNull() ? v8Undefined() : v8String({isola te}, {cpp_value})', 851 'StringOrUndefined': '{cpp_value}.isNull() ? v8Undefined() : v8String({isola te}, {cpp_value})',
852 # Special cases 852 # Special cases
853 'Dictionary': '{cpp_value}.v8Value()', 853 'Dictionary': '{cpp_value}.v8Value()',
854 'EventHandler': '{cpp_value} ? v8::Handle<v8::Value>(V8AbstractEventListener ::cast({cpp_value})->getListenerObject(impl->executionContext())) : v8::Handle<v 8::Value>(v8::Null({isolate}))', 854 'EventHandler': '{cpp_value} ? v8::Local<v8::Value>(V8AbstractEventListener: :cast({cpp_value})->getListenerObject(impl->executionContext())) : v8::Local<v8: :Value>(v8::Null({isolate}))',
855 'ScriptValue': '{cpp_value}.v8Value()', 855 'ScriptValue': '{cpp_value}.v8Value()',
856 'SerializedScriptValue': '{cpp_value} ? {cpp_value}->deserialize() : v8::Han dle<v8::Value>(v8::Null({isolate}))', 856 'SerializedScriptValue': '{cpp_value} ? {cpp_value}->deserialize() : v8::Loc al<v8::Value>(v8::Null({isolate}))',
857 # General 857 # General
858 'array': 'toV8({cpp_value}, {creation_context}, {isolate})', 858 'array': 'toV8({cpp_value}, {creation_context}, {isolate})',
859 'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})', 859 'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})',
860 # Passing nullable dictionaries isn't a pattern currently used 860 # Passing nullable dictionaries isn't a pattern currently used
861 # anywhere in the web platform, and more work would be needed in 861 # anywhere in the web platform, and more work would be needed in
862 # the code generator to distinguish between passing null, and 862 # the code generator to distinguish between passing null, and
863 # passing an object which happened to not contain any of the 863 # passing an object which happened to not contain any of the
864 # dictionary's defined attributes. For now, don't define 864 # dictionary's defined attributes. For now, don't define
865 # NullableDictionary here, which will cause an exception to be 865 # NullableDictionary here, which will cause an exception to be
866 # thrown during code generation if an argument to a method is a 866 # thrown during code generation if an argument to a method is a
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 number_of_nullable_member_types_union) 944 number_of_nullable_member_types_union)
945 945
946 946
947 def includes_nullable_type_union(idl_type): 947 def includes_nullable_type_union(idl_type):
948 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type 948 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type
949 return idl_type.number_of_nullable_member_types == 1 949 return idl_type.number_of_nullable_member_types == 1
950 950
951 IdlTypeBase.includes_nullable_type = False 951 IdlTypeBase.includes_nullable_type = False
952 IdlNullableType.includes_nullable_type = True 952 IdlNullableType.includes_nullable_type = True
953 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) 953 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/core/V8TestDictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698