| 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 class _CacheEntry(object): | 5 class _CacheEntry(object): |
| 6 def __init__(self, cache_data, version): | 6 def __init__(self, cache_data, version): |
| 7 self._cache_data = cache_data | 7 self._cache_data = cache_data |
| 8 self.version = version | 8 self.version = version |
| 9 | 9 |
| 10 class CompiledFileSystem(object): | 10 class CompiledFileSystem(object): |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 """ | 86 """ |
| 87 if not path.endswith('/'): | 87 if not path.endswith('/'): |
| 88 path += '/' | 88 path += '/' |
| 89 version = self._file_system.Stat(path).version | 89 version = self._file_system.Stat(path).version |
| 90 cache_entry = self._list_object_store.Get(path).Get() | 90 cache_entry = self._list_object_store.Get(path).Get() |
| 91 if (cache_entry is not None) and (version == cache_entry.version): | 91 if (cache_entry is not None) and (version == cache_entry.version): |
| 92 return cache_entry._cache_data | 92 return cache_entry._cache_data |
| 93 cache_data = self._populate_function(path, self._RecursiveList(path)) | 93 cache_data = self._populate_function(path, self._RecursiveList(path)) |
| 94 self._list_object_store.Set(path, _CacheEntry(cache_data, version)) | 94 self._list_object_store.Set(path, _CacheEntry(cache_data, version)) |
| 95 return cache_data | 95 return cache_data |
| 96 |
| 97 def StatFile(self, path): |
| 98 cache_entry = self._file_object_store.Get(path).Get() |
| 99 if cache_entry is not None: |
| 100 return cache_entry.version |
| 101 return self._file_system.Stat(path).version |
| 102 |
| 103 def StatFileListing(self, path): |
| 104 if not path.endswith('/'): |
| 105 path += '/' |
| 106 cache_entry = self._list_object_store.Get(path).Get() |
| 107 if cache_entry is not None: |
| 108 return cache_entry.version |
| 109 return self._file_system.Stat(path).version |
| OLD | NEW |