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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 valid_values = { | 43 valid_values = { |
44 'status': ['stable', 'experimental', 'test'], | 44 'status': ['stable', 'experimental', 'test'], |
45 } | 45 } |
46 defaults = { | 46 defaults = { |
47 'condition' : None, | 47 'condition' : None, |
48 'depends_on' : [], | 48 'depends_on' : [], |
49 'custom': False, | 49 'custom': False, |
50 'status': None, | 50 'status': None, |
51 } | 51 } |
52 | 52 |
53 def __init__(self, in_file_path, enabled_conditions): | 53 def __init__(self, in_file_path): |
54 super(RuntimeFeatureWriter, self).__init__(in_file_path, enabled_conditi
ons) | 54 super(RuntimeFeatureWriter, self).__init__(in_file_path) |
55 self._outputs = {(self.class_name + ".h"): self.generate_header, | 55 self._outputs = {(self.class_name + ".h"): self.generate_header, |
56 (self.class_name + ".cpp"): self.generate_implementatio
n, | 56 (self.class_name + ".cpp"): self.generate_implementatio
n, |
57 } | 57 } |
58 | 58 |
59 self._features = self.in_file.name_dictionaries | 59 self._features = self.in_file.name_dictionaries |
60 # Make sure the resulting dictionaries have all the keys we expect. | 60 # Make sure the resulting dictionaries have all the keys we expect. |
61 for feature in self._features: | 61 for feature in self._features: |
62 feature['first_lowered_name'] = lower_first(feature['name']) | 62 feature['first_lowered_name'] = lower_first(feature['name']) |
63 # Most features just check their isFooEnabled bool | 63 # Most features just check their isFooEnabled bool |
64 # but some depend on more than one bool. | 64 # but some depend on more than one bool. |
(...skipping 18 matching lines...) Expand all Loading... |
83 @template_expander.use_jinja(class_name + ".cpp.tmpl") | 83 @template_expander.use_jinja(class_name + ".cpp.tmpl") |
84 def generate_implementation(self): | 84 def generate_implementation(self): |
85 return { | 85 return { |
86 'features': self._features, | 86 'features': self._features, |
87 'feature_sets': self._feature_sets(), | 87 'feature_sets': self._feature_sets(), |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 if __name__ == "__main__": | 91 if __name__ == "__main__": |
92 in_generator.Maker(RuntimeFeatureWriter).main(sys.argv) | 92 in_generator.Maker(RuntimeFeatureWriter).main(sys.argv) |
OLD | NEW |