Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5077)

Unified Diff: chrome/common/extensions/docs/server2/patched_file_system.py

Issue 26418002: Docserver: Pull knowledge of host file systems into a single (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: correct similarity Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/patched_file_system.py
diff --git a/chrome/common/extensions/docs/server2/patched_file_system.py b/chrome/common/extensions/docs/server2/patched_file_system.py
index c287c58f8e7c144d485df38e0997dd0e23c51ebd..39b52298778efae78c066b6138b07e52e8b6030f 100644
--- a/chrome/common/extensions/docs/server2/patched_file_system.py
+++ b/chrome/common/extensions/docs/server2/patched_file_system.py
@@ -38,8 +38,8 @@ class _AsyncFetchFuture(object):
class PatchedFileSystem(FileSystem):
''' Class to fetch resources with a patch applied.
'''
- def __init__(self, host_file_system, patcher):
- self._host_file_system = host_file_system
+ def __init__(self, base_file_system, patcher):
+ self._base_file_system = base_file_system
self._patcher = patcher
def Read(self, paths, binary=False):
@@ -53,13 +53,13 @@ class PatchedFileSystem(FileSystem):
patched_paths = file_paths & patched_files
unpatched_paths = file_paths - patched_files
return Future(delegate=_AsyncFetchFuture(
- self._host_file_system.Read(unpatched_paths, binary),
- self._patcher.Apply(patched_paths, self._host_file_system, binary),
+ self._base_file_system.Read(unpatched_paths, binary),
+ self._patcher.Apply(patched_paths, self._base_file_system, binary),
self._TryReadDirectory(dir_paths, binary),
self))
''' Given the list of patched files, it's not possible to determine whether
- a directory to read exists in self._host_file_system. So try reading each one
+ a directory to read exists in self._base_file_system. So try reading each one
and handle FileNotFoundError.
'''
def _TryReadDirectory(self, paths, binary):
@@ -67,7 +67,7 @@ class PatchedFileSystem(FileSystem):
for path in paths:
assert path.endswith('/')
try:
- value[path] = self._host_file_system.ReadSingle(path, binary)
+ value[path] = self._base_file_system.ReadSingle(path, binary)
except FileNotFoundError:
value[path] = None
return value
@@ -126,10 +126,10 @@ class PatchedFileSystem(FileSystem):
if len(added) > 0:
# There are new files added. It's possible (if |directory| is new) that
- # self._host_file_system.Stat will throw an exception.
+ # self._base_file_system.Stat will throw an exception.
try:
stat_info = self._PatchStat(
- self._host_file_system.Stat(directory + '/'),
+ self._base_file_system.Stat(directory + '/'),
version,
added,
deleted,
@@ -140,14 +140,14 @@ class PatchedFileSystem(FileSystem):
dict((child, version) for child in added + modified))
elif len(deleted) + len(modified) > 0:
# No files were added.
- stat_info = self._PatchStat(self._host_file_system.Stat(directory + '/'),
+ stat_info = self._PatchStat(self._base_file_system.Stat(directory + '/'),
version,
added,
deleted,
modified)
else:
# No changes are made in this directory.
- return self._host_file_system.Stat(path)
+ return self._base_file_system.Stat(path)
if stat_info.child_versions is not None:
if filename:
@@ -159,5 +159,5 @@ class PatchedFileSystem(FileSystem):
def GetIdentity(self):
return '%s(%s,%s)' % (self.__class__.__name__,
- self._host_file_system.GetIdentity(),
+ self._base_file_system.GetIdentity(),
self._patcher.GetIdentity())
« no previous file with comments | « chrome/common/extensions/docs/server2/patch_servlet_test.py ('k') | chrome/common/extensions/docs/server2/render_servlet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698