Commit 752a5ebc authored by kalman@chromium.org's avatar kalman@chromium.org

Docs: Memoize the FeaturesBundles that are created by AvailabilityFinder to

maintain their caches. r259958 altered the way the feature data was populated
and caused a big regression. This fixes it.

R=rockot@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/216703003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260232 0039d316-1c4b-4281-b951-d872f2087c98
parent 55fb2d5c
application: chrome-apps-doc
version: 3-15-1
version: 3-15-2
runtime: python27
api_version: 1
threadsafe: false
......
......@@ -11,6 +11,7 @@ from extensions_paths import API_PATHS, JSON_TEMPLATES
from features_bundle import FeaturesBundle
import features_utility
from file_system import FileNotFoundError
from third_party.json_schema_compiler.memoize import memoize
from third_party.json_schema_compiler.model import UnixName
......@@ -177,6 +178,7 @@ class AvailabilityFinder(object):
channel_info.channel))
return available_channel is not None and newest == channel_info.channel
@memoize
def _CreateFeaturesBundle(self, file_system):
return FeaturesBundle(file_system,
self._compiled_fs_factory,
......
......@@ -2,4 +2,4 @@ cron:
- description: Repopulates all cached data.
url: /_cron
schedule: every 5 minutes
target: 3-15-1
target: 3-15-2
......@@ -4,7 +4,7 @@
import posixpath
from compiled_file_system import Unicode
from compiled_file_system import SingleFile, Unicode
from extensions_paths import (
API_FEATURES, JSON_TEMPLATES, MANIFEST_FEATURES, PERMISSION_FEATURES)
import features_utility
......@@ -40,8 +40,11 @@ def _AddPlatformsFromDependencies(feature,
class _FeaturesCache(object):
def __init__(self, file_system, compiled_fs_factory, *json_paths):
self._cache = compiled_fs_factory.Create(
file_system, self._CreateCache, type(self))
populate = self._CreateCache
if len(json_paths) == 1:
populate = SingleFile(populate)
self._cache = compiled_fs_factory.Create(file_system, populate, type(self))
self._text_cache = compiled_fs_factory.ForUnicode(file_system)
self._json_path = json_paths[0]
self._extra_paths = json_paths[1:]
......
......@@ -171,6 +171,13 @@ class FileSystem(object):
for walkinfo in walk(root):
yield walkinfo
def __eq__(self, other):
return (isinstance(other, FileSystem) and
self.GetIdentity() == other.GetIdentity())
def __ne__(self, other):
return not (self == other)
def __repr__(self):
return '<%s>' % type(self).__name__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment