| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 /* patch */ void resume(Capability resumeCapability) { | 365 /* patch */ void resume(Capability resumeCapability) { |
| 366 var msg = new List(4) | 366 var msg = new List(4) |
| 367 ..[0] = 0 // Make room for OOB message type. | 367 ..[0] = 0 // Make room for OOB message type. |
| 368 ..[1] = _RESUME | 368 ..[1] = _RESUME |
| 369 ..[2] = pauseCapability | 369 ..[2] = pauseCapability |
| 370 ..[3] = resumeCapability; | 370 ..[3] = resumeCapability; |
| 371 _sendOOB(controlPort, msg); | 371 _sendOOB(controlPort, msg); |
| 372 } | 372 } |
| 373 | 373 |
| 374 /* patch */ void addOnExitListener(SendPort responsePort) { | 374 /* patch */ void addOnExitListener(SendPort responsePort, |
| 375 var msg = new List(3) | 375 {Object response}) { |
| 376 var msg = new List(4) |
| 376 ..[0] = 0 // Make room for OOB message type. | 377 ..[0] = 0 // Make room for OOB message type. |
| 377 ..[1] = _ADD_EXIT | 378 ..[1] = _ADD_EXIT |
| 378 ..[2] = responsePort; | 379 ..[2] = responsePort |
| 380 ..[3] = response; |
| 379 _sendOOB(controlPort, msg); | 381 _sendOOB(controlPort, msg); |
| 380 } | 382 } |
| 381 | 383 |
| 382 /* patch */ void removeOnExitListener(SendPort responsePort) { | 384 /* patch */ void removeOnExitListener(SendPort responsePort) { |
| 383 var msg = new List(3) | 385 var msg = new List(3) |
| 384 ..[0] = 0 // Make room for OOB message type. | 386 ..[0] = 0 // Make room for OOB message type. |
| 385 ..[1] = _DEL_EXIT | 387 ..[1] = _DEL_EXIT |
| 386 ..[2] = responsePort; | 388 ..[2] = responsePort; |
| 387 _sendOOB(controlPort, msg); | 389 _sendOOB(controlPort, msg); |
| 388 } | 390 } |
| 389 | 391 |
| 390 /* patch */ void setErrorsFatal(bool errorsAreFatal) { | 392 /* patch */ void setErrorsFatal(bool errorsAreFatal) { |
| 391 var msg = new List(4) | 393 var msg = new List(4) |
| 392 ..[0] = 0 // Make room for OOB message type. | 394 ..[0] = 0 // Make room for OOB message type. |
| 393 ..[1] = _ERROR_FATAL | 395 ..[1] = _ERROR_FATAL |
| 394 ..[2] = terminateCapability | 396 ..[2] = terminateCapability |
| 395 ..[3] = errorsAreFatal; | 397 ..[3] = errorsAreFatal; |
| 396 _sendOOB(controlPort, msg); | 398 _sendOOB(controlPort, msg); |
| 397 } | 399 } |
| 398 | 400 |
| 399 /* patch */ void kill([int priority = BEFORE_NEXT_EVENT]) { | 401 /* patch */ void kill({int priority: BEFORE_NEXT_EVENT}) { |
| 400 var msg = new List(4) | 402 var msg = new List(4) |
| 401 ..[0] = 0 // Make room for OOB message type. | 403 ..[0] = 0 // Make room for OOB message type. |
| 402 ..[1] = _KILL | 404 ..[1] = _KILL |
| 403 ..[2] = terminateCapability | 405 ..[2] = terminateCapability |
| 404 ..[3] = priority; | 406 ..[3] = priority; |
| 405 _sendOOB(controlPort, msg); | 407 _sendOOB(controlPort, msg); |
| 406 } | 408 } |
| 407 | 409 |
| 408 /* patch */ void ping(SendPort responsePort, [int pingType = IMMEDIATE]) { | 410 /* patch */ void ping(SendPort responsePort, {Object response, |
| 409 var msg = new List(4) | 411 int priority: IMMEDIATE}) { |
| 412 var msg = new List(5) |
| 410 ..[0] = 0 // Make room for OOM message type. | 413 ..[0] = 0 // Make room for OOM message type. |
| 411 ..[1] = _PING | 414 ..[1] = _PING |
| 412 ..[2] = responsePort | 415 ..[2] = responsePort |
| 413 ..[3] = pingType; | 416 ..[3] = priority |
| 417 ..[4] = response; |
| 414 _sendOOB(controlPort, msg); | 418 _sendOOB(controlPort, msg); |
| 415 } | 419 } |
| 416 | 420 |
| 417 /* patch */ void addErrorListener(SendPort port) { | 421 /* patch */ void addErrorListener(SendPort port) { |
| 418 var msg = new List(3) | 422 var msg = new List(3) |
| 419 ..[0] = 0 // Make room for OOB message type. | 423 ..[0] = 0 // Make room for OOB message type. |
| 420 ..[1] = _ADD_ERROR | 424 ..[1] = _ADD_ERROR |
| 421 ..[2] = port; | 425 ..[2] = port; |
| 422 _sendOOB(controlPort, msg); | 426 _sendOOB(controlPort, msg); |
| 423 } | 427 } |
| 424 | 428 |
| 425 /* patch */ void removeErrorListener(SendPort port) { | 429 /* patch */ void removeErrorListener(SendPort port) { |
| 426 var msg = new List(3) | 430 var msg = new List(3) |
| 427 ..[0] = 0 // Make room for OOB message type. | 431 ..[0] = 0 // Make room for OOB message type. |
| 428 ..[1] = _DEL_ERROR | 432 ..[1] = _DEL_ERROR |
| 429 ..[2] = port; | 433 ..[2] = port; |
| 430 _sendOOB(controlPort, msg); | 434 _sendOOB(controlPort, msg); |
| 431 } | 435 } |
| 432 | 436 |
| 433 static Isolate _getCurrentIsolate() { | 437 static Isolate _getCurrentIsolate() { |
| 434 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); | 438 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); |
| 435 return new Isolate(portAndCapabilities[0], | 439 return new Isolate(portAndCapabilities[0], |
| 436 pauseCapability: portAndCapabilities[1], | 440 pauseCapability: portAndCapabilities[1], |
| 437 terminateCapability: portAndCapabilities[2]); | 441 terminateCapability: portAndCapabilities[2]); |
| 438 } | 442 } |
| 439 | 443 |
| 440 static List _getPortAndCapabilitiesOfCurrentIsolate() | 444 static List _getPortAndCapabilitiesOfCurrentIsolate() |
| 441 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; | 445 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; |
| 442 } | 446 } |
| OLD | NEW |