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

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

Issue 1118673002: Implement ReadableStream as a V8 extra (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanups; make controller a member instead of arg Created 5 years, 7 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/idl_types.py ('k') | Source/core/core.gypi » ('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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 'unsigned int', 104 'unsigned int',
105 'unsigned long', 105 'unsigned long',
106 'unsigned short', 106 'unsigned short',
107 ]) 107 ])
108 CPP_SPECIAL_CONVERSION_RULES = { 108 CPP_SPECIAL_CONVERSION_RULES = {
109 'Date': 'double', 109 'Date': 'double',
110 'Dictionary': 'Dictionary', 110 'Dictionary': 'Dictionary',
111 'EventHandler': 'EventListener*', 111 'EventHandler': 'EventListener*',
112 'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', 112 'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>',
113 'Promise': 'ScriptPromise', 113 'Promise': 'ScriptPromise',
114 'ReadableStream2': 'ScriptReadableStream',
114 'ScriptValue': 'ScriptValue', 115 'ScriptValue': 'ScriptValue',
115 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345 529 116 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345 529
116 'XPathNSResolver': 'RawPtr<XPathNSResolver>', 117 'XPathNSResolver': 'RawPtr<XPathNSResolver>',
117 'boolean': 'bool', 118 'boolean': 'bool',
118 'unrestricted double': 'double', 119 'unrestricted double': 'double',
119 'unrestricted float': 'float', 120 'unrestricted float': 'float',
120 } 121 }
121 122
122 123
123 def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_ type=False, used_as_variadic_argument=False, used_in_cpp_sequence=False): 124 def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_ type=False, used_as_variadic_argument=False, used_in_cpp_sequence=False):
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 'core/html/HTMLCollection.h', 356 'core/html/HTMLCollection.h',
356 'core/html/HTMLDataListOptionsCollection.h', 357 'core/html/HTMLDataListOptionsCollection.h',
357 'core/html/HTMLFormControlsCollection.h', 358 'core/html/HTMLFormControlsCollection.h',
358 'core/html/HTMLTableRowsCollection.h']), 359 'core/html/HTMLTableRowsCollection.h']),
359 'NodeList': set(['bindings/core/v8/V8NodeList.h', 360 'NodeList': set(['bindings/core/v8/V8NodeList.h',
360 'core/dom/NameNodeList.h', 361 'core/dom/NameNodeList.h',
361 'core/dom/NodeList.h', 362 'core/dom/NodeList.h',
362 'core/dom/StaticNodeList.h', 363 'core/dom/StaticNodeList.h',
363 'core/html/LabelsNodeList.h']), 364 'core/html/LabelsNodeList.h']),
364 'Promise': set(['bindings/core/v8/ScriptPromise.h']), 365 'Promise': set(['bindings/core/v8/ScriptPromise.h']),
366 'ReadableStream2': set(['core/streams/ScriptReadableStream.h']),
365 'SerializedScriptValue': set(['bindings/core/v8/SerializedScriptValue.h', 367 'SerializedScriptValue': set(['bindings/core/v8/SerializedScriptValue.h',
366 'bindings/core/v8/SerializedScriptValueFactory .h']), 368 'bindings/core/v8/SerializedScriptValueFactory .h']),
367 'ScriptValue': set(['bindings/core/v8/ScriptValue.h']), 369 'ScriptValue': set(['bindings/core/v8/ScriptValue.h']),
368 } 370 }
369 371
370 372
371 def includes_for_type(idl_type, extended_attributes=None): 373 def includes_for_type(idl_type, extended_attributes=None):
372 idl_type = idl_type.preprocessed_type 374 idl_type = idl_type.preprocessed_type
373 extended_attributes = extended_attributes or {} 375 extended_attributes = extended_attributes or {}
374 376
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 if idl_type.base_type in ['any', 'object'] or idl_type.is_callback_function: 692 if idl_type.base_type in ['any', 'object'] or idl_type.is_callback_function:
691 return IdlType('ScriptValue') 693 return IdlType('ScriptValue')
692 return idl_type 694 return idl_type
693 695
694 IdlTypeBase.preprocessed_type = property(preprocess_idl_type) 696 IdlTypeBase.preprocessed_type = property(preprocess_idl_type)
695 697
696 698
697 def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes): 699 def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes):
698 """Returns IDL type and value, with preliminary type conversions applied.""" 700 """Returns IDL type and value, with preliminary type conversions applied."""
699 idl_type = idl_type.preprocessed_type 701 idl_type = idl_type.preprocessed_type
700 if idl_type.name == 'Promise': 702 if idl_type.name == 'Promise' or idl_type.name == 'ReadableStream2':
701 idl_type = IdlType('ScriptValue') 703 idl_type = IdlType('ScriptValue')
702 if idl_type.base_type in ['long long', 'unsigned long long']: 704 if idl_type.base_type in ['long long', 'unsigned long long']:
703 # long long and unsigned long long are not representable in ECMAScript; 705 # long long and unsigned long long are not representable in ECMAScript;
704 # we represent them as doubles. 706 # we represent them as doubles.
705 is_nullable = idl_type.is_nullable 707 is_nullable = idl_type.is_nullable
706 idl_type = IdlType('double') 708 idl_type = IdlType('double')
707 if is_nullable: 709 if is_nullable:
708 idl_type = IdlNullableType(idl_type) 710 idl_type = IdlNullableType(idl_type)
709 cpp_value = 'static_cast<double>(%s)' % cpp_value 711 cpp_value = 'static_cast<double>(%s)' % cpp_value
710 # HTML5 says that unsigned reflected attributes should be in the range 712 # HTML5 says that unsigned reflected attributes should be in the range
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 number_of_nullable_member_types_union) 979 number_of_nullable_member_types_union)
978 980
979 981
980 def includes_nullable_type_union(idl_type): 982 def includes_nullable_type_union(idl_type):
981 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type 983 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type
982 return idl_type.number_of_nullable_member_types == 1 984 return idl_type.number_of_nullable_member_types == 1
983 985
984 IdlTypeBase.includes_nullable_type = False 986 IdlTypeBase.includes_nullable_type = False
985 IdlNullableType.includes_nullable_type = True 987 IdlNullableType.includes_nullable_type = True
986 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) 988 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/idl_types.py ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698