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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 '%s: content provider type "%s" not supported' % (name, type_)) | 96 '%s: content provider type "%s" not supported' % (name, type_)) |
96 return None | 97 return None |
97 | 98 |
98 return ContentProvider(name, | 99 return ContentProvider(name, |
99 self._compiled_fs_factory, | 100 self._compiled_fs_factory, |
100 file_system, | 101 file_system, |
101 supports_templates=supports_templates, | 102 supports_templates=supports_templates, |
102 supports_zip=supports_zip) | 103 supports_zip=supports_zip) |
103 | 104 |
104 def Cron(self): | 105 def Cron(self): |
105 for name, config in self._GetConfig().iteritems(): | 106 futures = [self._CreateContentProvider(name, config).Cron() |
106 self._CreateContentProvider(name, config).Cron() | 107 for name, config in self._GetConfig().iteritems()] |
| 108 return Future(delegate=Gettable(lambda: [f.Get() for f in futures])) |
OLD | NEW |