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

Unified Diff: runtime/bin/vmservice/vmservice.dart

Issue 19622003: VM Service isolate listing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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
Index: runtime/bin/vmservice/vmservice.dart
diff --git a/runtime/bin/vmservice/vmservice.dart b/runtime/bin/vmservice/vmservice.dart
index e074e9a4d4b6663c78fa2652a7c9f2ca5fbd48c4..b8949f52e1c4e44cf0ef6fd98ed96e52287dbcad 100644
--- a/runtime/bin/vmservice/vmservice.dart
+++ b/runtime/bin/vmservice/vmservice.dart
@@ -6,16 +6,49 @@ library vmservice;
import 'dart:async';
import 'dart:json' as JSON;
+// TODO(johnmccutchan): Factor 'dart:io' dependency into separate library.
siva 2013/07/19 17:41:16 Can we open an issue and add that issue number her
Cutch 2013/07/19 18:15:02 Done.
import 'dart:io';
import 'dart:isolate';
import 'dart:typed_data';
import 'dart:utf' as UTF;
-void messageHandler(message, SendPort replyTo) {
-}
+class VmService {
+ static VmService _instance;
+ RunningIsolates runningIsolates = new RunningIsolates();
+
+ void controlMessageHandler(int code, SendPort sp) {
+ switch (code) {
+ case Constants.isolateStartupMessageId:
+ runningIsolates.isolateStartup(sp);
+ break;
+ case Constants.isolateShutdownMessageId:
+ runningIsolates.isolateShutdown(sp);
+ break;
+ }
+ }
+
+
+ void messageHandler(message, SendPort replyTo) {
+ if (message is List && message.length == 2) {
+ controlMessageHandler(message[0], message[1]);
+ }
+ }
-main() {
- port.receive(messageHandler);
+ VmService._internal() {
+ port.receive(messageHandler);
+ }
+
+
+ factory VmService() {
+ if (VmService._instance == null) {
+ VmService._instance = new VmService._internal();
+ }
+ return _instance;
+ }
}
+
+void sendServiceMessage(SendPort sp, ReceivePort rp, Object m)
+ native "SendServiceMessage";
+

Powered by Google App Engine
This is Rietveld 408576698