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

Side by Side Diff: tests/lib/async/event_helper.dart

Issue 25354003: Redo StreamTransformers so they work with Stack traces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 | « tests/lib/async/catch_errors27_test.dart ('k') | tests/lib/async/first_regression_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 event_helper; 5 library event_helper;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 abstract class Event { 9 abstract class Event {
10 void replay(EventSink sink); 10 void replay(EventSink sink);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 /** Capture events from a stream into a new [Events] object. */ 73 /** Capture events from a stream into a new [Events] object. */
74 factory Events.capture(Stream stream, 74 factory Events.capture(Stream stream,
75 { bool cancelOnError: false }) = CaptureEvents; 75 { bool cancelOnError: false }) = CaptureEvents;
76 76
77 // EventSink interface. 77 // EventSink interface.
78 void add(var value) { 78 void add(var value) {
79 if (trace) print("Events#$hashCode: add($value)"); 79 if (trace) print("Events#$hashCode: add($value)");
80 events.add(new DataEvent(value)); 80 events.add(new DataEvent(value));
81 } 81 }
82 82
83 void addError(error) { 83 void addError(error, [StackTrace stackTrace]) {
84 if (trace) print("Events#$hashCode: addError($error)"); 84 if (trace) print("Events#$hashCode: addError($error)");
85 events.add(new ErrorEvent(error)); 85 events.add(new ErrorEvent(error));
86 } 86 }
87 87
88 void close() { 88 void close() {
89 if (trace) print("Events#$hashCode: close()"); 89 if (trace) print("Events#$hashCode: close()");
90 events.add(const DoneEvent()); 90 events.add(const DoneEvent());
91 } 91 }
92 92
93 // Error helper for creating errors manually.. 93 // Error helper for creating errors manually..
94 void error(var value) { addError(value); } 94 void error(var value, [StackTrace stackTrace]) {
95 addError(value, stackTrace);
96 }
95 97
96 /** Replay the captured events on a sink. */ 98 /** Replay the captured events on a sink. */
97 void replay(EventSink sink) { 99 void replay(EventSink sink) {
98 for (int i = 0; i < events.length; i++) { 100 for (int i = 0; i < events.length; i++) {
99 events[i].replay(sink); 101 events[i].replay(sink);
100 } 102 }
101 } 103 }
102 104
103 /** 105 /**
104 * Create a new [Events] with the same captured events. 106 * Create a new [Events] with the same captured events.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void resume() { 171 void resume() {
170 if (trace) print("Events#$hashCode: resume"); 172 if (trace) print("Events#$hashCode: resume");
171 subscription.resume(); 173 subscription.resume();
172 } 174 }
173 175
174 void onDone(void action()) { 176 void onDone(void action()) {
175 if (trace) print("Events#$hashCode: onDone"); 177 if (trace) print("Events#$hashCode: onDone");
176 onDoneSignal.future.whenComplete(action); 178 onDoneSignal.future.whenComplete(action);
177 } 179 }
178 } 180 }
OLDNEW
« no previous file with comments | « tests/lib/async/catch_errors27_test.dart ('k') | tests/lib/async/first_regression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698