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 library scheduled_server.handler; | 5 library scheduled_server.handler; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | |
9 | 8 |
10 import '../../scheduled_server.dart'; | 9 import '../../scheduled_server.dart'; |
11 import '../../scheduled_test.dart'; | 10 import '../../scheduled_test.dart'; |
12 import '../utils.dart'; | 11 import '../utils.dart'; |
13 | 12 |
14 /// A handler for a single request to a [ScheduledServer]. | 13 /// A handler for a single request to a [ScheduledServer]. |
15 class Handler { | 14 class Handler { |
16 /// The server for which this handler will handle a request. | 15 /// The server for which this handler will handle a request. |
17 final ScheduledServer server; | 16 final ScheduledServer server; |
18 | 17 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 Future _waitForTask() { | 72 Future _waitForTask() { |
74 return pumpEventQueue().then((_) { | 73 return pumpEventQueue().then((_) { |
75 if (currentSchedule.currentTask != _taskBefore) return; | 74 if (currentSchedule.currentTask != _taskBefore) return; |
76 // If we're one task before the handler was scheduled, wait for that | 75 // If we're one task before the handler was scheduled, wait for that |
77 // task to complete and pump the event queue so that [ready] will be | 76 // task to complete and pump the event queue so that [ready] will be |
78 // set. | 77 // set. |
79 return _taskBefore.result.then((_) => pumpEventQueue()); | 78 return _taskBefore.result.then((_) => pumpEventQueue()); |
80 }); | 79 }); |
81 } | 80 } |
82 } | 81 } |
OLD | NEW |