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

Unified Diff: pkg/shelf/lib/src/util.dart

Issue 260933004: Support Request hijacking in Shelf, using a similar API to Rack. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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: pkg/shelf/lib/src/util.dart
diff --git a/pkg/shelf/lib/src/util.dart b/pkg/shelf/lib/src/util.dart
index 43f7238910aec1b91e38370fa37b8ef143307855..172fe18173ab416b489967c402f8aba78eee4f86 100644
--- a/pkg/shelf/lib/src/util.dart
+++ b/pkg/shelf/lib/src/util.dart
@@ -8,6 +8,10 @@ import 'dart:async';
import 'package:stack_trace/stack_trace.dart';
+/// Like [new Future], but avoids around issue 11911 by using [new Future.value]
+/// under the covers.
+Future newFuture(callback()) => new Future.value().then((_) => callback());
+
/// Like [Future.sync], but wraps the Future in [Chain.track] as well.
Future syncFuture(callback()) => Chain.track(new Future.sync(callback));

Powered by Google App Engine
This is Rietveld 408576698