Chromium Code Reviews| 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 logging | |
|
not at google - send to devlin
2013/04/27 01:48:34
unnecessary
epeterson
2013/04/27 23:17:23
Done.
| |
| 6 | |
| 5 class _CacheEntry(object): | 7 class _CacheEntry(object): |
| 6 def __init__(self, cache_data, version): | 8 def __init__(self, cache_data, version): |
| 7 self._cache_data = cache_data | 9 self._cache_data = cache_data |
| 8 self.version = version | 10 self.version = version |
| 9 | 11 |
| 10 class CompiledFileSystem(object): | 12 class CompiledFileSystem(object): |
| 11 """This class caches FileSystem data that has been processed. | 13 """This class caches FileSystem data that has been processed. |
| 12 """ | 14 """ |
| 13 class Factory(object): | 15 class Factory(object): |
| 14 """A class to build a CompiledFileSystem backed by |file_system|. | 16 """A class to build a CompiledFileSystem backed by |file_system|. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 """ | 101 """ |
| 100 if not path.endswith('/'): | 102 if not path.endswith('/'): |
| 101 path += '/' | 103 path += '/' |
| 102 version = self._file_system.Stat(path).version | 104 version = self._file_system.Stat(path).version |
| 103 cache_entry = self._list_object_store.Get(path).Get() | 105 cache_entry = self._list_object_store.Get(path).Get() |
| 104 if (cache_entry is not None) and (version == cache_entry.version): | 106 if (cache_entry is not None) and (version == cache_entry.version): |
| 105 return cache_entry._cache_data | 107 return cache_entry._cache_data |
| 106 cache_data = self._populate_function(path, self._RecursiveList(path)) | 108 cache_data = self._populate_function(path, self._RecursiveList(path)) |
| 107 self._list_object_store.Set(path, _CacheEntry(cache_data, version)) | 109 self._list_object_store.Set(path, _CacheEntry(cache_data, version)) |
| 108 return cache_data | 110 return cache_data |
| OLD | NEW |