| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (C) 2013 Google Inc. All rights reserved. | 2 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class RuntimeFeatureWriter(in_generator.Writer): | 38 class RuntimeFeatureWriter(in_generator.Writer): |
| 39 class_name = 'RuntimeEnabledFeatures' | 39 class_name = 'RuntimeEnabledFeatures' |
| 40 | 40 |
| 41 # FIXME: valid_values and defaults should probably roll into one object. | 41 # FIXME: valid_values and defaults should probably roll into one object. |
| 42 valid_values = { | 42 valid_values = { |
| 43 'status': ['stable', 'experimental', 'test'], | 43 'status': ['stable', 'experimental', 'test'], |
| 44 } | 44 } |
| 45 defaults = { | 45 defaults = { |
| 46 'condition' : None, | 46 'condition' : None, |
| 47 'command_line_flag': False, |
| 47 'depends_on' : [], | 48 'depends_on' : [], |
| 48 'custom': False, | 49 'custom': False, |
| 49 'status': None, | 50 'status': None, |
| 50 } | 51 } |
| 51 | 52 |
| 52 def __init__(self, in_file_path, enabled_conditions): | 53 def __init__(self, in_file_path, enabled_conditions): |
| 53 super(RuntimeFeatureWriter, self).__init__(in_file_path, enabled_conditi
ons) | 54 super(RuntimeFeatureWriter, self).__init__(in_file_path, enabled_conditi
ons) |
| 54 self._outputs = {(self.class_name + ".h"): self.generate_header, | 55 self._outputs = {(self.class_name + ".h"): self.generate_header, |
| 55 (self.class_name + ".cpp"): self.generate_implementatio
n, | 56 (self.class_name + ".cpp"): self.generate_implementatio
n, |
| 56 } | 57 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 @template_expander.use_jinja(class_name + ".cpp.tmpl") | 91 @template_expander.use_jinja(class_name + ".cpp.tmpl") |
| 91 def generate_implementation(self): | 92 def generate_implementation(self): |
| 92 return { | 93 return { |
| 93 'features': self._features, | 94 'features': self._features, |
| 94 'feature_sets': self._feature_sets(), | 95 'feature_sets': self._feature_sets(), |
| 95 } | 96 } |
| 96 | 97 |
| 97 | 98 |
| 98 if __name__ == "__main__": | 99 if __name__ == "__main__": |
| 99 in_generator.Maker(RuntimeFeatureWriter).main(sys.argv) | 100 in_generator.Maker(RuntimeFeatureWriter).main(sys.argv) |
| OLD | NEW |