| 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 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 _totalCallbacks++; | 496 _totalCallbacks++; |
| 497 var trace = new Trace.current(); | 497 var trace = new Trace.current(); |
| 498 var pendingCallback = new PendingCallback._(() { | 498 var pendingCallback = new PendingCallback._(() { |
| 499 var fullDescription = description; | 499 var fullDescription = description; |
| 500 if (fullDescription == null) { | 500 if (fullDescription == null) { |
| 501 fullDescription = "Out-of-band operation #${_totalCallbacks}"; | 501 fullDescription = "Out-of-band operation #${_totalCallbacks}"; |
| 502 } | 502 } |
| 503 | 503 |
| 504 var stackString = prefixLines(terseTraceString(trace)); | 504 var stackString = prefixLines(terseTraceString(trace)); |
| 505 fullDescription += "\n\nStack trace:\n$stackString"; | 505 fullDescription += "\n\nStack trace:\n$stackString"; |
| 506 return fullDescription; |
| 506 }); | 507 }); |
| 507 _pendingCallbacks.add(pendingCallback); | 508 _pendingCallbacks.add(pendingCallback); |
| 508 | 509 |
| 509 return (arg) { | 510 return (arg) { |
| 510 try { | 511 try { |
| 511 return fn(arg); | 512 return fn(arg); |
| 512 } catch (e, stackTrace) { | 513 } catch (e, stackTrace) { |
| 513 var error = new ScheduleError.from( | 514 var error = new ScheduleError.from( |
| 514 _schedule, e, stackTrace: stackTrace); | 515 _schedule, e, stackTrace: stackTrace); |
| 515 if (_timedOut()) { | 516 if (_timedOut()) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 /// The string description of the callback. | 607 /// The string description of the callback. |
| 607 String get description { | 608 String get description { |
| 608 if (_description == null) _description = _thunk(); | 609 if (_description == null) _description = _thunk(); |
| 609 return _description; | 610 return _description; |
| 610 } | 611 } |
| 611 | 612 |
| 612 String toString() => description; | 613 String toString() => description; |
| 613 | 614 |
| 614 PendingCallback._(this._thunk); | 615 PendingCallback._(this._thunk); |
| 615 } | 616 } |
| OLD | NEW |