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

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

Issue 417163004: Docserver: Update Future.Then() to be more Promise-like (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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/mock_file_system.py
diff --git a/chrome/common/extensions/docs/server2/mock_file_system.py b/chrome/common/extensions/docs/server2/mock_file_system.py
index e15f58c8f1c8c54df2420d78e0f563f69d730633..52a84bde7b4b54e6c88a03c39d0593dcd1d4ab56 100644
--- a/chrome/common/extensions/docs/server2/mock_file_system.py
+++ b/chrome/common/extensions/docs/server2/mock_file_system.py
@@ -42,16 +42,15 @@ class MockFileSystem(FileSystem):
from |_updates|, if any.
'''
self._read_count += 1
- future_result = self._file_system.Read(paths, skip_not_found=skip_not_found)
- def resolve():
+ def next(result):
self._read_resolve_count += 1
- result = future_result.Get()
for path in result.iterkeys():
update = self._GetMostRecentUpdate(path)
if update is not None:
result[path] = update
return result
- return Future(callback=resolve)
+ return self._file_system.Read(paths,
+ skip_not_found=skip_not_found).Then(next)
def Refresh(self):
return self._file_system.Refresh()

Powered by Google App Engine
This is Rietveld 408576698