| Index: chrome/common/extensions/docs/server2/host_file_system_iterator.py
|
| diff --git a/chrome/common/extensions/docs/server2/host_file_system_iterator.py b/chrome/common/extensions/docs/server2/host_file_system_iterator.py
|
| index 20c0741c774ffa55f3227194a3eaa4f8fb28cf26..ba4d319d0c7ebf641d8b2aed24cda2cb5e98e258 100644
|
| --- a/chrome/common/extensions/docs/server2/host_file_system_iterator.py
|
| +++ b/chrome/common/extensions/docs/server2/host_file_system_iterator.py
|
| @@ -2,37 +2,16 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| -from third_party.json_schema_compiler.memoize import memoize
|
| -
|
|
|
| class HostFileSystemIterator(object):
|
| '''Provides methods for iterating through host file systems, in both
|
| ascending (oldest to newest version) and descending order.
|
| '''
|
|
|
| - def __init__(self, file_system_creator, host_file_system, branch_utility):
|
| - self._file_system_creator = file_system_creator
|
| - self._host_file_system = host_file_system
|
| + def __init__(self, file_system_provider, branch_utility):
|
| + self._file_system_provider = file_system_provider
|
| self._branch_utility = branch_utility
|
|
|
| - @memoize
|
| - def _GetFileSystem(self, branch):
|
| - '''To avoid overwriting the persistent data store entry for the 'trunk'
|
| - host file system, hold on to a reference of this file system and return it
|
| - instead of creating a file system for 'trunk'.
|
| - Also of note: File systems are going to be iterated over multiple times
|
| - at each call of ForEach, but the data isn't going to change between calls.
|
| - Use |branch| to memoize the created file systems.
|
| - '''
|
| - if branch == 'trunk':
|
| - # Don't create a new file system for trunk, since there is a bug with the
|
| - # current architecture and design of HostFileSystemCreator, where
|
| - # creating 'trunk' ignores the pinned revision (in fact, it bypasses
|
| - # every difference including whether the file system is patched).
|
| - # TODO(kalman): Fix HostFileSystemCreator and update this comment.
|
| - return self._host_file_system
|
| - return self._file_system_creator.Create(branch)
|
| -
|
| def _ForEach(self, channel_info, callback, get_next):
|
| '''Iterates through a sequence of file systems defined by |get_next| until
|
| |callback| returns False, or until the end of the sequence of file systems
|
| @@ -41,7 +20,10 @@ class HostFileSystemIterator(object):
|
| '''
|
| last_true = None
|
| while channel_info is not None:
|
| - file_system = self._GetFileSystem(channel_info.branch)
|
| + if channel_info.branch == 'trunk':
|
| + file_system = self._file_system_provider.GetTrunk()
|
| + else:
|
| + file_system = self._file_system_provider.GetBranch(channel_info.branch)
|
| if not callback(file_system, channel_info):
|
| return last_true
|
| last_true = channel_info
|
|
|