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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 'bindings/core/v8/V8EventListenerList.h']), | 315 'bindings/core/v8/V8EventListenerList.h']), |
318 'EventListener': set(['bindings/core/v8/BindingSecurity.h', | 316 'EventListener': set(['bindings/core/v8/BindingSecurity.h', |
319 'bindings/core/v8/V8EventListenerList.h', | 317 'bindings/core/v8/V8EventListenerList.h', |
320 'core/frame/LocalDOMWindow.h']), | 318 'core/frame/LocalDOMWindow.h']), |
321 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', | 319 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', |
322 'core/dom/ClassCollection.h', | 320 'core/dom/ClassCollection.h', |
323 'core/dom/TagCollection.h', | 321 'core/dom/TagCollection.h', |
324 'core/html/HTMLCollection.h', | 322 'core/html/HTMLCollection.h', |
325 'core/html/HTMLFormControlsCollection.h', | 323 'core/html/HTMLFormControlsCollection.h', |
326 'core/html/HTMLTableRowsCollection.h']), | 324 'core/html/HTMLTableRowsCollection.h']), |
327 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), | |
328 'NodeList': set(['bindings/core/v8/V8NodeList.h', | 325 'NodeList': set(['bindings/core/v8/V8NodeList.h', |
329 'core/dom/NameNodeList.h', | 326 'core/dom/NameNodeList.h', |
330 'core/dom/NodeList.h', | 327 'core/dom/NodeList.h', |
331 'core/dom/StaticNodeList.h', | 328 'core/dom/StaticNodeList.h', |
332 'core/html/LabelsNodeList.h']), | 329 'core/html/LabelsNodeList.h']), |
333 'Promise': set(['bindings/core/v8/ScriptPromise.h']), | 330 'Promise': set(['bindings/core/v8/ScriptPromise.h']), |
334 'SerializedScriptValue': set(['bindings/core/v8/SerializedScriptValue.h']), | 331 'SerializedScriptValue': set(['bindings/core/v8/SerializedScriptValue.h']), |
335 'ScriptValue': set(['bindings/core/v8/ScriptValue.h']), | 332 'ScriptValue': set(['bindings/core/v8/ScriptValue.h']), |
336 } | 333 } |
337 | 334 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 'short': 'toInt16({arguments})', | 411 'short': 'toInt16({arguments})', |
415 'unsigned short': 'toUInt16({arguments})', | 412 'unsigned short': 'toUInt16({arguments})', |
416 'long': 'toInt32({arguments})', | 413 'long': 'toInt32({arguments})', |
417 'unsigned long': 'toUInt32({arguments})', | 414 'unsigned long': 'toUInt32({arguments})', |
418 'long long': 'toInt64({arguments})', | 415 'long long': 'toInt64({arguments})', |
419 'unsigned long long': 'toUInt64({arguments})', | 416 'unsigned long long': 'toUInt64({arguments})', |
420 # Interface types | 417 # Interface types |
421 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', | 418 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', |
422 'Dictionary': 'Dictionary({v8_value}, {isolate})', | 419 'Dictionary': 'Dictionary({v8_value}, {isolate})', |
423 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v
8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::
Cast({v8_value})) : 0', | 420 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v
8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::
Cast({v8_value})) : 0', |
424 'MediaQueryListListener': 'MediaQueryListListener::create(ScriptState::curre
nt({isolate}), ScriptValue(ScriptState::current({isolate}), {v8_value}))', | |
425 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current(
{isolate}))', | 421 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current(
{isolate}))', |
426 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})
', | 422 'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})
', |
427 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, {isolate
})', | 423 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, {isolate
})', |
428 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', | 424 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', |
429 'Window': 'toDOMWindow({v8_value}, {isolate})', | 425 'Window': 'toDOMWindow({v8_value}, {isolate})', |
430 'XPathNSResolver': 'toXPathNSResolver({v8_value}, {isolate})', | 426 'XPathNSResolver': 'toXPathNSResolver({v8_value}, {isolate})', |
431 } | 427 } |
432 | 428 |
433 | 429 |
434 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
e): | 430 def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
e): |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 | 757 |
762 def is_explicit_nullable(idl_type): | 758 def is_explicit_nullable(idl_type): |
763 # Nullable type that isn't implicit nullable (see above.) For such types, | 759 # Nullable type that isn't implicit nullable (see above.) For such types, |
764 # we use Nullable<T> or similar explicit ways to represent a null value. | 760 # we use Nullable<T> or similar explicit ways to represent a null value. |
765 return idl_type.is_nullable and not idl_type.is_implicit_nullable | 761 return idl_type.is_nullable and not idl_type.is_implicit_nullable |
766 | 762 |
767 IdlType.is_implicit_nullable = property(is_implicit_nullable) | 763 IdlType.is_implicit_nullable = property(is_implicit_nullable) |
768 IdlType.is_explicit_nullable = property(is_explicit_nullable) | 764 IdlType.is_explicit_nullable = property(is_explicit_nullable) |
769 IdlUnionType.is_implicit_nullable = False | 765 IdlUnionType.is_implicit_nullable = False |
770 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) | 766 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) |
OLD | NEW |