Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: sdk/lib/_internal/lib/isolate_helper.dart

Issue 186403003: Add Isolate ping functionality. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/isolate_helper.dart
diff --git a/sdk/lib/_internal/lib/isolate_helper.dart b/sdk/lib/_internal/lib/isolate_helper.dart
index fa3765e673cdb3a57a72d0277a7f86d140da9887..8a19dc68f8ec115055d8fa9849269fa69506318b 100644
--- a/sdk/lib/_internal/lib/isolate_helper.dart
+++ b/sdk/lib/_internal/lib/isolate_helper.dart
@@ -331,6 +331,18 @@ class _IsolateContext implements IsolateContext {
this.errorsAreFatal = errorsAreFatal;
}
+ void handlePing(SendPort responsePort, int pingType) {
+ if (pingType == Isolate.PING_EVENT) {
+ _globalState.topEventLoop.enqueue(this, () {
+ responsePort.send(null);
+ }, "ping");
+ } else {
+ // There is no difference between PING_ALIVE and PING_CONTROL
+ // since we don't handle it before the control event queue.
+ responsePort.send(null);
+ }
+ }
+
/**
* Run [code] in the context of the isolate represented by [this].
*/
@@ -369,6 +381,9 @@ class _IsolateContext implements IsolateContext {
case 'set-errors-fatal':
setErrorsFatal(message[1], message[2]);
break;
+ case "ping":
+ handlePing(message[1], message[2]);
+ break;
default:
print("UNKNOWN MESSAGE: $message");
}
« no previous file with comments | « no previous file | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698