| 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 | 6 |
| 7 patch class ReceivePort { | 7 patch class ReceivePort { |
| 8 /* patch */ factory ReceivePort() = _ReceivePortImpl; | 8 /* patch */ factory ReceivePort() = _ReceivePortImpl; |
| 9 | 9 |
| 10 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) = | 10 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) = |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 }; | 316 }; |
| 317 return completer.future; | 317 return completer.future; |
| 318 } | 318 } |
| 319 | 319 |
| 320 // TODO(iposva): Cleanup to have only one definition. | 320 // TODO(iposva): Cleanup to have only one definition. |
| 321 // These values need to be kept in sync with the class IsolateMessageHandler | 321 // These values need to be kept in sync with the class IsolateMessageHandler |
| 322 // in vm/isolate.cc. | 322 // in vm/isolate.cc. |
| 323 static const _PAUSE = 1; | 323 static const _PAUSE = 1; |
| 324 static const _RESUME = 2; | 324 static const _RESUME = 2; |
| 325 static const _PING = 3; | 325 static const _PING = 3; |
| 326 static const _KILL = 4; |
| 326 | 327 |
| 327 | 328 |
| 328 static SendPort _spawnFunction(SendPort readyPort, Function topLevelFunction, | 329 static SendPort _spawnFunction(SendPort readyPort, Function topLevelFunction, |
| 329 var message) | 330 var message) |
| 330 native "Isolate_spawnFunction"; | 331 native "Isolate_spawnFunction"; |
| 331 | 332 |
| 332 static SendPort _spawnUri(SendPort readyPort, String uri, | 333 static SendPort _spawnUri(SendPort readyPort, String uri, |
| 333 List<String> args, var message, | 334 List<String> args, var message, |
| 334 String packageRoot) | 335 String packageRoot) |
| 335 native "Isolate_spawnUri"; | 336 native "Isolate_spawnUri"; |
| 336 | 337 |
| 337 static void _sendOOB(port, msg) native "Isolate_sendOOB"; | 338 static void _sendOOB(port, msg) native "Isolate_sendOOB"; |
| 338 | 339 |
| 339 /* patch */ void _pause(Capability resumeCapability) { | 340 /* patch */ void _pause(Capability resumeCapability) { |
| 340 var msg = new List(4) | 341 var msg = new List(4) |
| 341 ..[0] = 0 // Make room for OOM message type. | 342 ..[0] = 0 // Make room for OOB message type. |
| 342 ..[1] = _PAUSE | 343 ..[1] = _PAUSE |
| 343 ..[2] = pauseCapability | 344 ..[2] = pauseCapability |
| 344 ..[3] = resumeCapability; | 345 ..[3] = resumeCapability; |
| 345 _sendOOB(controlPort, msg); | 346 _sendOOB(controlPort, msg); |
| 346 } | 347 } |
| 347 | 348 |
| 348 /* patch */ void resume(Capability resumeCapability) { | 349 /* patch */ void resume(Capability resumeCapability) { |
| 349 var msg = new List(4) | 350 var msg = new List(4) |
| 350 ..[0] = 0 // Make room for OOM message type. | 351 ..[0] = 0 // Make room for OOB message type. |
| 351 ..[1] = _RESUME | 352 ..[1] = _RESUME |
| 352 ..[2] = pauseCapability | 353 ..[2] = pauseCapability |
| 353 ..[3] = resumeCapability; | 354 ..[3] = resumeCapability; |
| 354 _sendOOB(controlPort, msg); | 355 _sendOOB(controlPort, msg); |
| 355 } | 356 } |
| 356 | 357 |
| 357 /* patch */ void addOnExitListener(SendPort responsePort) { | 358 /* patch */ void addOnExitListener(SendPort responsePort) { |
| 358 throw new UnsupportedError("addOnExitListener"); | 359 throw new UnsupportedError("addOnExitListener"); |
| 359 } | 360 } |
| 360 | 361 |
| 361 /* patch */ void removeOnExitListener(SendPort responsePort) { | 362 /* patch */ void removeOnExitListener(SendPort responsePort) { |
| 362 throw new UnsupportedError("removeOnExitListener"); | 363 throw new UnsupportedError("removeOnExitListener"); |
| 363 } | 364 } |
| 364 | 365 |
| 365 /* patch */ void setErrorsFatal(bool errorsAreFatal) { | 366 /* patch */ void setErrorsFatal(bool errorsAreFatal) { |
| 366 throw new UnsupportedError("setErrorsFatal"); | 367 throw new UnsupportedError("setErrorsFatal"); |
| 367 } | 368 } |
| 368 | 369 |
| 369 /* patch */ void kill([int priority = BEFORE_NEXT_EVENT]) { | 370 /* patch */ void kill([int priority = BEFORE_NEXT_EVENT]) { |
| 370 throw new UnsupportedError("kill"); | 371 var msg = new List(4) |
| 372 ..[0] = 0 // Make room for OOB message type. |
| 373 ..[1] = _KILL |
| 374 ..[2] = terminateCapability |
| 375 ..[3] = priority; |
| 376 _sendOOB(controlPort, msg); |
| 371 } | 377 } |
| 372 | 378 |
| 373 /* patch */ void ping(SendPort responsePort, [int pingType = IMMEDIATE]) { | 379 /* patch */ void ping(SendPort responsePort, [int pingType = IMMEDIATE]) { |
| 374 var msg = new List(4) | 380 var msg = new List(4) |
| 375 ..[0] = 0 // Make room for OOM message type. | 381 ..[0] = 0 // Make room for OOM message type. |
| 376 ..[1] = _PING | 382 ..[1] = _PING |
| 377 ..[2] = responsePort | 383 ..[2] = responsePort |
| 378 ..[3] = pingType; | 384 ..[3] = pingType; |
| 379 _sendOOB(controlPort, msg); | 385 _sendOOB(controlPort, msg); |
| 380 } | 386 } |
| 381 | 387 |
| 382 /* patch */ void addErrorListener(SendPort port) { | 388 /* patch */ void addErrorListener(SendPort port) { |
| 383 throw new UnsupportedError("addErrorListener"); | 389 throw new UnsupportedError("addErrorListener"); |
| 384 } | 390 } |
| 385 | 391 |
| 386 /* patch */ void removeErrorListener(SendPort port) { | 392 /* patch */ void removeErrorListener(SendPort port) { |
| 387 throw new UnsupportedError("removeErrorListener"); | 393 throw new UnsupportedError("removeErrorListener"); |
| 388 } | 394 } |
| 389 } | 395 } |
| OLD | NEW |