| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 42 from idl_types import IdlTypeBase, IdlType, IdlUnionType, IdlArrayOrSequenceType
     , IdlNullableType | 42 from idl_types import IdlTypeBase, IdlType, IdlUnionType, IdlArrayOrSequenceType
     , IdlNullableType | 
| 43 import v8_attributes  # for IdlType.constructor_type_name | 43 import v8_attributes  # for IdlType.constructor_type_name | 
| 44 from v8_globals import includes | 44 from v8_globals import includes | 
| 45 | 45 | 
| 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', |  | 
| 53     'Dictionary', | 52     'Dictionary', | 
| 54     'EventHandler', | 53     'EventHandler', | 
| 55     'EventListener', | 54     'EventListener', | 
| 56     'NodeFilter', | 55     'NodeFilter', | 
| 57     'SerializedScriptValue', | 56     'SerializedScriptValue', | 
| 58 ]) | 57 ]) | 
| 59 TYPED_ARRAYS = { | 58 TYPED_ARRAYS = { | 
| 60     # (cpp_type, v8_type), used by constructor templates | 59     # (cpp_type, v8_type), used by constructor templates | 
| 61     'ArrayBuffer': None, | 60     'ArrayBuffer': None, | 
| 62     'ArrayBufferView': None, | 61     'ArrayBufferView': None, | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 94     'long', | 93     'long', | 
| 95     'short', | 94     'short', | 
| 96 ]) | 95 ]) | 
| 97 CPP_UNSIGNED_TYPES = set([ | 96 CPP_UNSIGNED_TYPES = set([ | 
| 98     'octet', | 97     'octet', | 
| 99     'unsigned int', | 98     'unsigned int', | 
| 100     'unsigned long', | 99     'unsigned long', | 
| 101     'unsigned short', | 100     'unsigned short', | 
| 102 ]) | 101 ]) | 
| 103 CPP_SPECIAL_CONVERSION_RULES = { | 102 CPP_SPECIAL_CONVERSION_RULES = { | 
| 104     'CompareHow': 'Range::CompareHow', |  | 
| 105     'Date': 'double', | 103     'Date': 'double', | 
| 106     'Dictionary': 'Dictionary', | 104     'Dictionary': 'Dictionary', | 
| 107     'EventHandler': 'EventListener*', | 105     'EventHandler': 'EventListener*', | 
| 108     'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', | 106     'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', | 
| 109     'Promise': 'ScriptPromise', | 107     'Promise': 'ScriptPromise', | 
| 110     'ScriptValue': 'ScriptValue', | 108     'ScriptValue': 'ScriptValue', | 
| 111     # FIXME: Eliminate custom bindings for XPathNSResolver  http://crbug.com/345
     529 | 109     # FIXME: Eliminate custom bindings for XPathNSResolver  http://crbug.com/345
     529 | 
| 112     'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', | 110     'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', | 
| 113     'boolean': 'bool', | 111     'boolean': 'bool', | 
| 114     'unrestricted double': 'double', | 112     'unrestricted double': 'double', | 
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 321 ################################################################################ | 319 ################################################################################ | 
| 322 # Includes | 320 # Includes | 
| 323 ################################################################################ | 321 ################################################################################ | 
| 324 | 322 | 
| 325 def includes_for_cpp_class(class_name, relative_dir_posix): | 323 def includes_for_cpp_class(class_name, relative_dir_posix): | 
| 326     return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h'
     )]) | 324     return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h'
     )]) | 
