| OLD | NEW |
| 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 import "dart:collection" show HashMap; | 5 import "dart:collection" show HashMap; |
| 6 import "dart:_internal"; | 6 import "dart:_internal"; |
| 7 | 7 |
| 8 patch class ReceivePort { | 8 patch class ReceivePort { |
| 9 /* patch */ factory ReceivePort() = _ReceivePortImpl; | 9 /* patch */ factory ReceivePort() = _ReceivePortImpl; |
| 10 | 10 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 completer.complete(new Isolate(controlPort, | 294 completer.complete(new Isolate(controlPort, |
| 295 pauseCapability: capabilities[0], | 295 pauseCapability: capabilities[0], |
| 296 terminateCapability: capabilities[1])); | 296 terminateCapability: capabilities[1])); |
| 297 }; | 297 }; |
| 298 return completer.future; | 298 return completer.future; |
| 299 } catch (e, st) { | 299 } catch (e, st) { |
| 300 if (readyPort != null) { | 300 if (readyPort != null) { |
| 301 readyPort.close(); | 301 readyPort.close(); |
| 302 } | 302 } |
| 303 return new Future<Isolate>.error(e, st); | 303 return new Future<Isolate>.error(e, st); |
| 304 }; | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 /* patch */ static Future<Isolate> spawnUri( | 307 /* patch */ static Future<Isolate> spawnUri( |
| 308 Uri uri, List<String> args, var message, | 308 Uri uri, List<String> args, var message, |
| 309 {bool paused: false, bool checked, Uri packageRoot, bool errorsAreFatal, | 309 {bool paused: false, bool checked, Uri packageRoot, bool errorsAreFatal, |
| 310 SendPort onExit, SendPort onError}) { | 310 SendPort onExit, SendPort onError}) { |
| 311 RawReceivePort readyPort; | 311 RawReceivePort readyPort; |
| 312 try { | 312 try { |
| 313 // The VM will invoke [_startIsolate] and not `main`. | 313 // The VM will invoke [_startIsolate] and not `main`. |
| 314 readyPort = new RawReceivePort(); | 314 readyPort = new RawReceivePort(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 327 completer.complete(new Isolate(controlPort, | 327 completer.complete(new Isolate(controlPort, |
| 328 pauseCapability: capabilities[0], | 328 pauseCapability: capabilities[0], |
| 329 terminateCapability: capabilities[1])); | 329 terminateCapability: capabilities[1])); |
| 330 }; | 330 }; |
| 331 return completer.future; | 331 return completer.future; |
| 332 } catch (e, st) { | 332 } catch (e, st) { |
| 333 if (readyPort != null) { | 333 if (readyPort != null) { |
| 334 readyPort.close(); | 334 readyPort.close(); |
| 335 } | 335 } |
| 336 return new Future<Isolate>.error(e, st); | 336 return new Future<Isolate>.error(e, st); |
| 337 }; | 337 } |
| 338 return completer.future; | 338 return completer.future; |
| 339 } | 339 } |
| 340 | 340 |
| 341 // TODO(iposva): Cleanup to have only one definition. | 341 // TODO(iposva): Cleanup to have only one definition. |
| 342 // These values need to be kept in sync with the class IsolateMessageHandler | 342 // These values need to be kept in sync with the class IsolateMessageHandler |
| 343 // in vm/isolate.cc. | 343 // in vm/isolate.cc. |
| 344 static const _PAUSE = 1; | 344 static const _PAUSE = 1; |
| 345 static const _RESUME = 2; | 345 static const _RESUME = 2; |
| 346 static const _PING = 3; | 346 static const _PING = 3; |
| 347 static const _KILL = 4; | 347 static const _KILL = 4; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 static Isolate _getCurrentIsolate() { | 449 static Isolate _getCurrentIsolate() { |
| 450 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); | 450 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); |
| 451 return new Isolate(portAndCapabilities[0], | 451 return new Isolate(portAndCapabilities[0], |
| 452 pauseCapability: portAndCapabilities[1], | 452 pauseCapability: portAndCapabilities[1], |
| 453 terminateCapability: portAndCapabilities[2]); | 453 terminateCapability: portAndCapabilities[2]); |
| 454 } | 454 } |
| 455 | 455 |
| 456 static List _getPortAndCapabilitiesOfCurrentIsolate() | 456 static List _getPortAndCapabilitiesOfCurrentIsolate() |
| 457 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; | 457 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; |
| 458 } | 458 } |
| OLD | NEW |