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

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: Created 6 years, 10 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') | sdk/lib/isolate/isolate.dart » ('J')
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 691cfe20ccf03d34063c5f351ae489a0cd24d4b1..eefab48e333fe87970c2b04804a07d35de885965 100644
--- a/sdk/lib/_internal/lib/isolate_helper.dart
+++ b/sdk/lib/_internal/lib/isolate_helper.dart
@@ -302,6 +302,18 @@ class _IsolateContext implements IsolateContext {
_updateGlobalState();
}
+ 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].
*/
@@ -331,6 +343,9 @@ class _IsolateContext implements IsolateContext {
case "resume":
removePause(message[1]);
break;
+ case "ping":
+ handlePing(message[1], message[2]);
+ break;
default:
print("UNKOWN MESSAGE: $message");
}
« no previous file with comments | « no previous file | sdk/lib/isolate/isolate.dart » ('j') | sdk/lib/isolate/isolate.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698