| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 os | 5 import os |
| 6 | 6 |
| 7 import object_store | 7 import object_store |
| 8 | 8 |
| 9 APPS = 'Apps' | 9 APPS = 'Apps' |
| 10 APPS_FS = 'AppsFileSystem' | 10 APPS_FS = 'AppsFileSystem' |
| 11 CRON = 'Cron' | 11 CRON = 'Cron' |
| 12 EXTENSIONS = 'Extensions' | 12 EXTENSIONS = 'Extensions' |
| 13 EXTENSIONS_FS = 'ExtensionsFileSystem' | 13 EXTENSIONS_FS = 'ExtensionsFileSystem' |
| 14 CRON_FILE_LISTING = 'Cron.FileListing' | 14 CRON_FILE_LISTING = 'Cron.FileListing' |
| 15 CRON_GITHUB_INVALIDATION = 'Cron.GithubInvalidation' | 15 CRON_GITHUB_INVALIDATION = 'Cron.GithubInvalidation' |
| 16 CRON_INVALIDATION = 'Cron.Invalidation' | 16 CRON_INVALIDATION = 'Cron.Invalidation' |
| 17 HANDLEBAR = 'Handlebar' | 17 HANDLEBAR = 'Handlebar' |
| 18 IDL = 'IDL' | 18 IDL = 'IDL' |
| 19 IDL_NAMES = 'IDLNames' | 19 IDL_NAMES = 'IDLNames' |
| 20 INTRO = 'Intro' | 20 INTRO = 'Intro' |
| 21 JSON = 'JSON' | 21 JSON = 'JSON' |
| 22 LIST = 'List' | 22 LIST = 'List' |
| 23 NAMES = 'Names' |
| 23 PERMS = 'Perms' | 24 PERMS = 'Perms' |
| 24 STATIC = 'Static' | 25 STATIC = 'Static' |
| 25 ZIP = 'Zip' | 26 ZIP = 'Zip' |
| 26 | 27 |
| 27 class _CacheEntry(object): | 28 class _CacheEntry(object): |
| 28 def __init__(self, cache_data, version): | 29 def __init__(self, cache_data, version): |
| 29 self._cache_data = cache_data | 30 self._cache_data = cache_data |
| 30 self.version = version | 31 self.version = version |
| 31 | 32 |
| 32 class CompiledFileSystem(object): | 33 class CompiledFileSystem(object): |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 time=0).Get() | 108 time=0).Get() |
| 108 if (cache_entry is not None) and (version == cache_entry.version): | 109 if (cache_entry is not None) and (version == cache_entry.version): |
| 109 return cache_entry._cache_data | 110 return cache_entry._cache_data |
| 110 cache_data = self._populate_function(self._RecursiveList( | 111 cache_data = self._populate_function(self._RecursiveList( |
| 111 [path + f for f in self._file_system.ReadSingle(path)])) | 112 [path + f for f in self._file_system.ReadSingle(path)])) |
| 112 self._object_store.Set(self._MakeKey(path), | 113 self._object_store.Set(self._MakeKey(path), |
| 113 _CacheEntry(cache_data, version), | 114 _CacheEntry(cache_data, version), |
| 114 object_store.FILE_SYSTEM_CACHE_LISTING, | 115 object_store.FILE_SYSTEM_CACHE_LISTING, |
| 115 time=0) | 116 time=0) |
| 116 return cache_data | 117 return cache_data |
| OLD | NEW |