| 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 18 matching lines...) Expand all Loading... |
| 29 """Generate template values for an interface. | 29 """Generate template values for an interface. |
| 30 | 30 |
| 31 FIXME: Not currently used in build. | 31 FIXME: Not currently used in build. |
| 32 This is a rewrite of the Perl IDL compiler in Python, but is not complete. | 32 This is a rewrite of the Perl IDL compiler in Python, but is not complete. |
| 33 Once it is complete, we will switch all IDL files over to Python at once. | 33 Once it is complete, we will switch all IDL files over to Python at once. |
| 34 Until then, please work on the Perl IDL compiler. | 34 Until then, please work on the Perl IDL compiler. |
| 35 For details, see bug http://crbug.com/239771 | 35 For details, see bug http://crbug.com/239771 |
| 36 """ | 36 """ |
| 37 | 37 |
| 38 import v8_attributes | 38 import v8_attributes |
| 39 from v8_utilities import cpp_class_name, runtime_enable_function_name, v8_class_
name | 39 from v8_utilities import cpp_implemented_as_name, runtime_enable_function_name,
v8_class_name |
| 40 | 40 |
| 41 | 41 |
| 42 INTERFACE_H_INCLUDES = set([ | 42 INTERFACE_H_INCLUDES = set([ |
| 43 'bindings/v8/V8Binding.h', | 43 'bindings/v8/V8Binding.h', |
| 44 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? | 44 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? |
| 45 'bindings/v8/WrapperTypeInfo.h', # FIXME: necessary? | 45 'bindings/v8/WrapperTypeInfo.h', # FIXME: necessary? |
| 46 ]) | 46 ]) |
| 47 INTERFACE_CPP_INCLUDES = set([ | 47 INTERFACE_CPP_INCLUDES = set([ |
| 48 'RuntimeEnabledFeatures.h', | 48 'RuntimeEnabledFeatures.h', |
| 49 'bindings/v8/ScriptController.h', | 49 'bindings/v8/ScriptController.h', |
| 50 'bindings/v8/V8Binding.h', | 50 'bindings/v8/V8Binding.h', |
| 51 'bindings/v8/V8DOMConfiguration.h', # FIXME: necessary? | 51 'bindings/v8/V8DOMConfiguration.h', # FIXME: necessary? |
| 52 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? | 52 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? |
| 53 'core/dom/ContextFeatures.h', | 53 'core/dom/ContextFeatures.h', |
| 54 'core/dom/Document.h', | 54 'core/dom/Document.h', |
| 55 'core/platform/chromium/TraceEvent.h', | 55 'core/platform/chromium/TraceEvent.h', |
| 56 'wtf/UnusedParam.h', | 56 'wtf/UnusedParam.h', |
| 57 ]) | 57 ]) |
| 58 | 58 |
| 59 | 59 |
| 60 def generate_interface(interface): | 60 def generate_interface(interface): |
| 61 header_includes = INTERFACE_H_INCLUDES | 61 header_includes = INTERFACE_H_INCLUDES |
| 62 cpp_includes = INTERFACE_CPP_INCLUDES | 62 cpp_includes = INTERFACE_CPP_INCLUDES |
| 63 | 63 |
| 64 template_contents = { | 64 template_contents = { |
| 65 'interface_name': interface.name, | 65 'interface_name': interface.name, |
| 66 'cpp_class_name': cpp_class_name(interface), | 66 'cpp_class_name': cpp_implemented_as_name(interface), |
| 67 'v8_class_name': v8_class_name(interface), | 67 'v8_class_name': v8_class_name(interface), |
| 68 'constants': [generate_constant(constant) for constant in interface.cons
tants], | 68 'constants': [generate_constant(constant) for constant in interface.cons
tants], |
| 69 'do_not_check_constants': 'DoNotCheckConstants' in interface.extended_at
tributes, | 69 'do_not_check_constants': 'DoNotCheckConstants' in interface.extended_at
tributes, |
| 70 # Includes are modified in-place after generating members | 70 # Includes are modified in-place after generating members |
| 71 'header_includes': header_includes, | 71 'header_includes': header_includes, |
| 72 'cpp_includes': cpp_includes, | 72 'cpp_includes': cpp_includes, |
| 73 } | 73 } |
| 74 attributes_contents, attributes_includes = v8_attributes.generate_attributes
(interface) | 74 attributes_contents, attributes_includes = v8_attributes.generate_attributes
(interface) |
| 75 template_contents.update(attributes_contents) | 75 template_contents.update(attributes_contents) |
| 76 cpp_includes |= attributes_includes | 76 cpp_includes |= attributes_includes |
| (...skipping 13 matching lines...) Expand all Loading... |
| 90 enabled_at_runtime = 'EnabledAtRuntime' in constant.extended_attributes | 90 enabled_at_runtime = 'EnabledAtRuntime' in constant.extended_attributes |
| 91 constant_parameter = { | 91 constant_parameter = { |
| 92 'name': constant.name, | 92 'name': constant.name, |
| 93 # FIXME: use 'reflected_name' as correct 'name' | 93 # FIXME: use 'reflected_name' as correct 'name' |
| 94 'reflected_name': reflected_name, | 94 'reflected_name': reflected_name, |
| 95 'value': value, | 95 'value': value, |
| 96 'enabled_at_runtime': enabled_at_runtime, | 96 'enabled_at_runtime': enabled_at_runtime, |
| 97 'runtime_enable_function_name': runtime_enable_function_name(constant) i
f enabled_at_runtime else None, | 97 'runtime_enable_function_name': runtime_enable_function_name(constant) i
f enabled_at_runtime else None, |
| 98 } | 98 } |
| 99 return constant_parameter | 99 return constant_parameter |
| OLD | NEW |