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, Race | 11 from future import All, Future, Race |
12 from operator import itemgetter | 12 from operator import itemgetter |
13 from path_util import Join | 13 from path_util import Join |
14 from platform_util import PlatformToExtensionType | 14 from platform_util import PlatformToExtensionType |
15 from schema_util import ProcessSchema | 15 from schema_util import ProcessSchema |
16 from third_party.json_schema_compiler.json_schema import DeleteNodes | 16 from third_party.json_schema_compiler.json_schema import DeleteNodes |
17 from third_party.json_schema_compiler.model import Namespace, UnixName | 17 from third_party.json_schema_compiler.model import Namespace, UnixName |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 compiled_fs_factory, | 57 compiled_fs_factory, |
58 file_system, | 58 file_system, |
59 object_store_creator, | 59 object_store_creator, |
60 platform): | 60 platform): |
61 self._features_bundle = features_bundle | 61 self._features_bundle = features_bundle |
62 self._platform = PlatformToExtensionType(platform) | 62 self._platform = PlatformToExtensionType(platform) |
63 self._model_cache = compiled_fs_factory.Create( | 63 self._model_cache = compiled_fs_factory.Create( |
64 file_system, self._CreateAPIModel, APIModels, category=self._platform) | 64 file_system, self._CreateAPIModel, APIModels, category=self._platform) |
65 self._object_store = object_store_creator.Create(APIModels) | 65 self._object_store = object_store_creator.Create(APIModels) |
66 | 66 |
| 67 @Cache |
67 @SingleFile | 68 @SingleFile |
68 @Unicode | 69 @Unicode |
69 def _CreateAPIModel(self, path, data): | 70 def _CreateAPIModel(self, path, data): |
70 def does_not_include_platform(node): | 71 def does_not_include_platform(node): |
71 return ('extension_types' in node and | 72 return ('extension_types' in node and |
72 node['extension_types'] != 'all' and | 73 node['extension_types'] != 'all' and |
73 self._platform not in node['extension_types']) | 74 self._platform not in node['extension_types']) |
74 | 75 |
75 schema = ProcessSchema(path, data)[0] | 76 schema = ProcessSchema(path, data)[0] |
76 if not schema: | 77 if not schema: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 174 |
174 def IterModels(self): | 175 def IterModels(self): |
175 future_models = [(name, self.GetModel(name)) for name in self.GetNames()] | 176 future_models = [(name, self.GetModel(name)) for name in self.GetNames()] |
176 for name, future_model in future_models: | 177 for name, future_model in future_models: |
177 try: | 178 try: |
178 model = future_model.Get() | 179 model = future_model.Get() |
179 except FileNotFoundError: | 180 except FileNotFoundError: |
180 continue | 181 continue |
181 if model: | 182 if model: |
182 yield name, model | 183 yield name, model |
OLD | NEW |