OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import posixpath | 5 import posixpath |
6 | 6 |
7 from compiled_file_system import SingleFile, Unicode | 7 from compiled_file_system import Cache, SingleFile, Unicode |
8 from extensions_paths import API_PATHS | 8 from extensions_paths import API_PATHS |
9 from features_bundle import HasParent, GetParentName | 9 from features_bundle import HasParent, GetParentName |
10 from file_system import FileNotFoundError | 10 from file_system import FileNotFoundError |
11 from future import All, Future | 11 from future import All, Future |
12 from operator import itemgetter | 12 from operator import itemgetter |
13 from platform_util import PlatformToExtensionType | 13 from platform_util import PlatformToExtensionType |
14 from schema_util import ProcessSchema | 14 from schema_util import ProcessSchema |
15 from third_party.json_schema_compiler.json_schema import DeleteNodes | 15 from third_party.json_schema_compiler.json_schema import DeleteNodes |
16 from third_party.json_schema_compiler.model import Namespace, UnixName | 16 from third_party.json_schema_compiler.model import Namespace, UnixName |
17 | 17 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 compiled_fs_factory, | 56 compiled_fs_factory, |
57 file_system, | 57 file_system, |
58 object_store_creator, | 58 object_store_creator, |
59 platform): | 59 platform): |
60 self._features_bundle = features_bundle | 60 self._features_bundle = features_bundle |
61 self._platform = PlatformToExtensionType(platform) | 61 self._platform = PlatformToExtensionType(platform) |
62 self._model_cache = compiled_fs_factory.Create( | 62 self._model_cache = compiled_fs_factory.Create( |
63 file_system, self._CreateAPIModel, APIModels, category=self._platform) | 63 file_system, self._CreateAPIModel, APIModels, category=self._platform) |
64 self._object_store = object_store_creator.Create(APIModels) | 64 self._object_store = object_store_creator.Create(APIModels) |
65 | 65 |
| 66 @Cache |
66 @SingleFile | 67 @SingleFile |
67 @Unicode | 68 @Unicode |
68 def _CreateAPIModel(self, path, data): | 69 def _CreateAPIModel(self, path, data): |
69 def does_not_include_platform(node): | 70 def does_not_include_platform(node): |
70 return ('extension_types' in node and | 71 return ('extension_types' in node and |
71 node['extension_types'] != 'all' and | 72 node['extension_types'] != 'all' and |
72 self._platform not in node['extension_types']) | 73 self._platform not in node['extension_types']) |
73 | 74 |
74 schema = ProcessSchema(path, data)[0] | 75 schema = ProcessSchema(path, data)[0] |
75 if not schema: | 76 if not schema: |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 176 |
176 def IterModels(self): | 177 def IterModels(self): |
177 future_models = [(name, self.GetModel(name)) for name in self.GetNames()] | 178 future_models = [(name, self.GetModel(name)) for name in self.GetNames()] |
178 for name, future_model in future_models: | 179 for name, future_model in future_models: |
179 try: | 180 try: |
180 model = future_model.Get() | 181 model = future_model.Get() |
181 except FileNotFoundError: | 182 except FileNotFoundError: |
182 continue | 183 continue |
183 if model: | 184 if model: |
184 yield name, model | 185 yield name, model |
OLD | NEW |