 Chromium Code Reviews
 Chromium Code Reviews Issue 26538009:
  Docserver: make file_system a property of Create  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 26538009:
  Docserver: make file_system a property of Create  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: chrome/common/extensions/docs/server2/compiled_file_system.py | 
| diff --git a/chrome/common/extensions/docs/server2/compiled_file_system.py b/chrome/common/extensions/docs/server2/compiled_file_system.py | 
| index 3301c15671c23e055e44586029cde4c0d79f322c..efa35faef2d2d9dd002a8077cbc4ec510835a367 100644 | 
| --- a/chrome/common/extensions/docs/server2/compiled_file_system.py | 
| +++ b/chrome/common/extensions/docs/server2/compiled_file_system.py | 
| @@ -19,11 +19,10 @@ class CompiledFileSystem(object): | 
| class Factory(object): | 
| """A class to build a CompiledFileSystem backed by |file_system|. | 
| """ | 
| - def __init__(self, file_system, object_store_creator): | 
| - self._file_system = file_system | 
| + def __init__(self, object_store_creator): | 
| self._object_store_creator = object_store_creator | 
| - def Create(self, populate_function, cls, category=None): | 
| + def Create(self, file_system, populate_function, cls, category=None): | 
| 
Jeffrey Yasskin
2013/10/14 18:52:31
Please document the file_system argument.
 
not at google - send to devlin
2013/10/14 21:03:34
Done.
 | 
| """Create a CompiledFileSystem that populates the cache by calling | 
| |populate_function| with (path, data), where |data| is the data that was | 
| fetched from |path|. | 
| @@ -32,13 +31,13 @@ class CompiledFileSystem(object): | 
| """ | 
| assert isinstance(cls, type) | 
| assert not cls.__name__[0].islower() # guard against non-class types | 
| - full_name = [cls.__name__, self._file_system.GetIdentity()] | 
| + full_name = [cls.__name__, file_system.GetIdentity()] | 
| if category is not None: | 
| full_name.append(category) | 
| def create_object_store(my_category): | 
| return self._object_store_creator.Create( | 
| CompiledFileSystem, category='/'.join(full_name + [my_category])) | 
| - return CompiledFileSystem(self._file_system, | 
| + return CompiledFileSystem(file_system, | 
| populate_function, | 
| create_object_store('file'), | 
| create_object_store('list')) | 
| @@ -153,13 +152,13 @@ class CompiledFileSystem(object): | 
| return cache_data | 
| return Future(delegate=Gettable(resolve)) | 
| - def StatFile(self, path): | 
| + def GetFileVersion(self, path): | 
| cache_entry = self._file_object_store.Get(path).Get() | 
| if cache_entry is not None: | 
| return cache_entry.version | 
| return self._file_system.Stat(path).version | 
| - def StatFileListing(self, path): | 
| + def GetFileListingVersion(self, path): | 
| if not path.endswith('/'): | 
| path += '/' | 
| cache_entry = self._list_object_store.Get(path).Get() |