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

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

Issue 532903002: Docserver: Convert more future Get calls to Thens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 6 years, 3 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
« no previous file with comments | « chrome/common/extensions/docs/server2/new_github_file_system.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server2/path_canonicalizer.py
diff --git a/chrome/common/extensions/docs/server2/path_canonicalizer.py b/chrome/common/extensions/docs/server2/path_canonicalizer.py
index 04ad9bef200d9c9a142f6618dd0ae89fa60c2a5f..f20a72849a18ca4246ab341a1d53fc5a0afc11f0 100644
--- a/chrome/common/extensions/docs/server2/path_canonicalizer.py
+++ b/chrome/common/extensions/docs/server2/path_canonicalizer.py
@@ -38,16 +38,12 @@ class PathCanonicalizer(object):
self._strip_extensions = strip_extensions
def _LoadCache(self):
- cached_future = self._cache.GetMulti(('canonical_paths',
- 'simplified_paths_map'))
-
- def resolve():
+ def load(cached):
# |canonical_paths| is the pre-calculated set of canonical paths.
# |simplified_paths_map| is a lazily populated mapping of simplified file
# names to a list of full paths that contain them. For example,
# - browseraction: [extensions/browserAction.html]
# - storage: [apps/storage.html, extensions/storage.html]
- cached = cached_future.Get()
canonical_paths, simplified_paths_map = (
cached.get('canonical_paths'), cached.get('simplified_paths_map'))
@@ -77,8 +73,9 @@ class PathCanonicalizer(object):
assert simplified_paths_map is not None
return canonical_paths, simplified_paths_map
+ return self._cache.GetMulti(('canonical_paths',
+ 'simplified_paths_map')).Then(load)
- return Future(callback=resolve)
def Canonicalize(self, path):
'''Returns the canonical path for |path|.
« no previous file with comments | « chrome/common/extensions/docs/server2/new_github_file_system.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698