OLD | NEW |
1 dart_library.library('dart/isolate', null, /* Imports */[ | 1 dart_library.library('dart/isolate', null, /* Imports */[ |
2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
3 'dart/core', | 3 'dart/core', |
4 'dart/async' | 4 'dart/async' |
5 ], /* Lazy imports */[ | 5 ], /* Lazy imports */[ |
6 'dart/_isolate_helper' | 6 'dart/_isolate_helper' |
7 ], function(exports, dart, core, async, _isolate_helper) { | 7 ], function(exports, dart, core, async, _isolate_helper) { |
8 'use strict'; | 8 'use strict'; |
9 let dartx = dart.dartx; | 9 let dartx = dart.dartx; |
10 class Capability extends core.Object { | 10 class Capability extends core.Object { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 removeErrorListener(port) { | 134 removeErrorListener(port) { |
135 let message = core.List.new(2); | 135 let message = core.List.new(2); |
136 message[dartx.set](0, "stopErrors"); | 136 message[dartx.set](0, "stopErrors"); |
137 message[dartx.set](1, port); | 137 message[dartx.set](1, port); |
138 this.controlPort.send(message); | 138 this.controlPort.send(message); |
139 } | 139 } |
140 get errors() { | 140 get errors() { |
141 let controller = null; | 141 let controller = null; |
142 let port = null; | 142 let port = null; |
143 let handleError = message => { | 143 function handleError(message) { |
144 let errorDescription = dart.as(dart.dindex(message, 0), core.String); | 144 let errorDescription = dart.as(dart.dindex(message, 0), core.String); |
145 let stackDescription = dart.as(dart.dindex(message, 1), core.String); | 145 let stackDescription = dart.as(dart.dindex(message, 1), core.String); |
146 let error = new RemoteError(errorDescription, stackDescription); | 146 let error = new RemoteError(errorDescription, stackDescription); |
147 controller.addError(error, error.stackTrace); | 147 controller.addError(error, error.stackTrace); |
148 }; | 148 } |
149 dart.fn(handleError, dart.void, [dart.dynamic]); | 149 dart.fn(handleError, dart.void, [dart.dynamic]); |
150 controller = async.StreamController.broadcast({sync: true, onListen: dart.
fn(() => { | 150 controller = async.StreamController.broadcast({sync: true, onListen: dart.
fn(() => { |
151 port = RawReceivePort.new(handleError); | 151 port = RawReceivePort.new(handleError); |
152 this.addErrorListener(port.sendPort); | 152 this.addErrorListener(port.sendPort); |
153 }), onCancel: dart.fn(() => { | 153 }), onCancel: dart.fn(() => { |
154 this.removeErrorListener(port.sendPort); | 154 this.removeErrorListener(port.sendPort); |
155 port.close(); | 155 port.close(); |
156 port = null; | 156 port = null; |
157 })}); | 157 })}); |
158 return controller.stream; | 158 return controller.stream; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 }); | 256 }); |
257 // Exports: | 257 // Exports: |
258 exports.Capability = Capability; | 258 exports.Capability = Capability; |
259 exports.IsolateSpawnException = IsolateSpawnException; | 259 exports.IsolateSpawnException = IsolateSpawnException; |
260 exports.Isolate = Isolate; | 260 exports.Isolate = Isolate; |
261 exports.SendPort = SendPort; | 261 exports.SendPort = SendPort; |
262 exports.ReceivePort = ReceivePort; | 262 exports.ReceivePort = ReceivePort; |
263 exports.RawReceivePort = RawReceivePort; | 263 exports.RawReceivePort = RawReceivePort; |
264 exports.RemoteError = RemoteError; | 264 exports.RemoteError = RemoteError; |
265 }); | 265 }); |
OLD | NEW |