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 library dart._isolate_helper; | 5 library dart._isolate_helper; |
6 | 6 |
7 import 'dart:_js_embedded_names' show | 7 import 'dart:_js_embedded_names' show |
8 CLASS_ID_EXTRACTOR, | 8 CLASS_ID_EXTRACTOR, |
9 CLASS_FIELDS_EXTRACTOR, | 9 CLASS_FIELDS_EXTRACTOR, |
10 CURRENT_SCRIPT, | 10 CURRENT_SCRIPT, |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 } | 375 } |
376 | 376 |
377 void handlePing(SendPort responsePort, int pingType) { | 377 void handlePing(SendPort responsePort, int pingType) { |
378 if (pingType == Isolate.IMMEDIATE || | 378 if (pingType == Isolate.IMMEDIATE || |
379 (pingType == Isolate.BEFORE_NEXT_EVENT && | 379 (pingType == Isolate.BEFORE_NEXT_EVENT && |
380 !_isExecutingEvent)) { | 380 !_isExecutingEvent)) { |
381 responsePort.send(null); | 381 responsePort.send(null); |
382 return; | 382 return; |
383 } | 383 } |
384 void respond() { responsePort.send(null); } | 384 void respond() { responsePort.send(null); } |
385 if (pingType == Isolate.AS_EVENT) { | |
386 _globalState.topEventLoop.enqueue(this, respond, "ping"); | |
387 return; | |
388 } | |
389 assert(pingType == Isolate.BEFORE_NEXT_EVENT); | 385 assert(pingType == Isolate.BEFORE_NEXT_EVENT); |
390 if (_scheduledControlEvents == null) { | 386 if (_scheduledControlEvents == null) { |
391 _scheduledControlEvents = new Queue(); | 387 _scheduledControlEvents = new Queue(); |
392 } | 388 } |
393 _scheduledControlEvents.addLast(respond); | 389 _scheduledControlEvents.addLast(respond); |
394 } | 390 } |
395 | 391 |
396 void handleKill(Capability authentification, int priority) { | 392 void handleKill(Capability authentification, int priority) { |
397 if (this.terminateCapability != authentification) return; | 393 if (this.terminateCapability != authentification) return; |
398 if (priority == Isolate.IMMEDIATE || | 394 if (priority == Isolate.IMMEDIATE || |
399 (priority == Isolate.BEFORE_NEXT_EVENT && | 395 (priority == Isolate.BEFORE_NEXT_EVENT && |
400 !_isExecutingEvent)) { | 396 !_isExecutingEvent)) { |
401 kill(); | 397 kill(); |
402 return; | 398 return; |
403 } | 399 } |
404 if (priority == Isolate.AS_EVENT) { | |
405 _globalState.topEventLoop.enqueue(this, kill, "kill"); | |
406 return; | |
407 } | |
408 assert(priority == Isolate.BEFORE_NEXT_EVENT); | 400 assert(priority == Isolate.BEFORE_NEXT_EVENT); |
409 if (_scheduledControlEvents == null) { | 401 if (_scheduledControlEvents == null) { |
410 _scheduledControlEvents = new Queue(); | 402 _scheduledControlEvents = new Queue(); |
411 } | 403 } |
412 _scheduledControlEvents.addLast(kill); | 404 _scheduledControlEvents.addLast(kill); |
413 } | 405 } |
414 | 406 |
415 void addErrorListener(SendPort port) { | 407 void addErrorListener(SendPort port) { |
416 errorPorts.add(port); | 408 errorPorts.add(port); |
417 } | 409 } |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 } | 1438 } |
1447 | 1439 |
1448 bool operator==(Object other) { | 1440 bool operator==(Object other) { |
1449 if (identical(other, this)) return true; | 1441 if (identical(other, this)) return true; |
1450 if (other is CapabilityImpl) { | 1442 if (other is CapabilityImpl) { |
1451 return identical(_id, other._id); | 1443 return identical(_id, other._id); |
1452 } | 1444 } |
1453 return false; | 1445 return false; |
1454 } | 1446 } |
1455 } | 1447 } |
OLD | NEW |