Index: chrome/common/extensions/docs/server2/future.py |
diff --git a/chrome/common/extensions/docs/server2/future.py b/chrome/common/extensions/docs/server2/future.py |
index 0e9ef24317d36464cb237387d8cdc1be824d97be..4a903440aed592d9fc81104cc0fd60fdbe0daa49 100644 |
--- a/chrome/common/extensions/docs/server2/future.py |
+++ b/chrome/common/extensions/docs/server2/future.py |
@@ -7,6 +7,13 @@ import sys |
_no_value = object() |
+def Collect(futures): |
+ '''Creates a Future which returns a list of results from each Future in |
+ |futures|. |
+ ''' |
+ return Future(delegate=Gettable(lambda: [f.Get() for f in futures])) |
+ |
+ |
class Gettable(object): |
'''Allows a Future to accept a callable as a delegate. Wraps |f| in a .Get |
interface required by Future. |