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 logging | 5 import logging |
6 from operator import itemgetter | 6 from operator import itemgetter |
7 import posixpath | 7 import posixpath |
8 | 8 |
9 from chroot_file_system import ChrootFileSystem | 9 from chroot_file_system import ChrootFileSystem |
10 from content_provider import ContentProvider | 10 from content_provider import ContentProvider |
| 11 from future import Gettable, Future |
11 from svn_constants import JSON_PATH | 12 from svn_constants import JSON_PATH |
12 from third_party.json_schema_compiler.memoize import memoize | 13 from third_party.json_schema_compiler.memoize import memoize |
13 | 14 |
14 | 15 |
15 _CONFIG_PATH = '%s/content_providers.json' % JSON_PATH | 16 _CONFIG_PATH = '%s/content_providers.json' % JSON_PATH |
16 | 17 |
17 | 18 |
18 class ContentProviders(object): | 19 class ContentProviders(object): |
19 '''Implements the content_providers.json configuration; see | 20 '''Implements the content_providers.json configuration; see |
20 chrome/common/extensions/docs/templates/json/content_providers.json for its | 21 chrome/common/extensions/docs/templates/json/content_providers.json for its |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 logging.error('Content provider type "%s" not supported', type_) | 82 logging.error('Content provider type "%s" not supported', type_) |
82 return None | 83 return None |
83 | 84 |
84 return ContentProvider(name, | 85 return ContentProvider(name, |
85 self._compiled_fs_factory, | 86 self._compiled_fs_factory, |
86 file_system, | 87 file_system, |
87 supports_templates=supports_templates, | 88 supports_templates=supports_templates, |
88 supports_zip=supports_zip) | 89 supports_zip=supports_zip) |
89 | 90 |
90 def Cron(self): | 91 def Cron(self): |
91 for name, config in self._GetConfig().iteritems(): | 92 futures = [self._CreateContentProvider(name, config).Cron() |
92 self._CreateContentProvider(name, config).Cron() | 93 for name, config in self._GetConfig().iteritems()] |
| 94 return Future(delegate=Gettable(lambda: [f.Get() for f in futures])) |
OLD | NEW |