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

Side by Side Diff: pkg/scheduled_test/lib/scheduled_server.dart

Issue 25094002: Adapt streams for additional stackTrace argument. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove types in closures. Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/scheduled_test/lib/scheduled_process.dart ('k') | pkg/scheduled_test/lib/src/schedule.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library scheduled_test.scheduled_server; 5 library scheduled_test.scheduled_server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 30 matching lines...) Expand all
41 /// 127.0.0.1. [description] is used to refer to the server in debugging 41 /// 127.0.0.1. [description] is used to refer to the server in debugging
42 /// messages. 42 /// messages.
43 factory ScheduledServer([String description]) { 43 factory ScheduledServer([String description]) {
44 var id = _count++; 44 var id = _count++;
45 if (description == null) description = 'scheduled server $id'; 45 if (description == null) description = 'scheduled server $id';
46 46
47 var scheduledServer; 47 var scheduledServer;
48 scheduledServer = new ScheduledServer._(schedule(() { 48 scheduledServer = new ScheduledServer._(schedule(() {
49 return SafeHttpServer.bind("127.0.0.1", 0).then((server) { 49 return SafeHttpServer.bind("127.0.0.1", 0).then((server) {
50 server.listen(scheduledServer._handleRequest, 50 server.listen(scheduledServer._handleRequest,
51 onError: (e) => currentSchedule.signalError(e)); 51 onError: currentSchedule.signalError);
52 currentSchedule.onComplete.schedule(server.close); 52 currentSchedule.onComplete.schedule(server.close);
53 return server; 53 return server;
54 }); 54 });
55 }, "starting '$description'"), description); 55 }, "starting '$description'"), description);
56 return scheduledServer; 56 return scheduledServer;
57 } 57 }
58 58
59 /// The port on which the server is listening. 59 /// The port on which the server is listening.
60 Future<int> get port => _server.then((s) => s.port); 60 Future<int> get port => _server.then((s) => s.port);
61 61
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 "when no more requests were expected."); 95 "when no more requests were expected.");
96 } 96 }
97 return _handlers.removeFirst().fn(request); 97 return _handlers.removeFirst().fn(request);
98 }).catchError((e) { 98 }).catchError((e) {
99 // Close the server so that we don't leave a dangling request. 99 // Close the server so that we don't leave a dangling request.
100 _server.then((s) => s.close()); 100 _server.then((s) => s.close());
101 throw e; 101 throw e;
102 }), 'receiving ${request.method} ${request.uri}'); 102 }), 'receiving ${request.method} ${request.uri}');
103 } 103 }
104 } 104 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/lib/scheduled_process.dart ('k') | pkg/scheduled_test/lib/src/schedule.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698