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

Side by Side Diff: sdk/lib/isolate/base.dart

Issue 11558034: Second version of support for specifying an unhandled exception callback (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | « sdk/lib/_internal/compiler/implementation/lib/isolate_patch.dart ('k') | no next file » | 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 class IsolateSpawnException implements Exception { 5 class IsolateSpawnException implements Exception {
6 const IsolateSpawnException(String this._s); 6 const IsolateSpawnException(String this._s);
7 String toString() => "IsolateSpawnException: '$_s'"; 7 String toString() => "IsolateSpawnException: '$_s'";
8 final String _s; 8 final String _s;
9 } 9 }
10 10
(...skipping 14 matching lines...) Expand all
25 * When any isolate starts (even the main script of the application), a default 25 * When any isolate starts (even the main script of the application), a default
26 * [ReceivePort] is created for it. This port is available from the top-level 26 * [ReceivePort] is created for it. This port is available from the top-level
27 * getter [port] defined in this library. 27 * getter [port] defined in this library.
28 * 28 *
29 * [spawnFunction] returns a [SendPort] derived from the child isolate's default 29 * [spawnFunction] returns a [SendPort] derived from the child isolate's default
30 * port. 30 * port.
31 * 31 *
32 * See comments at the top of this library for more details. 32 * See comments at the top of this library for more details.
33 */ 33 */
34 // Note this feature is not yet available in the dartvm. 34 // Note this feature is not yet available in the dartvm.
35 external SendPort spawnFunction(void topLevelFunction()); 35 external SendPort spawnFunction(void topLevelFunction(),
36 36 [bool UnhandledExceptionCallback(IsolateUnhandledException e)]);
37 /** 37 /**
38 * Creates and spawns an isolate whose code is available at [uri]. Like with 38 * Creates and spawns an isolate whose code is available at [uri]. Like with
39 * [spawnFunction], the child isolate will have a default [ReceivePort], and a 39 * [spawnFunction], the child isolate will have a default [ReceivePort], and a
40 * this function returns a [SendPort] derived from it. 40 * this function returns a [SendPort] derived from it.
41 * 41 *
42 * See comments at the top of this library for more details. 42 * See comments at the top of this library for more details.
43 */ 43 */
44 external SendPort spawnUri(String uri); 44 external SendPort spawnUri(String uri);
45 45
46 /** 46 /**
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 SendPort toSendPort(); 135 SendPort toSendPort();
136 136
137 } 137 }
138 138
139 // TODO(kasperl): Document this. 139 // TODO(kasperl): Document this.
140 abstract class SendPortSync { 140 abstract class SendPortSync {
141 141
142 callSync(var message); 142 callSync(var message);
143 143
144 } 144 }
145
146 /**
147 * Wraps unhandled exceptions thrown during isolate execution. It is
148 * used to show both the error message and the stack trace for unhandled
149 * exceptions.
150 */
151 class IsolateUnhandledException implements Exception {
152 /** Message being handled when exception occurred. */
153 final message;
154
155 /** Wrapped exception. */
156 final source;
157
158 /** Trace for the wrapped exception. */
159 final Object stackTrace;
160
161 const IsolateUnhandledException(this.message, this.source, this.stackTrace);
162
163 String toString() {
164 return 'IsolateUnhandledException: exception while handling message: '
165 '${message} \n '
166 '${source.toString().replaceAll("\n", "\n ")}\n'
167 'original stack trace:\n '
168 '${stackTrace.toString().replaceAll("\n","\n ")}';
169 }
170 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/isolate_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698