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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 'octet', | 100 'octet', |
102 'unsigned int', | 101 'unsigned int', |
103 'unsigned long', | 102 'unsigned long', |
104 'unsigned short', | 103 'unsigned short', |
105 ]) | 104 ]) |
106 CPP_SPECIAL_CONVERSION_RULES = { | 105 CPP_SPECIAL_CONVERSION_RULES = { |
107 'CompareHow': 'Range::CompareHow', | 106 'CompareHow': 'Range::CompareHow', |
108 'Date': 'double', | 107 'Date': 'double', |
109 'Dictionary': 'Dictionary', | 108 'Dictionary': 'Dictionary', |
110 'EventHandler': 'EventListener*', | 109 'EventHandler': 'EventListener*', |
111 'MediaQueryListListener': 'RefPtrWillBeRawPtr<MediaQueryListListener>', | |
112 'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', | 110 'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', |
113 'Promise': 'ScriptPromise', | 111 'Promise': 'ScriptPromise', |
114 'ScriptValue': 'ScriptValue', | 112 'ScriptValue': 'ScriptValue', |
115 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345
529 | 113 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345
529 |
116 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', | 114 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', |
117 'boolean': 'bool', | 115 'boolean': 'bool', |
118 'unrestricted double': 'double', | 116 'unrestricted double': 'double', |
119 'unrestricted float': 'float', | 117 'unrestricted float': 'float', |
120 } | 118 } |
121 | 119 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 'bindings/core/v8/V8EventListenerList.h']), | 320 'bindings/core/v8/V8EventListenerList.h']), |
323 'EventListener': set(['bindings/core/v8/BindingSecurity.h', | 321 'EventListener': set(['bindings/core/v8/BindingSecurity.h', |
324 'bindings/core/v8/V8EventListenerList.h', | 322 'bindings/core/v8/V8EventListenerList.h', |
325 'core/frame/LocalDOMWindow.h']), | 323 'core/frame/LocalDOMWindow.h']), |
326 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', | 324 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', |
327 'core/dom/ClassCollection.h', | 325 'core/dom/ClassCollection.h', |
328 'core/dom/TagCollection.h', | 326 'core/dom/TagCollection.h', |
329 'core/html/HTMLCollection.h', | 327 'core/html/HTMLCollection.h', |
330 'core/html/HTMLFormControlsCollection.h', | 328 'core/html/HTMLFormControlsCollection.h', |
331 'core/html/HTMLTableRowsCollection.h']), | 329 'core/html/HTMLTableRowsCollection.h']), |
332 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), | |
333 'NodeList': set(['bindings/core/v8/V8NodeList.h', | 330 'NodeList': set(['bindings/core/v8/V8NodeList.h', |
334 'core/dom/NameNodeList.h', | 331 'core/dom/NameNodeList.h', |
335 'core/dom/NodeList.h', | 332 'core/dom/NodeList.h', |
336 'core/dom/StaticNodeList.h', | 333 'core/dom/StaticNodeList.h', |
337 'core/html/LabelsNodeList.h']), | 334 'core/html/LabelsNodeList.h']), |
338 'Promise': set(['bindings/core/v8/ScriptPromise.h']), | 335 'Promise': set(['bindings/core/v8/ScriptPromise.h']), |
339 'SerializedScriptValue': set(['bindings/core/v8/SerializedScriptValue.h']), | 336 'SerializedScriptValue': set(['bindings/core/v8/SerializedScriptValue.h']), |
340 'ScriptValue': set(['bindings/core/v8/ScriptValue.h']), | 337 'ScriptValue': set(['bindings/core/v8/ScriptValue.h']), |
341 } | 338 } |
342 | 339 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 'short': 'toInt16({arguments})', | 446 'short': 'toInt16({arguments})', |
450 'unsigned short': 'toUInt16({arguments})', | 447 'unsigned short': 'toUInt16({arguments})', |
451 'long': 'toInt32({arguments})', | 448 'long': 'toInt32({arguments})', |
452 'unsigned long': 'toUInt32({arguments})', | 449 'unsigned long': 'toUInt32({arguments})', |
453 'long long': 'toInt64({arguments})', | 450 'long long': 'toInt64({arguments})', |
454 'unsigned long long': 'toUInt64({arguments})', | 451 'unsigned long long': 'toUInt64({arguments})', |
455 # Interface types | 452 # Interface types |
456 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', | 453 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', |
457 'Dictionary': 'Dictionary({v8_value}, {isolate})', | 454 'Dictionary': 'Dictionary({v8_value}, {isolate})', |
458 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v
8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::
Cast({v8_value})) : 0', | 455 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v
8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::
Cast({v8_value})) : 0', |
459 'MediaQueryListListener': 'MediaQueryListListener::create(ScriptState::curre
nt({isolate}), ScriptValue(ScriptState::current({isolate}), {v8_value}))', | |
460 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current(
{isolate}))', | 456 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current(
{isolate}))', |
461 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})
', | 457 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})
', |
462 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, {isolate
})', | 458 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, {isolate
})', |
463 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', | 459 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', |
464 'Window': 'toDOMWindow({v8_value}, {isolate})', | 460 'Window': 'toDOMWindow({v8_value}, {isolate})', |
465 'XPathNSResolver': 'toXPathNSResolver({v8_value}, {isolate})', | 461 'XPathNSResolver': 'toXPathNSResolver({v8_value}, {isolate})', |
466 } | 462 } |
467 | 463 |
468 | 464 |
469 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
e): | 465 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
e): |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 800 |
805 def is_explicit_nullable(idl_type): | 801 def is_explicit_nullable(idl_type): |
806 # Nullable type that isn't implicit nullable (see above.) For such types, | 802 # Nullable type that isn't implicit nullable (see above.) For such types, |
807 # we use Nullable<T> or similar explicit ways to represent a null value. | 803 # we use Nullable<T> or similar explicit ways to represent a null value. |
808 return idl_type.is_nullable and not idl_type.is_implicit_nullable | 804 return idl_type.is_nullable and not idl_type.is_implicit_nullable |
809 | 805 |
810 IdlType.is_implicit_nullable = property(is_implicit_nullable) | 806 IdlType.is_implicit_nullable = property(is_implicit_nullable) |
811 IdlType.is_explicit_nullable = property(is_explicit_nullable) | 807 IdlType.is_explicit_nullable = property(is_explicit_nullable) |
812 IdlUnionType.is_implicit_nullable = False | 808 IdlUnionType.is_implicit_nullable = False |
813 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) | 809 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) |
OLD | NEW |