Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 from v8_utilities import conditional_string, cpp_name, runtime_enabled_function_ name | 43 from v8_utilities import conditional_string, cpp_name, runtime_enabled_function_ name |
| 44 | 44 |
| 45 | 45 |
| 46 INTERFACE_H_INCLUDES = set([ | 46 INTERFACE_H_INCLUDES = set([ |
| 47 'bindings/v8/V8Binding.h', | 47 'bindings/v8/V8Binding.h', |
| 48 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? | 48 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? |
| 49 'bindings/v8/WrapperTypeInfo.h', # FIXME: necessary? | 49 'bindings/v8/WrapperTypeInfo.h', # FIXME: necessary? |
| 50 ]) | 50 ]) |
| 51 INTERFACE_CPP_INCLUDES = set([ | 51 INTERFACE_CPP_INCLUDES = set([ |
| 52 'RuntimeEnabledFeatures.h', | 52 'RuntimeEnabledFeatures.h', |
| 53 'bindings/v8/ScriptController.h', | |
|
Nils Barth (inactive)
2013/11/22 06:10:48
Now conditional; this makes a difference for 100+
| |
| 54 'bindings/v8/V8Binding.h', | 53 'bindings/v8/V8Binding.h', |
| 55 'bindings/v8/V8DOMConfiguration.h', # FIXME: necessary? | 54 'bindings/v8/V8DOMConfiguration.h', # FIXME: necessary? |
| 56 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? | 55 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? |
| 57 'core/dom/ContextFeatures.h', | 56 'core/dom/ContextFeatures.h', |
| 58 'core/dom/Document.h', | 57 'core/dom/Document.h', |
| 59 'platform/TraceEvent.h', | 58 'platform/TraceEvent.h', |
| 60 'wtf/UnusedParam.h', | 59 'wtf/UnusedParam.h', |
| 61 ]) | 60 ]) |
| 62 | 61 |
| 63 | 62 |
| 64 def generate_interface(interface): | 63 def generate_interface(interface): |
| 65 includes.clear() | 64 includes.clear() |
| 66 includes.update(INTERFACE_CPP_INCLUDES) | 65 includes.update(INTERFACE_CPP_INCLUDES) |
| 67 extended_attributes = interface.extended_attributes | 66 extended_attributes = interface.extended_attributes |
| 68 v8_class_name = v8_utilities.v8_class_name(interface) | 67 v8_class_name = v8_utilities.v8_class_name(interface) |
| 69 | 68 |
| 69 has_custom_to_v8 = 'CustomToV8' in extended_attributes # [CustomToV8] | |
| 70 if not has_custom_to_v8: | |
| 71 includes.add('bindings/v8/ScriptController.h') | |
|
haraken
2013/11/22 07:14:04
Why do we need ScriptController for [CustomToV8]?
Nils Barth (inactive)
2013/12/03 02:52:28
Actually this was included for all *but* [CustomTo
| |
| 70 is_check_security = 'CheckSecurity' in extended_attributes | 72 is_check_security = 'CheckSecurity' in extended_attributes |
| 71 if is_check_security: | 73 if is_check_security: |
| 72 includes.update(['bindings/v8/BindingSecurity.h', | 74 includes.update(['bindings/v8/BindingSecurity.h', |
| 73 'bindings/v8/ExceptionMessages.h', | 75 'bindings/v8/ExceptionMessages.h', |
| 74 'bindings/v8/ExceptionState.h']) | 76 'bindings/v8/ExceptionState.h']) |
| 75 | 77 |
| 76 template_contents = { | 78 template_contents = { |
| 77 'conditional_string': conditional_string(interface), # [Conditional] | 79 'conditional_string': conditional_string(interface), # [Conditional] |
| 78 'cpp_class_name': cpp_name(interface), | 80 'cpp_class_name': cpp_name(interface), |
| 79 'has_custom_legacy_call': 'CustomLegacyCall' in extended_attributes, # [CustomLegacyCall] | 81 'has_custom_legacy_call': 'CustomLegacyCall' in extended_attributes, # [CustomLegacyCall] |
| 82 'has_custom_to_v8': has_custom_to_v8, | |
| 80 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap] | 83 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap] |
| 81 'has_resolve_wrapper_reachability': 'CustomIsReachable' in extended_attr ibutes, # [CustomIsReachable] | 84 'has_resolve_wrapper_reachability': 'CustomIsReachable' in extended_attr ibutes, # [CustomIsReachable] |
| 82 'header_includes': INTERFACE_H_INCLUDES, | 85 'header_includes': INTERFACE_H_INCLUDES, |
| 83 'interface_name': interface.name, | 86 'interface_name': interface.name, |
| 84 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject] | 87 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject] |
| 85 'is_check_security': is_check_security, | 88 'is_check_security': is_check_security, |
| 86 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime] | 89 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime] |
| 87 'v8_class_name': v8_class_name, | 90 'v8_class_name': v8_class_name, |
| 88 } | 91 } |
| 89 | 92 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 '%s->IsString()' % cpp_value, | 246 '%s->IsString()' % cpp_value, |
| 244 '%s->IsObject()' % cpp_value]) | 247 '%s->IsObject()' % cpp_value]) |
| 245 if v8_types.array_or_sequence_type(idl_type): | 248 if v8_types.array_or_sequence_type(idl_type): |
| 246 return '%s->IsArray()' % cpp_value | 249 return '%s->IsArray()' % cpp_value |
| 247 if v8_types.is_wrapper_type(idl_type): | 250 if v8_types.is_wrapper_type(idl_type): |
| 248 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value) | 251 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value) |
| 249 if argument['is_nullable']: | 252 if argument['is_nullable']: |
| 250 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) | 253 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) |
| 251 return type_check | 254 return type_check |
| 252 return None | 255 return None |
| OLD | NEW |