| 327 | 325 | 
| 328 | 326 | 
| 329 INCLUDES_FOR_TYPE = { | 327 INCLUDES_FOR_TYPE = { | 
| 330     'object': set(), | 328     'object': set(), | 
| 331     'CompareHow': set(), |  | 
| 332     'Dictionary': set(['bindings/core/v8/Dictionary.h']), | 329     'Dictionary': set(['bindings/core/v8/Dictionary.h']), | 
| 333     'EventHandler': set(['bindings/core/v8/V8AbstractEventListener.h', | 330     'EventHandler': set(['bindings/core/v8/V8AbstractEventListener.h', | 
| 334                          'bindings/core/v8/V8EventListenerList.h']), | 331                          'bindings/core/v8/V8EventListenerList.h']), | 
| 335     'EventListener': set(['bindings/core/v8/BindingSecurity.h', | 332     'EventListener': set(['bindings/core/v8/BindingSecurity.h', | 
| 336                           'bindings/core/v8/V8EventListenerList.h', | 333                           'bindings/core/v8/V8EventListenerList.h', | 
| 337                           'core/frame/LocalDOMWindow.h']), | 334                           'core/frame/LocalDOMWindow.h']), | 
| 338     'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', | 335     'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', | 
| 339                            'core/dom/ClassCollection.h', | 336                            'core/dom/ClassCollection.h', | 
| 340                            'core/dom/TagCollection.h', | 337                            'core/dom/TagCollection.h', | 
| 341                            'core/html/HTMLCollection.h', | 338                            'core/html/HTMLCollection.h', | 
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 454     'unrestricted double': 'toDouble({arguments})', | 451     'unrestricted double': 'toDouble({arguments})', | 
| 455     'byte': 'toInt8({arguments})', | 452     'byte': 'toInt8({arguments})', | 
| 456     'octet': 'toUInt8({arguments})', | 453     'octet': 'toUInt8({arguments})', | 
| 457     'short': 'toInt16({arguments})', | 454     'short': 'toInt16({arguments})', | 
| 458     'unsigned short': 'toUInt16({arguments})', | 455     'unsigned short': 'toUInt16({arguments})', | 
| 459     'long': 'toInt32({arguments})', | 456     'long': 'toInt32({arguments})', | 
| 460     'unsigned long': 'toUInt32({arguments})', | 457     'unsigned long': 'toUInt32({arguments})', | 
| 461     'long long': 'toInt64({arguments})', | 458     'long long': 'toInt64({arguments})', | 
| 462     'unsigned long long': 'toUInt64({arguments})', | 459     'unsigned long long': 'toUInt64({arguments})', | 
| 463     # Interface types | 460     # Interface types | 
| 464     'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', |  | 
| 465     'Dictionary': 'Dictionary({v8_value}, {isolate})', | 461     'Dictionary': 'Dictionary({v8_value}, {isolate})', | 
| 466     'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v
     8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::
     Cast({v8_value})) : 0', | 462     'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v
     8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::
     Cast({v8_value})) : 0', | 
| 467     'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current(
     {isolate}))', | 463     'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current(
     {isolate}))', | 
| 468     'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})
     ', | 464     'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})
     ', | 
| 469     'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, {isolate
     })', | 465     'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, {isolate
     })', | 
| 470     'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', | 466     'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', | 
| 471     'Window': 'toDOMWindow({v8_value}, {isolate})', | 467     'Window': 'toDOMWindow({v8_value}, {isolate})', | 
| 472     'XPathNSResolver': 'toXPathNSResolver({v8_value}, {isolate})', | 468     'XPathNSResolver': 'toXPathNSResolver({v8_value}, {isolate})', | 
| 473 } | 469 } | 
| 474 | 470 | 
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 838 | 834 | 
| 839 | 835 | 
| 840 def is_explicit_nullable(idl_type): | 836 def is_explicit_nullable(idl_type): | 
| 841     # Nullable type that isn't implicit nullable (see above.) For such types, | 837     # Nullable type that isn't implicit nullable (see above.) For such types, | 
| 842     # we use Nullable<T> or similar explicit ways to represent a null value. | 838     # we use Nullable<T> or similar explicit ways to represent a null value. | 
| 843     return idl_type.is_nullable and not idl_type.is_implicit_nullable | 839     return idl_type.is_nullable and not idl_type.is_implicit_nullable | 
| 844 | 840 | 
| 845 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) | 841 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) | 
| 846 IdlUnionType.is_implicit_nullable = False | 842 IdlUnionType.is_implicit_nullable = False | 
| 847 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) | 843 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) | 
| OLD | NEW | 
|---|