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

Side by Side Diff: pkg/scheduled_test/lib/src/schedule.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
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 schedule; 5 library schedule;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:stack_trace/stack_trace.dart'; 10 import 'package:stack_trace/stack_trace.dart';
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 _schedule.heartbeat(); 438 _schedule.heartbeat();
439 return Future.forEach(_contents, (task) { 439 return Future.forEach(_contents, (task) {
440 _schedule._currentTask = task; 440 _schedule._currentTask = task;
441 if (_error != null) throw _error; 441 if (_error != null) throw _error;
442 if (_aborted) return; 442 if (_aborted) return;
443 443
444 _taskFuture = new SubstituteFuture(task.fn()); 444 _taskFuture = new SubstituteFuture(task.fn());
445 return _taskFuture.whenComplete(() { 445 return _taskFuture.whenComplete(() {
446 _taskFuture = null; 446 _taskFuture = null;
447 _schedule.heartbeat(); 447 _schedule.heartbeat();
448 }).catchError((e) { 448 }).catchError((e, trace) {
449 var error = new ScheduleError.from(_schedule, e); 449 var error = new ScheduleError.from(_schedule, e, stackTrace: trace);
450 _signalError(error); 450 _signalError(error);
451 throw _error; 451 throw _error;
452 }); 452 });
453 }).whenComplete(() { 453 }).whenComplete(() {
454 _schedule._currentTask = null; 454 _schedule._currentTask = null;
455 }).then((_) { 455 }).then((_) {
456 _onTasksCompleteCompleter.complete(); 456 _onTasksCompleteCompleter.complete();
457 }).catchError((e) { 457 }).catchError((e, stackTrace) {
458 _onTasksCompleteCompleter.completeError(e); 458 _onTasksCompleteCompleter.completeError(e, stackTrace);
459 throw e; 459 throw e;
460 }).whenComplete(() { 460 }).whenComplete(() {
461 if (pendingCallbacks.isEmpty) return; 461 if (pendingCallbacks.isEmpty) return;
462 return _noPendingCallbacks.catchError((e) { 462 return _noPendingCallbacks.catchError((e, stackTrace) {
463 // Signal the error rather than passing it through directly so that if a 463 // Signal the error rather than passing it through directly so that if a
464 // timeout happens after an in-task error, both are reported. 464 // timeout happens after an in-task error, both are reported.
465 _signalError(new ScheduleError.from(_schedule, e)); 465 _signalError(new ScheduleError.from(_schedule, e,
466 stackTrace: stackTrace));
466 }); 467 });
467 }).whenComplete(() { 468 }).whenComplete(() {
468 _schedule.heartbeat(); 469 _schedule.heartbeat();
469 // If the tasks were otherwise successful, make sure we throw any 470 // If the tasks were otherwise successful, make sure we throw any
470 // out-of-band errors. If a task failed, make sure we throw the most 471 // out-of-band errors. If a task failed, make sure we throw the most
471 // recent error. 472 // recent error.
472 if (_error != null) throw _error; 473 if (_error != null) throw _error;
473 }); 474 });
474 } 475 }
475 476
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 /// The string description of the callback. 606 /// The string description of the callback.
606 String get description { 607 String get description {
607 if (_description == null) _description = _thunk(); 608 if (_description == null) _description = _thunk();
608 return _description; 609 return _description;
609 } 610 }
610 611
611 String toString() => description; 612 String toString() => description;
612 613
613 PendingCallback._(this._thunk); 614 PendingCallback._(this._thunk);
614 } 615 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/lib/scheduled_server.dart ('k') | pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698