OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
8 | 8 |
9 import 'package:async/async.dart' hide StreamQueue; | 9 import 'package:async/async.dart' hide StreamQueue; |
10 import 'package:crypto/crypto.dart'; | 10 import 'package:crypto/crypto.dart'; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 new RegExp(r"/test_[A-Za-z0-9]{6}/runInIsolate\.dart$"); | 170 new RegExp(r"/test_[A-Za-z0-9]{6}/runInIsolate\.dart$"); |
171 | 171 |
172 /// Returns [stackTrace] converted to a [Chain] with all irrelevant frames | 172 /// Returns [stackTrace] converted to a [Chain] with all irrelevant frames |
173 /// folded together. | 173 /// folded together. |
174 /// | 174 /// |
175 /// If [verbose] is `true`, returns the chain for [stackTrace] unmodified. | 175 /// If [verbose] is `true`, returns the chain for [stackTrace] unmodified. |
176 Chain terseChain(StackTrace stackTrace, {bool verbose: false}) { | 176 Chain terseChain(StackTrace stackTrace, {bool verbose: false}) { |
177 if (verbose) return new Chain.forTrace(stackTrace); | 177 if (verbose) return new Chain.forTrace(stackTrace); |
178 return new Chain.forTrace(stackTrace).foldFrames((frame) { | 178 return new Chain.forTrace(stackTrace).foldFrames((frame) { |
179 if (frame.package == 'test') return true; | 179 if (frame.package == 'test') return true; |
| 180 if (frame.package == 'stream_channel') return true; |
180 | 181 |
181 // Filter out frames from our isolate bootstrap as well. | 182 // Filter out frames from our isolate bootstrap as well. |
182 if (frame.uri.scheme != 'file') return false; | 183 if (frame.uri.scheme != 'file') return false; |
183 return frame.uri.path.contains(_isolatePath); | 184 return frame.uri.path.contains(_isolatePath); |
184 }, terse: true); | 185 }, terse: true); |
185 } | 186 } |
186 | 187 |
187 /// Flattens nested [Iterable]s inside an [Iterable] into a single [List] | 188 /// Flattens nested [Iterable]s inside an [Iterable] into a single [List] |
188 /// containing only non-[Iterable] elements. | 189 /// containing only non-[Iterable] elements. |
189 List flatten(Iterable nested) { | 190 List flatten(Iterable nested) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 urlSafe: urlSafe, addLineSeparator: addLineSeparator); | 417 urlSafe: urlSafe, addLineSeparator: addLineSeparator); |
417 } | 418 } |
418 | 419 |
419 /// Returns middleware that nests all requests beneath the URL prefix [beneath]. | 420 /// Returns middleware that nests all requests beneath the URL prefix [beneath]. |
420 shelf.Middleware nestingMiddleware(String beneath) { | 421 shelf.Middleware nestingMiddleware(String beneath) { |
421 return (handler) { | 422 return (handler) { |
422 var pathHandler = new PathHandler()..add(beneath, handler); | 423 var pathHandler = new PathHandler()..add(beneath, handler); |
423 return pathHandler.handler; | 424 return pathHandler.handler; |
424 }; | 425 }; |
425 } | 426 } |
OLD | NEW |