OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 ################################################################################ | 47 ################################################################################ |
48 # V8-specific handling of IDL types | 48 # V8-specific handling of IDL types |
49 ################################################################################ | 49 ################################################################################ |
50 | 50 |
51 NON_WRAPPER_TYPES = frozenset([ | 51 NON_WRAPPER_TYPES = frozenset([ |
52 'CompareHow', | 52 'CompareHow', |
53 'Dictionary', | 53 'Dictionary', |
54 'EventHandler', | 54 'EventHandler', |
55 'EventListener', | 55 'EventListener', |
56 'MediaQueryListListener', | |
57 'NodeFilter', | 56 'NodeFilter', |
58 'SerializedScriptValue', | 57 'SerializedScriptValue', |
59 ]) | 58 ]) |
60 TYPED_ARRAYS = { | 59 TYPED_ARRAYS = { |
61 # (cpp_type, v8_type), used by constructor templates | 60 # (cpp_type, v8_type), used by constructor templates |
62 'ArrayBuffer': None, | 61 'ArrayBuffer': None, |
63 'ArrayBufferView': None, | 62 'ArrayBufferView': None, |
64 'Float32Array': ('float', 'v8::kExternalFloatArray'), | 63 'Float32Array': ('float', 'v8::kExternalFloatArray'), |
65 'Float64Array': ('double', 'v8::kExternalDoubleArray'), | 64 'Float64Array': ('double', 'v8::kExternalDoubleArray'), |
66 'Int8Array': ('signed char', 'v8::kExternalByteArray'), | 65 'Int8Array': ('signed char', 'v8::kExternalByteArray'), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 'octet', | 101 'octet', |
103 'unsigned int', | 102 'unsigned int', |
104 'unsigned long', | 103 'unsigned long', |
105 'unsigned short', | 104 'unsigned short', |
106 ]) | 105 ]) |
107 CPP_SPECIAL_CONVERSION_RULES = { | 106 CPP_SPECIAL_CONVERSION_RULES = { |
108 'CompareHow': 'Range::CompareHow', | 107 'CompareHow': 'Range::CompareHow', |
109 'Date': 'double', | 108 'Date': 'double', |
110 'Dictionary': 'Dictionary', | 109 'Dictionary': 'Dictionary', |
111 'EventHandler': 'EventListener*', | 110 'EventHandler': 'EventListener*', |
112 'MediaQueryListListener': 'RefPtrWillBeRawPtr<MediaQueryListListener>', | |
113 'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', | 111 'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', |
114 'Promise': 'ScriptPromise', | 112 'Promise': 'ScriptPromise', |
115 'ScriptValue': 'ScriptValue', | 113 'ScriptValue': 'ScriptValue', |
116 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345
529 | 114 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345
529 |
117 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', | 115 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', |
118 'boolean': 'bool', | 116 'boolean': 'bool', |
119 'unrestricted double': 'double', | 117 'unrestricted double': 'double', |
120 'unrestricted float': 'float', | 118 'unrestricted float': 'float', |
121 } | 119 } |
122 | 120 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 'bindings/core/v8/V8EventListenerList.h']), | 328 'bindings/core/v8/V8EventListenerList.h']), |
331 'EventListener': set(['bindings/core/v8/BindingSecurity.h', | 329 'EventListener': set(['bindings/core/v8/BindingSecurity.h', |
332 'bindings/core/v8/V8EventListenerList.h', | 330 'bindings/core/v8/V8EventListenerList.h', |
333 'core/frame/LocalDOMWindow.h']), | 331 'core/frame/LocalDOMWindow.h']), |
334 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', | 332 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', |
335 'core/dom/ClassCollection.h', | 333 'core/dom/ClassCollection.h', |
336 'core/dom/TagCollection.h', | 334 'core/dom/TagCollection.h', |
337 'core/html/HTMLCollection.h', | 335 'core/html/HTMLCollection.h', |
338 'core/html/HTMLFormControlsCollection.h', | 336 'core/html/HTMLFormControlsCollection.h', |
339 'core/html/HTMLTableRowsCollection.h']), | 337 'core/html/HTMLTableRowsCollection.h']), |
340 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), | |
341 'NodeList': set(['bindings/core/v8/V8NodeList.h', | 338 'NodeList': set(['bindings/core/v8/V8NodeList.h', |
342 'core/dom/NameNodeList.h', | 339 'core/dom/NameNodeList.h', |
343 'core/dom/NodeList.h', | 340 'core/dom/NodeList.h', |
344 'core/dom/StaticNodeList.h', | 341 'core/dom/StaticNodeList.h', |
345 'core/html/LabelsNodeList.h']), | 342 'core/html/LabelsNodeList.h']), |
346 'Promise': set(['bindings/core/v8/ScriptPromise.h']), | 343 'Promise': set(['bindings/core/v8/ScriptPromise.h']), |
347 'SerializedScriptValue': set(['bindings/core/v8/SerializedScriptValue.h']), | 344 'SerializedScriptValue': set(['bindings/core/v8/SerializedScriptValue.h']), |
348 'ScriptValue': set(['bindings/core/v8/ScriptValue.h']), | 345 'ScriptValue': set(['bindings/core/v8/ScriptValue.h']), |
349 } | 346 } |
350 | 347 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 'short': 'toInt16({arguments})', | 450 'short': 'toInt16({arguments})', |
454 'unsigned short': 'toUInt16({arguments})', | 451 'unsigned short': 'toUInt16({arguments})', |
455 'long': 'toInt32({arguments})', | 452 'long': 'toInt32({arguments})', |
456 'unsigned long': 'toUInt32({arguments})', | 453 'unsigned long': 'toUInt32({arguments})', |
457 'long long': 'toInt64({arguments})', | 454 'long long': 'toInt64({arguments})', |
458 'unsigned long long': 'toUInt64({arguments})', | 455 'unsigned long long': 'toUInt64({arguments})', |
459 # Interface types | 456 # Interface types |
460 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', | 457 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', |
461 'Dictionary': 'Dictionary({v8_value}, {isolate})', | 458 'Dictionary': 'Dictionary({v8_value}, {isolate})', |
462 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v
8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::
Cast({v8_value})) : 0', | 459 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v
8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::
Cast({v8_value})) : 0', |
463 'MediaQueryListListener': 'MediaQueryListListener::create(ScriptState::curre
nt({isolate}), ScriptValue(ScriptState::current({isolate}), {v8_value}))', | |
464 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current(
{isolate}))', | 460 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current(
{isolate}))', |
465 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})
', | 461 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})
', |
466 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, {isolate
})', | 462 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, {isolate
})', |
467 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', | 463 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', |
468 'Window': 'toDOMWindow({v8_value}, {isolate})', | 464 'Window': 'toDOMWindow({v8_value}, {isolate})', |
469 'XPathNSResolver': 'toXPathNSResolver({v8_value}, {isolate})', | 465 'XPathNSResolver': 'toXPathNSResolver({v8_value}, {isolate})', |
470 } | 466 } |
471 | 467 |
472 | 468 |
473 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
e): | 469 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
e): |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 | 809 |
814 | 810 |
815 def is_explicit_nullable(idl_type): | 811 def is_explicit_nullable(idl_type): |
816 # Nullable type that isn't implicit nullable (see above.) For such types, | 812 # Nullable type that isn't implicit nullable (see above.) For such types, |
817 # we use Nullable<T> or similar explicit ways to represent a null value. | 813 # we use Nullable<T> or similar explicit ways to represent a null value. |
818 return idl_type.is_nullable and not idl_type.is_implicit_nullable | 814 return idl_type.is_nullable and not idl_type.is_implicit_nullable |
819 | 815 |
820 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) | 816 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) |
821 IdlUnionType.is_implicit_nullable = False | 817 IdlUnionType.is_implicit_nullable = False |
822 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) | 818 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) |
OLD | NEW |